3 ms·
Why aren't XPointer/XPath fragments used instead of yet another half-backed reimplementation of the same concept? XPointer and XPath have been ratified by the
by gioele 8y ago
Why aren't XPointer/XPath fragments used instead of yet another half-backed reimplementation of the same concept?
XPointer and XPath have been ratified by the W3C in (...checks...) 2003. They have since been revised, slimmed down and used in countless XML-based applications and specs.
The cool thing about XPointer is that it is basically impossible that its fragments are already used in the target document. No site would break if XPointer were used.
Examples of XPointers:
* Pointer to _all_ the occurrences of "target text" anywhere in the page (goodbye JS-inserted <mark>)
#xpointer(string-range(//,"target text"))
Pointer to all occurrences of "target text" in a <p> in the <main> article
#xpointer(string-range(//main//p,"target text"))
* Pointer to the second <h2> heading
#xpointer(//h2[2])
* Pointer to that specific bullet point that you want your colleague to change ASAP
#xpointer(//ul[7]/li[3])
* Abbreviated fall-back to XPath
#//ul[7]/li[3]
- csarven 8y agoXPointer is one of options for a fragment selector in W3C Reference Note on Selectors and States: https://www.w3.org/TR/selectors-states/ https://www.w3.org/TR/selectors-states/ See also https://news.ycombinator.com/item?id=19169582 https://news.ycombinator.com/item?id=19169582
- ben174 8y agoI suppose it could be argued that the DOM might change on a page, but the text content is less likely to. We want deep links to the text content, not the DOM element.