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

Unified Diff: third_party/WebKit/LayoutTests/custom-elements/spec/adopt-node.html

Issue 2247663002: CustomElements: adoptedCallback should be invoked in tree order (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/custom-elements/spec/adopt-node.html
diff --git a/third_party/WebKit/LayoutTests/custom-elements/spec/adopt-node.html b/third_party/WebKit/LayoutTests/custom-elements/spec/adopt-node.html
index 4ef1a138d1a401b35d5f9f768799d23848f05f62..023fb83dad6daf52b8bc55d9b3a380f82f3015a7 100644
--- a/third_party/WebKit/LayoutTests/custom-elements/spec/adopt-node.html
+++ b/third_party/WebKit/LayoutTests/custom-elements/spec/adopt-node.html
@@ -8,7 +8,7 @@
<script>
'use strict'
-// 3.2 For each inclusiveDescendant in node’s shadow-including inclusive descendants that is a custom
+// 3.2 For each inclusiveDescendant in node’s shadow-including inclusive descendants that is a custom
// element, enqueue a custom element callback reaction with inclusiveDescendant,
// callback name "adoptedCallback", and an empty argument list.
promise_test((t) => {
@@ -26,5 +26,32 @@ promise_test((t) => {
assert_array_equals_callback_invocations(invocations, [ ['adopted', a, []] ]);
});
}, 'adopting a custom element to the different document should enqueue an adoptedCallback reaction');
+
+// 3.3 For each inclusiveDescendant in node’s shadow-including inclusive descendants, in
+// shadow-including tree order, run the adopting steps with inclusiveDescendant and oldDocument.
+promise_test((t) => {
+ return Promise.all([
+ create_window_in_test(t),
+ create_window_in_test(t)])
+ .then(([w1, w2]) => {
+ w1.document.body.innerHTML = `
+ <a-a id="a">
+ <p>
+ <a-a id="b"></a-a>
+ <a-a id="c"></a-a>
+ </p>
+ <a-a id="d"></a-a>
+ </a-a>`;
+ let invocations = [];
+ class X extends w1.HTMLElement {
+ adoptedCallback() { invocations.push(this); }
+ }
+ w1.customElements.define('a-a', X);
+ let a = w1.document.getElementById("a");
+ w2.document.adoptNode(a);
+ assert_array_equals(['a', 'b', 'c', 'd'], invocations.map((e) => e.id),
+ 'four elements should have been removed in doc order');
+ });
+}, 'shadow-including inclusive descendants should be adopted in shadow-including tree order');
</script>
</body>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698