- From: Daniel Cheng <dcheng@chromium.org>
- Date: Fri, 4 Nov 2011 11:13:11 -0700
- To: "Tab Atkins Jr." <jackalmage@gmail.com>
- Cc: João Eiras <joaoe@opera.com>, public-webapps WG <public-webapps@w3.org>
In that example, there was a clear context element though--I'd argue that Range.createContextualFragment should have been used instead. It seems like the general use of such a function would be to add some nodes from a snippet of HTML markup into a div for example, where synthesizing the correct context elements would make more sense. Daniel On Fri, Nov 4, 2011 at 09:45, Tab Atkins Jr. <jackalmage@gmail.com> wrote: > On Fri, Nov 4, 2011 at 9:33 AM, Daniel Cheng <dcheng@chromium.org> wrote: >> Instead of simply switching the insertion mode when you see an element that >> doesn't belong in in-body mode for context-less parsing, would it make sense >> to synthesize the appropriate context elements instead? > > If I understand your suggestion correctly, then no, that would mean > that Yehuda's original example: > > var frag = document.createDocumentFragment(); > frag.innerHTML = "<tr><td>hello</td></tr>" > someTable.appendChild(frag) > > would break - the frag would end up with a <table> and <tbody> inside, > which is wrong when you then try to insert it into an existing table. > > ~TJ >
Received on Friday, 4 November 2011 18:13:46 UTC