Re: [dom3core] getAttribute

On Dec 6, 2005, at 2:58 PM, Johnny Stenback wrote:

>
> Indeed. getAttribute() in IE is seemingly mapped to property  
> getters on elements, i.e. element.foo === element.getAttribute 
> ("foo"). Given that, whether you get null or "" back from  
> getAttribute() depends on the element and the attribute you're  
> looking for. If the attribute is an attribute that's a string  
> attribute, like say, document.body.getAttribute("bgcolor"), you'll  
> get "" if the attribute is not defined, but if you do the same  
> thing with "onunload" you'll get null back, since that's an event  
> handler *property* which defaults to null in IE... Whether this  
> ever changed in IE I don't know.

So, we seem know for these historical (Level 0) versions of IE, any  
supported string attribute would return a "", not a null.

My claim that IE changed unilaterally after level 0 with respect to  
supported string attributes was apparently dead wrong, in part  
because it was based on the assumption IE had become basically  
noncompliant (apparent claims that the null return was to emulate it).

An implementation which returned null for all unspecified attributes  
would seem to only be compatible with IE when looking for js handlers  
or other things not stored as strings or other default values or for  
unknown/unsupported attributes (debatable in this case if historical  
versions did not store unknown/unsupported attributes)?

Is there any attempt to emulate the IE behavior attribute by  
attribute in Mozilla?

Also, is there Netscape history that is applicable (from when  
Netscape was dominant), that may have played into the interpretation  
of DOM Level 0?

Ray

Received on Wednesday, 7 December 2005 16:23:47 UTC