[whatwg] getElementsByAttr

Charles McCathieNevile chaals at opera.com
Fri Jul 6 12:43:56 PDT 2007

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

More information about the whatwg mailing list