Closed BenWard closed 12 years ago
Investigating
do you get the same error when doing this?
var $t = jQuery('time')
$t.html("10 minutes ago")
I've been working on a whole test-case page for this (bonzo+qwery, compared to JQuery, compared to raw DOM) and I'll attach that somewhere shortly. In short though, it depends on how the element is created. If it's already in the DOM (either statically in the page, or via setting a parent innerHTML the scripting functionality of the node is dysfunctional.
It's not quite analogous to the CSS styling shim though, since I believe that just requires creating the element once, and all future elements are recognised by the CSS parser, with this, it's only the explicitly created elements that have the expected functionality.
I'll share the test case page when I get back to the other computer. It's goofy, and I can believe it's not sanely fixable (the only thing might be to find a way to have the lib handle errors more gracefully.)
Attempting to write innerHTML or appendChild to an unknown element in old versions of IE results in an
Unknown runtime error
from those browsers (even if the element is declared usingdocument.createElement('time')
previously.)e.g.
Will trigger the error in IE.
Might be worth looking at @jdbartlett's innerShiv, although I think that may only handle the creation of unknown/HTML5 elements within elements that are already functional nodes, rather than the enabling of DOM functionality on those unknown elements.