Skip to content

XPath does not report failure for expression ... #38552

@yezhizhen

Description

@yezhizhen

Describe the bug:
In other browsers, we would get Uncaught DOMException: Document.evaluate: The expression is not a legal expression. In Servo, we still get current node:

    "...",
    PhantomData<*const ()>,
)

[2025-08-08T14:04:04Z DEBUG script::xpath] Evaluated XPath: Nodeset([<button id=check>])

To Reproduce:
./mach run -r <following-file> --pref=dom_xpath_enabled

<button id="check">evaluate invalid xpath</button>
<script>
  document.getElementById('check').addEventListener('click', () => {    
    const result3 = document.evaluate("...", document.getElementById("check"), null, null, null).iterateNext();
    console.log(result3);
  });
</script>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions