Tuesday, September 30, 2008

Difference between parentNode and parentElement

Just a quick blog post to vent the frustration as I continue to convert a very large web application to a fully cross-browser compatible site. Over 150 lines of code refer to parentNode. parentNode is compatible with IE4+ and Safari 1.2+ of all things. To make this fully standards compliant, you can pretty much blindly replace parentNode with parentElement. Although they are very very simliar, they do have some differences. If we're talking about a standard element then they work the same. However, if you have an attribute or text node or something else then there will be some differences. That's it for now. Hope this helps!