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

RE: Ambiguity in removeAttributeNode

From: Travis Leithead <travil@windows.microsoft.com>
Date: Sat, 28 Jul 2007 02:59:34 -0700
Message-ID: <096A2EC46B3C084BA8D73D2280C55DD50691BC51@WIN-MSG-21.wingroup.windeploy.ntdev.microsoft.com>
To: Bjoern Hoehrmann <derhoermi@gmx.net>
CC: <public-webapi@w3.org>, Chris Wilson <chris.wilson@microsoft.com>

Thanks for the sanity check ;)

-----Original Message-----
From: Bjoern Hoehrmann [mailto:derhoermi@gmx.net] 
Sent: Friday, July 27, 2007 11:07 PM
To: Travis Leithead
Cc: public-webapi@w3.org; Chris Wilson
Subject: Re: Ambiguity in removeAttributeNode

* 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 10:00:20 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:16:24 UTC