[HTMLTemplateElement] <template> inside of <head> may not create <body> if EOF is hit
authorrafaelw@chromium.org <rafaelw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Feb 2013 17:05:48 +0000 (17:05 +0000)
committerrafaelw@chromium.org <rafaelw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Feb 2013 17:05:48 +0000 (17:05 +0000)
commita301929630127bb18451723e400801ed70b8a943
treeb9fb957b5d93cad32816d37b3ac67dbfa72a49d5
parent8ba091e2772b61f44202207fe6ae46f42a763119
[HTMLTemplateElement] <template> inside of <head> may not create <body> if EOF is hit
https://bugs.webkit.org/show_bug.cgi?id=109338

Reviewed by Adam Barth.

Source/WebCore:

This patch adds the logic to clear the stack of open elements back to the first <template> when EOF
is hit. This allows a <body> to be generated if the initial <template> was opened inside of <head>.

Tests added to html5lib.

* html/parser/HTMLTreeBuilder.cpp:
(WebCore):
(WebCore::HTMLTreeBuilder::popAllTemplates):
(WebCore::HTMLTreeBuilder::processEndTag):
(WebCore::HTMLTreeBuilder::processEndOfFile):
* html/parser/HTMLTreeBuilder.h:
(HTMLTreeBuilder):

LayoutTests:

* html5lib/resources/template.dat:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@142635 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/html5lib/resources/template.dat
Source/WebCore/ChangeLog
Source/WebCore/html/parser/HTMLTreeBuilder.cpp
Source/WebCore/html/parser/HTMLTreeBuilder.h