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); |
} |