From 1a7ddf704af5e1cf148234d4f8e0765817847555 Mon Sep 17 00:00:00 2001 From: Mason Freed Date: Thu, 15 Apr 2021 13:31:06 -0700 Subject: [PATCH] Implement imperative slotting API changes The original implementation of the imperative slot distribution API was done before the final spec PRs landed. In the process of landing those PRs, several changes were made to the way the API works. Primarily, there are two changes: 1. The "auto" slotAssignment mode was renamed to "named". 2. The "linkage" that is created by HTMLSlotElement.assign() was made more permanent. Previously, moving either the or the assigned node around in the tree (or across documents) would "break" the linkage. Now, the linkage is more permanent, and the only way to break it is through another call to .assign(). See [1] for the chromestatus entry, [2] for the intent to ship, [3], [4], and [5] for the spec PRs, and [6]/[7] for the landed spec. [1] https://chromestatus.com/feature/4979822998585344 [2] https://groups.google.com/a/chromium.org/g/blink-dev/c/6U78F3KWJ78 [3] https://github.com/whatwg/html/pull/6561 [4] https://github.com/whatwg/html/pull/6585 [5] https://github.com/whatwg/dom/pull/966 [6] https://dom.spec.whatwg.org/#find-slotables [7] https://html.spec.whatwg.org/#dom-slot-assign Fixed: 1196842 Fixed: 1067153 Bug: 1067157 Change-Id: I0ee71043c23f3b49a1461296d722045f06eca540 --- ...ml => imperative-slot-api-slotchange.html} | 4 +- ...entative.html => imperative-slot-api.html} | 147 +++++++----------- 2 files changed, 60 insertions(+), 91 deletions(-) rename shadow-dom/{slots-imperative-api-slotchange.tentative.html => imperative-slot-api-slotchange.html} (98%) rename shadow-dom/{slots-imperative-slot-api.tentative.html => imperative-slot-api.html} (71%) diff --git a/shadow-dom/slots-imperative-api-slotchange.tentative.html b/shadow-dom/imperative-slot-api-slotchange.html similarity index 98% rename from shadow-dom/slots-imperative-api-slotchange.tentative.html rename to shadow-dom/imperative-slot-api-slotchange.html index 43627a246cce9d9..dd9ebbd3f849b32 100644 --- a/shadow-dom/slots-imperative-api-slotchange.tentative.html +++ b/shadow-dom/imperative-slot-api-slotchange.html @@ -107,7 +107,7 @@ let tTree = setupShadowDOM(test_slotchange, test, data); let [s1Promise, s2Promise] = monitorSlots(data); - assert_throws_dom('NotAllowedError', () => { tTree.s1.assign([tTree.c4]); }); + tTree.s1.assign([]);; tTree.s2.assign([]); tTree.host.insertBefore(tTree.c4, tTree.c1); @@ -135,7 +135,7 @@ [s1Promise] = monitorSlots(data); tTree.s1.assign([tTree.c1, tTree.c2]); - tTree.s1.assign([tTree.c2, tTree.c1, tTree.c1, tTree.c2, tTree.c2]); + tTree.s1.assign([tTree.c1, tTree.c2, tTree.c1, tTree.c2, tTree.c2]); s1Promise.then(test.step_func_done(() => { assert_equals(data.s1EventCount, 1); diff --git a/shadow-dom/slots-imperative-slot-api.tentative.html b/shadow-dom/imperative-slot-api.html similarity index 71% rename from shadow-dom/slots-imperative-slot-api.tentative.html rename to shadow-dom/imperative-slot-api.html index 2ffb08fba1b70e1..54b22632d11547f 100644 --- a/shadow-dom/slots-imperative-slot-api.tentative.html +++ b/shadow-dom/imperative-slot-api.html @@ -15,7 +15,7 @@ let tTree = createTestTree(test_basic); assert_not_equals(tTree.host1.attachShadow({ mode: 'open', slotAssignment: 'manual'}), null, 'slot assignment manual should work'); - assert_not_equals(tTree.host2.attachShadow({ mode: 'open', slotAssignment: 'name'}), + assert_not_equals(tTree.host2.attachShadow({ mode: 'open', slotAssignment: 'named'}), null, 'slot assignment auto should work'); assert_throws_js(TypeError, () => { tTree.host3.attachShadow({ mode: 'open', slotAssignment: 'exceptional' })}, @@ -23,39 +23,6 @@ }, 'attachShadow can take slotAssignment parameter.'); -
-
- -
-
-
- -
-
-
- -