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

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

From: Henri Sivonen <hsivonen@iki.fi>
Date: Wed, 2 Apr 2008 00:45:14 +0300
Cc: "Web APIs WG (public)" <public-webapi@w3.org>
Message-Id: <DE70B656-E9E5-4518-8FE4-1F7BB4AC9C91@iki.fi>
To: Boris Zbarsky <bzbarsky@MIT.EDU>

On Apr 2, 2008, at 00:30, Boris Zbarsky wrote:
>>> Really?  You mean document.body.item(5) does the same thing as  
>>> document.body.childNodes.item(5)?  And that this is "common"?  I  
>>> must have missed it....
>> I mean that the getter implementation for childNodes is roughly  
>> "return this;".
>> This pattern is used in Crimson, Xerces and GNU JAXP DOM  
>> implementations.
> That doesn't really answer my question.  Are all the same properties  
> available on |this| and |this.childNodes|?  If so, that seems pretty  
> odd to me (though not actually prohibited by the DOM spec, of course).

Yes, getChildNodes() is available on an object implementing Element  
after casting it to NodeList or through reflections. There's no  
technical barrier to such casting--in the best case just docs saying  
that doing so is naughty reliance on an unguaranteed implementation  
detail and shouldn't be done.

Henri Sivonen
Received on Tuesday, 1 April 2008 21:45:54 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:10:00 UTC