[whatwg] getElementsByCSSSelector

liorean liorean at gmail.com
Sat Jan 14 09:55:17 PST 2006

On 14/01/06, Jim Ley <jim.ley at gmail.com> wrote:
> On 1/14/06, Karoly Negyesi <karoly at negyesi.net> wrote:
> Why would you want to change the content of all elements that matched
> a particular selector?

Or any other manipulation, as well as just extracting data.

> Could you explain some use cases?

For the very same reason you might want DOM to provide an XPATH
engine, TreeWalkers or NodeIterators - To get efficient host-native
filtering of the node tree. In this case, filtering based on a scheme
used in related technologies. Preferably returning a DOMCollection
instead of a static array or matches.

Selectors are to DOM node trees what regex are to strings - native
ways of doing simple or complex filtering. Regex can be used to among
other things confirm existance of patterns in a string(re.test),
listing pattern matches in a string(str.match), or replacing matches
in a string(str.replace). All of these concepts could easily be
transferred from regex-string to selector-nodetree.
David "liorean" Andersson

More information about the whatwg mailing list