> When I called $('#something').html(newHTML), I expect this to behave > somewhat like innerHTML = newHTML.
That's basically how it works, too; the string of HTML is assigned to the innerHTML of a div, and the resulting DOM elements are pulled out of the div to place into the jQuery element. As long as the string is something that can be parsed by the browser's innerHTML, things usually work out right. > However, because of all the logic > inside that uses documentFragment, and elements outside of documents, > unknown tags are being munged up in IE: The string is not HTML, so the effect of assigning a non-HTML string to innerHTML is hard to predict. It's similar to having IE parse XML with innerHTML; it only "works" if your XML tags happen to match HTML ones and the structure of the XML follows HTML rules (e.g., input/img elements can't have children). But that's by luck and not by design. > This happens because IE can only handle unknown tags if the document > has created an element with that nodeName before, and it can only > handle those tags inside the document ... Whoa, that's an interesting effect. So using createElement at some point in the document could actually change what innerHTML can parse later? Good old IE. :-( Bottom line though, the string you pass to .html() should be a valid fragment for the doctype of the current document. Remember that IE doesn't support XHTML doctypes, so that only gets through by the grace of its sloppy tag-soup parser. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---