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

Re: [dom3core] getAttribute

From: Maciej Stachowiak <mjs@apple.com>
Date: Wed, 30 Nov 2005 16:18:54 -0800
Message-Id: <F77EE224-810A-4FD4-AC32-3B2F76C6CC00@apple.com>
Cc: DOM mailing list <www-dom@w3.org>, vicki Murley <vicki@apple.com>, andersca@mac.com
To: Anne van Kesteren <annevk@opera.com>

On Nov 18, 2005, at 2:15 PM, Anne van Kesteren wrote:

> Currently the DOM Level 3 Core specification (and earlier Core  
> editions of the DOM specifications) specifies that the getAttribute  
> method on the Element interface return the empty string for  
> unspecified attributes[1].
> Opera has implemented this behavior.
> However, other browsers return null. Where other browsers are  
> Internet Explorer, Firefox, Safari, Konquerer and iCab. As  
> developers typically develop against the market leader there is a  
> lot of code like:
>  getAttribute('foo') != null
> ... out there. As "" does not compute to null... Opera will  
> probably change its behavior to be in line with the above mentioned  
> browsers. Is there a possibility for getting erratum on  
> getAttribute and related methods?

I agree that there should be an erratum for this. We had the  
standards-conforming behavior in Safari at one point, and it broke  
many sites, because historically IE and Mozilla have returned null in  
this case.

Both "" and null are reasonable things to return for a nonexistent  
attribute, there is no deep principle at stake here. In fact one  
could argue that it's better to distinguish empty attribute value  
from absent attribute. So it seems better to update the formal spec  
to the de facto standard behavior.

This issue is one of four remaining Safari failures on the DOM Level  
1 Core test suite:


We'd like to get to 100% compliance but changing this behavior would  
be too big a hit to compatibility.

Received on Thursday, 1 December 2005 12:29:06 UTC

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