Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(803)

Unified Diff: Source/core/html/HTMLElement.cpp

Issue 110383002: Throw DOM exception in insertAdjacentHTML if context becomes null (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/dynamic/insertAdjacentHTML-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLElement.cpp
diff --git a/Source/core/html/HTMLElement.cpp b/Source/core/html/HTMLElement.cpp
index c6115081340bd23f6d8d2fba5c9d51ffbf559a04..c9ca7578d6139d4713b362a2e3173ef70d5b5b25 100644
--- a/Source/core/html/HTMLElement.cpp
+++ b/Source/core/html/HTMLElement.cpp
@@ -506,12 +506,12 @@ Element* HTMLElement::insertAdjacentElement(const String& where, Element* newChi
return toElement(returnValue);
}
-// Step 3 of http://www.whatwg.org/specs/web-apps/current-work/multipage/apis-in-html-documents.html#insertadjacenthtml()
+// Step 1 of http://domparsing.spec.whatwg.org/#insertadjacenthtml()
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()) {
+ if (!parent || !parent->isElementNode()) {
exceptionState.throwDOMException(NoModificationAllowedError, "The element has no parent.");
return 0;
}
« no previous file with comments | « LayoutTests/fast/dynamic/insertAdjacentHTML-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698