- From: Maciej Stachowiak <mjs@apple.com>
- Date: Wed, 30 Nov 2005 16:18:54 -0800
- To: Anne van Kesteren <annevk@opera.com>
- Cc: DOM mailing list <www-dom@w3.org>, vicki Murley <vicki@apple.com>, andersca@mac.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: http://bugzilla.opendarwin.org/show_bug.cgi?id=4567 We'd like to get to 100% compliance but changing this behavior would be too big a hit to compatibility. Regards, Maciej
Received on Thursday, 1 December 2005 12:29:06 UTC