W3C home > Mailing lists > Public > public-webapi@w3.org > March 2008

Re: [Element Traversal LC] access to element by index

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Fri, 28 Mar 2008 12:43:59 -0500
Message-ID: <47ED2E5F.8050706@mit.edu>
To: Doug Schepers <schepers@w3.org>
CC: public-webapi@w3.org

Doug Schepers wrote:
> Couldn't you do this?
> 
> var kids = myFooElement.querySelectorAll("*");
> var middleChild = kids.item( 3 ); //or kids[ 3 ];

<body>
   <span/>
   <span><img/></span>
   <div/>
</body>

Your proposed code returns the <img/>.  Daniel wants the <div/>.

-Boris
Received on Friday, 28 March 2008 17:44:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 28 March 2008 17:44:40 GMT