Forum Moderators: open
I've been delving into Javascript recently after years of non-use, and I'm trying to make all my scripts W3C DOM-compatible. It doesn't really lend me any benefits, but it feels a lot nicer to code and a lot more logical. The biggest pain in getting most of my scripts to work is, of course, IE. Normally I like to make up for IE's shortcomings by writing my own transparent DOM-compatible functions in the background, and I don't want to create special functions and different execution paths for different browsers.
My way is easy for some issues (emulating Array.push for IE5, semi-emulating getElementById() for IE4 and NS4) but in order for it to work with my next problem, I need to know what the constructor and prototype is for HTML elements in IE; the new functions and variables should to be applied to all HTML elements. I know that Mozilla uses HTMLElement, but what does IE use, if anything? And does IE5 for Mac use the same constructor?
Thanks for your time!
The options all have drawbacks. You can wrap all the elements that you want to deal with; use behaviors (.htc s)); or teach Mozilla to speak IE's language (easier, but hardly very 'progressive').
WebFX [webfx.eae.net] deals with these issues,
and then there's Dean Edwards' IE 7 [dean.edwards.name] project.
The only option, to fix it transparently, seems be behaviors, but I think it's just not worth it in this case. I'll simply redirect to the non-standard code when the browser doesn't support it, as much as I don't like doing so. (the case being that IE5 doesn't use attribute nodes, but rather the value itself, on element.attributes[]; it also generates an error if I try to write directly to the array)
Still, behaviors does seem to open up some possibilities if I ever get a problem big enough, so hopefully that option will be open if I ever really need it...