Index: third_party/WebKit/LayoutTests/imported/wpt/custom-elements/reactions/Document.html |
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/custom-elements/reactions/Document.html b/third_party/WebKit/LayoutTests/imported/wpt/custom-elements/reactions/Document.html |
index 304ec9861454852a6b7f155bb4c7beb84da89fb2..13f0d81b9eac44cf1026c8b63ce215f0404b55db 100644 |
--- a/third_party/WebKit/LayoutTests/imported/wpt/custom-elements/reactions/Document.html |
+++ b/third_party/WebKit/LayoutTests/imported/wpt/custom-elements/reactions/Document.html |
@@ -1,10 +1,11 @@ |
<!DOCTYPE html> |
<html> |
<head> |
-<title>Custom Elements: CEReactions on ParentNode interface</title> |
+<title>Custom Elements: CEReactions on Document interface</title> |
<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org"> |
<meta name="assert" content="importNode and adoptNode of Document interface must have CEReactions"> |
<meta name="help" content="https://dom.spec.whatwg.org/#document"> |
+<meta name="help" content="https://html.spec.whatwg.org/#document"> |
<script src="/resources/testharness.js"></script> |
<script src="/resources/testharnessreport.js"></script> |
<script src="../resources/custom-elements-helpers.js"></script> |
@@ -22,11 +23,17 @@ test(function () { |
var newDoc = document.implementation.createHTMLDocument(); |
newDoc.importNode(instance); |
- var logEntries = element.takeLog(); |
- assert_array_equals(logEntries.types(), ['constructed']); |
- assert_equals(logEntries.last().oldDocument, document); |
- assert_equals(logEntries.last().newDocument, newDoc); |
-}, 'importNode on Document must construct a new custom element when importing a custom element'); |
+ assert_array_equals(element.takeLog().types(), []); |
+}, 'importNode on Document must not construct a new custom element when importing a custom element into a window-less document'); |
+ |
+test(function () { |
+ var element = define_new_custom_element(); |
+ var template = document.createElement('template'); |
+ template.innerHTML = `<${element.name}></${element.name}>`; |
+ assert_array_equals(element.takeLog().types(), []); |
+ document.importNode(template.content, true); |
+ assert_array_equals(element.takeLog().types(), ['constructed']); |
+}, 'importNode on Document must construct a new custom element when importing a custom element from a template'); |
test(function () { |
var element = define_new_custom_element(); |
@@ -42,6 +49,23 @@ test(function () { |
assert_equals(logEntries.last().newDocument, newDoc); |
}, 'adoptNode on Document must enqueue an adopted reaction when importing a custom element'); |
+test(function () { |
+ var element = define_new_custom_element(); |
+ var instance = document.createElement(element.name); |
+ |
+ var container = document.createElement('div'); |
+ container.contentEditable = true; |
+ container.appendChild(instance); |
+ document.body.appendChild(container); |
+ |
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']); |
+ |
+ container.focus(); |
+ document.execCommand('delete', false, null); |
+ |
+ assert_array_equals(element.takeLog().types(), ['disconnected']); |
+}, 'execCommand on Document must enqueue a disconnected reaction when deleting a custom element from a contenteditable element'); |
+ |
</script> |
</body> |
</html> |