W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2007

[whatwg] getElementsByAttr

From: Charles McCathieNevile <chaals@opera.com>
Date: Fri, 06 Jul 2007 21:43:56 +0200
Message-ID: <op.tu16fio2wxe0ny@widsith.local>
On Fri, 06 Jul 2007 21:24:25 +0200, Sander <html5 at zoid.nl> wrote:

> I'd like to see a getElementsByAttr method. It would be quite similar as
> the getElementsByClassName method but with an extra argument:
> getElementsByAttr(attribute_name, value)

The W3C's WebAPI group is specifying a selectors API (the spec was mostly  
put together by Anne van Kesteren, and now Lachy Hunt is finishing it up),  
which allows you to do this. The longest running issue is the name of the  
methods (hopefully we have some closure on that now...) but it lets you do  
something like

methodName("*[lang|=en]") that returns whatever matches that selector....

the current editor's draft can be found at  



   Charles McCathieNevile, Opera Software: Standards Group
   hablo espa?ol  -  je parle fran?ais  -  jeg l?rer norsk
chaals at opera.com    Catch up: Speed Dial   http://opera.com
Received on Friday, 6 July 2007 12:43:56 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:57 UTC