Inserting arbitrary HTML into a DocumentFragment
I know that adding innerHTML to document fragments has been recently discussed, and will hopefully see inclusion in the DOM Standard. But, what is the workaround you're supposed to use in the meantime? That is, take var html = '<div>x</div><span>y</span>'; var frag = document.createDocumentFragment(); I want both the div and the span inside of frag , with an easy one-liner. Bonus points for no loops. jQuery is allowed, but I've already tried $(html).appendTo(frag) ; frag is still empty afterward. Here is a way in modern browsers without looping: var temp = document.createElement('template');