W3C home > Mailing lists > Public > public-webapi@w3.org > July 2007

Re: Ambiguity in removeAttributeNode

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Sat, 28 Jul 2007 08:07:13 +0200
To: Travis Leithead <travil@windows.microsoft.com>
Cc: <public-webapi@w3.org>, Chris Wilson <chris.wilson@microsoft.com>
Message-ID: <l6mla3h3phc4q0qamkgek5m592jghr481m@hive.bjoern.hoehrmann.de>

* Travis Leithead wrote:
>We happened to notice an interesting behavior difference in
>removeAttributeNode recently, and an appeal to the standard didn't seem
>to help...

>            var pElem = document.getElementById('foo');
>            var newAttr = document.createAttribute('align');
>            newAttr.value = "right";
>            try {
>                  var oldAttr = pElem.removeAttributeNode(newAttr);

>      <p id="foo" align="left">Sample text</p>

>IE fails in this example and triggers the try/catch. FF works, Opera
>also fails. It seems that some browser implementers deciphered the DOM
>Core spec::removeAttributeNode to mean that "object" comparison is used
>as the delete criteria, but others seem to only base it on the "name" of
>the Attr. 

Well, removeAttributeNode removes the specified attribute node from the
element the method is called on, and raises a NOT_FOUND_ERR exception
"if oldAttr is not an attribute of the element"; that seems very clear
to me, in your example newAttr is not an attribute of pElem since new-
Attr.ownerElement != pElem.

>Is there hope in coming to harmony across implementations on this point?

This just seems to be a bug in Firefox, if somebody files it, it should
be fixed sooner or later.
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Saturday, 28 July 2007 06:07:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:58 GMT