| Index: Source/core/editing/markup.cpp
|
| diff --git a/Source/core/editing/markup.cpp b/Source/core/editing/markup.cpp
|
| index 46f385064a3f25674486fa4e5a07c5b191d3012a..c0591bf59aac0ab0ea692a30b036b6202e5bcfa7 100644
|
| --- a/Source/core/editing/markup.cpp
|
| +++ b/Source/core/editing/markup.cpp
|
| @@ -976,11 +976,23 @@ static inline void removeElementPreservingChildren(PassRefPtrWillBeRawPtr<Docume
|
| fragment->removeChild(element);
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<DocumentFragment> createContextualFragment(const String& markup, HTMLElement* element, ParserContentPolicy parserContentPolicy, ExceptionState& exceptionState)
|
| +static inline bool isSupportedContainer(Element* element)
|
| {
|
| ASSERT(element);
|
| - if (element->ieForbidsInsertHTML() || element->hasLocalName(colTag) || element->hasLocalName(colgroupTag) || element->hasLocalName(framesetTag)
|
| + if (!element->isHTMLElement())
|
| + return true;
|
| +
|
| + if (element->hasLocalName(colTag) || element->hasLocalName(colgroupTag) || element->hasLocalName(framesetTag)
|
| || element->hasLocalName(headTag) || element->hasLocalName(styleTag) || element->hasLocalName(titleTag)) {
|
| + return false;
|
| + }
|
| + return !toHTMLElement(element)->ieForbidsInsertHTML();
|
| +}
|
| +
|
| +PassRefPtrWillBeRawPtr<DocumentFragment> createContextualFragment(const String& markup, Element* element, ParserContentPolicy parserContentPolicy, ExceptionState& exceptionState)
|
| +{
|
| + ASSERT(element);
|
| + if (!isSupportedContainer(element)) {
|
| exceptionState.throwDOMException(NotSupportedError, "The range's container is '" + element->localName() + "', which is not supported.");
|
| return nullptr;
|
| }
|
|
|