"Warning: In DOM Core 1, 2 and 3, Attr is inherited from Node. This is no longer the case with DOM4. To bring the implementation of Attr to the specification, work is underway to change it. It is no longer inherited from Node. You should not use any properties or Node methods for Attr objects. Starting with Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4), those that are deleted will display warning messages to the console. You should revise your code accordingly. See " Deprecated properties and methods for a complete list. "
Scrolling through the page, we can see the replacements for nodeName and NodeValue, using Attr.name and Attr.value.
https://developer.mozilla.org/en/DOM/Attr#Deprecated_properties_and_methods
What does this mean for other methods like attributes or childNodes? The link says that it is out of date, but they do not give any replacement!
This is deprecated for the attribute, but is it also for Node?
Attr Object: http://www.w3schools.com/jsref/dom_obj_attr.asp
Edit: nodeValue will ONLY be deprecated for attributes (Attr), since Attr will not inherit from Node anymore in DOM Level 4:
Here is a quick example that helped me understand:
<div id="myAttribute">myTextNode</div> var myDiv = document.getElementById("myAttribute");
Perhaps this will avoid confusion with others when accessing attributes / nodes :)
baptx
source share