| Index: Source/core/dom/Element.cpp
|
| diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
|
| index 0253525e3481a27a63fbedffb0bd68d3fdddb7af..1563af9a1beae961f203e482c01b42a5d6d5cbf7 100644
|
| --- a/Source/core/dom/Element.cpp
|
| +++ b/Source/core/dom/Element.cpp
|
| @@ -2277,12 +2277,12 @@ Node* Element::insertAdjacent(const String& where, Node* newChild, ExceptionStat
|
| static Element* contextElementForInsertion(const String& where, Element* element, ExceptionState& exceptionState)
|
| {
|
| if (equalIgnoringCase(where, "beforeBegin") || equalIgnoringCase(where, "afterEnd")) {
|
| - ContainerNode* parent = element->parentNode();
|
| - if (!parent || !parent->isElementNode()) {
|
| + Element* parent = element->parentElement();
|
| + if (!parent) {
|
| exceptionState.throwDOMException(NoModificationAllowedError, "The element has no parent.");
|
| return 0;
|
| }
|
| - return toElement(parent);
|
| + return parent;
|
| }
|
| if (equalIgnoringCase(where, "afterBegin") || equalIgnoringCase(where, "beforeEnd"))
|
| return element;
|
|
|