W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2005

Re: [dom3core] getAttribute

From: Ray Whitmer <ray@personallegal.net>
Date: Wed, 7 Dec 2005 09:23:26 -0700
Message-Id: <DFE75B07-5641-4795-B423-D125C67DC033@personallegal.net>
Cc: www-dom@w3.org
To: Johnny Stenback <jst@w3c.jstenback.com>

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?

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

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:12 UTC