Proposal - Update XPath to (at least) v2.0
While the latest recommendation is [v3.1](https://www.w3.org/TR/xpath-31/), most questions related to XPath seems to miss *Regular Expressions*, introduced in [v2.0](https://www.w3.org/TR/xpath20/) which is nearly a 10 years ago recommendation. However, all browsers support only [XPath v1.0 from 1999](https://www.w3.org/TR/1999/REC-xpath-19991116/). ## Background Widely [adopted in 2007 by popular frameworks](https://johnresig.com/blog/xpath-overnight/) such as Dojo, Prototype, or Mootools, the *XPath* language is an extremely powerful tool to query and crawl the DOM in all its axes, hence superior than CSS, and able to unleash proposed selectors already, such as `:has(...)` even in its version 1. ```js // CSS container:has(child) // XPath since 1999 './/container[count(.//child) > 0]' ``` But this is only scratching the surface of operations that XPath can do, as opposite of querying via CSS, check surrounding DOM nodes via JS, check results are valid (i.e. `if (child.closest('container'))` plus there's no way to target text nodes or even comments. ## Proposal Provide at least the method `matches(RegExp, flag)` to the current XPath 1.0 (let's call it 1.1) *or* provide at least v.2 of this old but gold standard to crawl any DOM tree, as if it's still updated and useful for back end crawlers, it's unclear why the first class citizen JS should not benefit from its potentials, way superior than CSS selectors, and less error prone, as filtering and complex searches can be
Posted by WebReflection on Oct 13, 2020, 11:15 AM
Tags
Related issues
- some bike vendor told me that the biggest problem with regular to ebike conversion was that regular bike frames were not strong enough to...
- I think of this as the kiosk economy.
- What a goofy comment.
- There's lots of evidence for positive influences of Caffeine on the body (some negative as well), especially the brain.
- Compose support in WSLc
- [RFC] Roadmap to v2.0
Raise real-world problems, find people facing the same issue, and discuss solutions.3,000 issues0 comments
support (Other)
some bike vendor told me that the biggest problem with regular to ebike conversion was that regular bike frames were not strong enough to...
I think of this as the kiosk economy.
What a goofy comment.
There's lots of evidence for positive influences of Caffeine on the body (some negative as well), especially the brain.
Compose support in WSLc
[RFC] Roadmap to v2.0
[Feature]: Add TurboQuant Support for KV Cache Quantization
Support for AGENTS.md and .agents/skills/, the community has been asking since August 2025
Proposal - Update XPath to (at least) v2.0
While the latest recommendation is [v3.1](https://www.w3.org/TR/xpath-31/), most questions related to XPath seems to miss *Regular Expressions*, introduced in [v2.0](https://www.w3.org/TR/xpath20/) which is nearly a 10 years ago recommendation. However, all browsers support only [XPath v1.0 from 1999](https://www.w3.org/TR/1999/REC-xpath-19991116/). ## Background Widely [adopted in 2007 by popular frameworks](https://johnresig.com/blog/xpath-overnight/) such as Dojo, Prototype, or Mootools, the *XPath* language is an extremely powerful tool to query and crawl the DOM in all its axes, hence superior than CSS, and able to unleash proposed selectors already, such as `:has(...)` even in its version 1. ```js // CSS container:has(child) // XPath since 1999 './/container[count(.//child) > 0]' ``` But this is only scratching the surface of operations that XPath can do, as opposite of querying via CSS, check surrounding DOM nodes via JS, check results are valid (i.e. `if (child.closest('container'))` plus there's no way to target text nodes or even comments. ## Proposal Provide at least the method `matches(RegExp, flag)` to the current XPath 1.0 (let's call it 1.1) *or* provide at least v.2 of this old but gold standard to crawl any DOM tree, as if it's still updated and useful for back end crawlers, it's unclear why the first class citizen JS should not benefit from its potentials, way superior than CSS selectors, and less error prone, as filtering and complex searches can be
Comments (0)
No comments yet. Start the discussion.