On Fri, May 11, 2012 at 7:13 AM, Henri Sivonen <hsivonen@iki.fi> wrote:
> However, I'm not strongly opposed to adding innerHTML to
> DocumentFragment if we also add a method on Document that parses a
> string using the HTML parser regardless of the HTMLness flag of the
> document and returns a DocumentFragment (or has an optional extra
> argument for forcing XML parsing explicitly).
>
Just a side note, but at least parsing XML seems to be fairly sane today. I
haven't really done any testing around this, but it seems like this would
get you parsing of arbitrary XML fragments, including leading and trailing
text nodes:
(new DOMParser).parseFromString( "<x>" + string + "</x>", "text/xml"
).documentElement.childNodes
Obviously this is overly verbose compared to document.parse( string, flag ).