In order to keep subsequent code clear, I added a new method like this
HTMLDivElement.prototype.foo = function(arg) {
// foo for HTML div trees
}
Element.prototype.foo = function(arg) {
// foo for XML tree retrieved using XMLHttpRequest
}
Since I had used the same approach for extending Array in IE 5.0, I
thought this was a cross-browser compatible approach. I was so naïve!
It seems this works in gecko-based browsers only.
Is there a trick for making this work in IE 6, Safari and Opera 8? Or
should I write two functions like this
function fooHtml(elt, arg) {
// ...
}
function fooXml(elt, arg) {
// ...
}
?
--
Henri Sivonen
hs******@iki.fi
http://hsivonen.iki.fi/