Re: typeof document.all

On Oct 12, 2009, at 6:40 PM, Boris Zbarsky wrote:

>> On the other hand, there are many potential performance tradeoffs  
>> to how
>> exactly DOM attributes get implemented. This concern would be  
>> lessened
>> if we could show that it's possible to use a variety of  
>> implementation
>> strategies while getting consistent output from hasOwnProperty() and
>> getOwnPropertyDescriptor().
>
> I should note that I've recently considered making .style end up as  
> a property on nodes directly, instead of being a property on the  
> prototype in Gecko, for performance reasons.  This is almost  
> certainly script-detectable, though, if scripts define getters and  
> setters for .style on nodes directly...

FWIW: In WebKit, (nearly) all DOM methods are on the prototype, and  
(nearly) all DOM attributes are own properties. I don't believe we've  
had a problem with this setup. I do believe people would complain if  
we made methods be own properties though, since we definitely have  
demand for ability to hack the prototype.

More specifically, we don't implement DOM attributes as JS-level  
getters and setters internally, there is a special-purpose mechanism  
for programatically implemented properties, but we are considering  
exposing them that way to getOwnPropertyDescriptor (in which case we'd  
probably make the getter and setter function objects on demand or  
something).

Regards,
Maciej

Received on Tuesday, 13 October 2009 07:10:14 UTC