Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Unified Diff: Source/core/html/parser/HTMLTreeBuilder.cpp

Issue 25900003: Hoist <template> in <head> if encountered in AfterHead insertion mode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/html5lib/resources/template.dat ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/parser/HTMLTreeBuilder.cpp
diff --git a/Source/core/html/parser/HTMLTreeBuilder.cpp b/Source/core/html/parser/HTMLTreeBuilder.cpp
index 1b10586f0f4654d28ef4dcd429a5a80502086531..1ba32e41127253bb20d7843035912d8b511573f3 100644
--- a/Source/core/html/parser/HTMLTreeBuilder.cpp
+++ b/Source/core/html/parser/HTMLTreeBuilder.cpp
@@ -1144,6 +1144,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken* token)
|| token->name() == noframesTag
|| token->name() == scriptTag
|| token->name() == styleTag
+ || token->name() == templateTag
|| token->name() == titleTag) {
parseError(token);
ASSERT(m_tree.head());
@@ -1604,9 +1605,9 @@ void HTMLTreeBuilder::resetInsertionModeAppropriately()
while (1) {
RefPtr<HTMLStackItem> item = nodeRecord->stackItem();
if (item->node() == m_tree.openElements()->rootNode()) {
- ASSERT(isParsingFragment());
adamk 2013/10/03 21:51:37 So this ASSERT was completely wrong before? Doesn'
rafaelw 2013/10/03 21:55:34 No, it wasn't wrong before. It's just the case tha
last = true;
- item = HTMLStackItem::create(m_fragmentContext.contextElement(), HTMLStackItem::ItemForContextElement);
+ if (isParsingFragment())
+ item = HTMLStackItem::create(m_fragmentContext.contextElement(), HTMLStackItem::ItemForContextElement);
}
if (item->hasTagName(templateTag))
return setInsertionMode(m_templateInsertionModes.last());
@@ -1645,6 +1646,9 @@ void HTMLTreeBuilder::resetInsertionModeAppropriately()
return setInsertionMode(InFramesetMode);
}
if (isHTMLHtmlElement(item->node())) {
+ if (m_tree.headStackItem())
adamk 2013/10/03 21:51:37 Again, this change doesn't look specific to <templ
rafaelw 2013/10/03 21:55:34 This is what will happen in the case of <head></he
+ return setInsertionMode(AfterHeadMode);
+
ASSERT(isParsingFragment());
return setInsertionMode(BeforeHeadMode);
}
« no previous file with comments | « LayoutTests/html5lib/resources/template.dat ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698