IE appendChild
Errors in IE 8, appendChild not supported for IE element DispHTMLStyleElement. Occurs when building style elements.
interesting. do you know the best way to detect this? or should we just try on all STYLE elements and innerHTML on catch?
I'm not sure, but I think the problem might be bigger than fixing this for the STYLE element only on IE, well IE pre version 9 I guess (haven't fully tested this). It looks like it has to do with IE's interpretation of when the DOM is avaialble. I did write a hack in your code that injects the CSS style into the document styleSheet.CSSText property, a += like operation, for IE only, but IE 8 is still complaining about the DOM not ready, even if I run your code without any STYLE attributes, IE still complains :/
I have 2 hacks in place right now to get this working for IE 6. The first hack is to wrap my implementation of your top level HTML method in a document ready function. The 2nd hack deals with the STYLE attribute as described above. Here is the STYLE attribute hack. Disclaimer: this has not been fully tested
// IE Hack for STYLE element
if(element.nodeName == 'STYLE' && element.styleSheet) {
for(i=0;i<childNodes.length;i++)
element.styleSheet.cssText += childNodes[i]
}
else
element.appendChild(this.FRAGMENT.apply(this, childNodes)
I had the same problem with style elements in IE 8 and added mostly the same hack into the ELEMENT function of domo. The difference to yours is that IE9 still uses appendChild to generate the styles.
if ( typeof element.appendChild !== 'function' && element.styleSheet ) {
element.styleSheet.cssText = childNodes.join('')
}
else {
element.appendChild(
this.FRAGMENT.apply(this, childNodes)
)
}