Update HTML parser's foster-parenting algorithm to match the current spec
The spec used to disallow DocumentFragments as foster parents, but this
restriction was removed when <template> was added. This patch rewrites
Blink's parser to mirror the current spec language, in the process fixing
the attached bug (the added html5lib test is a regression test for
Note, however, that this change causes us to fail the test for a different
DocumentFragment case, which was added in http://trac.webkit.org/changeset/124465
back when the spec used to require the foster parent to be an element. I've
updated the test expectations to match the new behavior.
The new behavior, while it matches the spec, is no longer compatible with
Firefox (the only other browser I tested). However, it seems unlikely that
this case comes up much in practice, since it requires reparenting elements
into a fragment while the parser is running.