W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2006

[whatwg] getElementsByCSSSelector

From: liorean <liorean@gmail.com>
Date: Sat, 14 Jan 2006 18:55:17 +0100
Message-ID: <cee13aa30601140955s51c9dfe5s@mail.gmail.com>
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
<uri:http://liorean.web-graphics.com/>
Received on Saturday, 14 January 2006 09:55:17 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:25 UTC