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

Ambiguity in removeAttributeNode

From: Travis Leithead <travil@windows.microsoft.com>
Date: Thu, 26 Jul 2007 22:49:32 -0700
Message-ID: <096A2EC46B3C084BA8D73D2280C55DD50691B844@WIN-MSG-21.wingroup.windeploy.ntdev.microsoft.com>
To: <public-webapi@w3.org>, <ian@hixie.ch>, <bjoern@hoehrmann.de>
CC: Chris Wilson <chris.wilson@microsoft.com>
In light of the DOM Core L3 Second Edition...

 

We happened to notice an interesting behavior difference in
removeAttributeNode recently, and an appeal to the standard didn't seem
to help...

 

<html>

 <head>

   <script type=text/javascript>

      function doFoo()

      {

            var pElem = document.getElementById('foo');

            var newAttr = document.createAttribute('align');

            // To illustrate that these are not the same attribute
exactly...

            newAttr.value = "right";

            try {

                  var oldAttr = pElem.removeAttributeNode(newAttr);

                  alert(oldAttr.value + ": command successful");

            } catch (e) {

                  alert("removeAttributeNode failed with message: " +
e.message);

            }

      }

   </script>

 </head>

 <body onload="doFoo()">

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

 </body>

</html>

 

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. 

 

Is there hope in coming to harmony across implementations on this point?
Or how should the spec be interpreted?

 

-Travis Leithead

MS Windows Internet Explorer
Received on Saturday, 28 July 2007 05:44:52 GMT

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