[whatwg] documentFragment and innerHTML
raf at ratherodd.com
Sat Feb 26 06:52:18 PST 2011
On Fri, Feb 25, 2011 at 4:18 PM, Boris Zbarsky <bzbarsky at mit.edu> wrote:
> If you want to parse this string:
> <form><tr><td>Some text</td></tr></form>
> then the DOM it produces depends on whether it's being parsed in the
> of a <table> parent element or not. Try setting the innerHTML of a
> and a <div> to the above string, and examine the resulting DOM trees.
> That's what I meant when I said that to properly parse a string you need
> know the context it's being parsed in.
Thank you Boris, a very nice example.
On 25 February 2011 21:56, Aryeh Gregor <Simetrical+w3c at gmail.com> wrote:
> Isn't this exactly what insertAdjacentHTML() does?
Yes, I had just never heard of insertAdjacentHTML(), since it doesn't enjoy
Webkit or Gecko support. Once it does though, I agree it's a nice addition.
As for createContextualFragment(), it bring unnecessary complexity to this,
having to mess about with ranges.
Thanks for pointing out insertAdjacentHTML() - I'll keep an eye on its
More information about the whatwg