Ambiguity in removeAttributeNode

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 UTC