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

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
hsivonen@iki.fi
http://hsivonen.iki.fi/

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