Index: third_party/WebKit/Source/core/dom/Range.cpp |
diff --git a/third_party/WebKit/Source/core/dom/Range.cpp b/third_party/WebKit/Source/core/dom/Range.cpp |
index 67305ca845e14dbc2158b87095a59debea84cda7..57aa306557bd686de6e6c0a73f0040cdaa89915c 100644 |
--- a/third_party/WebKit/Source/core/dom/Range.cpp |
+++ b/third_party/WebKit/Source/core/dom/Range.cpp |
@@ -884,29 +884,20 @@ DocumentFragment* Range::createContextualFragment(const String& markup, Exceptio |
if (!element || isHTMLHtmlElement(element)) { |
Document& document = node->document(); |
- if (document.isHTMLDocument() || document.isXHTMLDocument()) { |
+ if (document.isSVGDocument()) { |
+ element = document.documentElement(); |
+ if (!element) |
+ element = SVGSVGElement::create(document); |
+ } else { |
// Optimization over spec: try to reuse the existing <body> element, if it is available. |
element = document.body(); |
if (!element) |
element = HTMLBodyElement::create(document); |
- } else if (document.isSVGDocument()) { |
- element = document.documentElement(); |
- if (!element) |
- element = SVGSVGElement::create(document); |
} |
} |
- if (!element || (!element->isHTMLElement() && !element->isSVGElement())) { |
- exceptionState.throwDOMException(NotSupportedError, "The range's container must be an HTML or SVG Element, Document, or DocumentFragment."); |
- return nullptr; |
- } |
- |
// Steps 3, 4, 5. |
- DocumentFragment* fragment = blink::createContextualFragment(markup, element, AllowScriptingContentAndDoNotMarkAlreadyStarted, exceptionState); |
- if (!fragment) |
- return nullptr; |
- |
- return fragment; |
+ return blink::createContextualFragment(markup, element, AllowScriptingContentAndDoNotMarkAlreadyStarted, exceptionState); |
} |