Index: Source/core/dom/StyleElement.cpp |
diff --git a/Source/core/dom/StyleElement.cpp b/Source/core/dom/StyleElement.cpp |
index 112e68c90e6f22b6d5112573090019d7d3cc1a94..dcc88555d4f28e4e233132973b7081c44a20dd8d 100644 |
--- a/Source/core/dom/StyleElement.cpp |
+++ b/Source/core/dom/StyleElement.cpp |
@@ -114,10 +114,9 @@ void StyleElement::clearDocumentData(Document& document, Element* element) |
if (m_sheet) |
m_sheet->clearOwnerNode(); |
- if (element->inDocument()) { |
- // HTMLLinkElement in shadow tree is not supported. |
- TreeScope& treeScope = isHTMLStyleElement(element) || isSVGStyleElement(element) ? element->treeScope() : element->document(); |
- document.styleEngine().removeStyleSheetCandidateNode(element, treeScope); |
+ if (m_registeredAsCandidate) { |
+ ASSERT(element->inDocument()); |
+ document.styleEngine().removeStyleSheetCandidateNode(element, element->treeScope()); |
} |
} |