script: Fix two issues in the XPath parser to pass all xml_xpath_tests.xml tests (#37279)

1. Better handling of namespaces for element and attribute names in XML
mode (read: non-HTML mode)
2. While parsing, pass along context on whether we are in an absolute
(`/`) or descendant (`//`) part of the query, and use it to correctly
enumerate descendants according to where we are in the evaluation of the
AST.

Testing: All 1024 tests in `xml_xpath_tests.xml` (actually
`xml_xpath_runner.html`) pass, as well as some random tests in
`text-html-attributes.html`.
Fixes: #37278

---------

Signed-off-by: Ville Lindholm <ville@lindholm.dev>
This commit is contained in:
Ville Lindholm 2025-06-06 10:16:42 +03:00 committed by GitHub
parent c7eba2dbba
commit 475a3dfa38
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 104 additions and 3140 deletions

View file

@ -1,13 +1,7 @@
[text-html-attributes.html]
[Select html element based on attribute]
expected: FAIL
[Select html element based on attribute mixed case]
expected: FAIL
[Select both HTML and SVG elements based on attribute]
expected: FAIL
[Select HTML element with non-ascii attribute 1]
expected: FAIL
@ -23,9 +17,6 @@
[Select both HTML and SVG elements based on mixed case attribute]
expected: FAIL
[Select SVG elements with refX attribute]
expected: FAIL
[Select SVG element with non-ascii attribute 1]
expected: FAIL

File diff suppressed because it is too large Load diff