Skip to content

Commit d463c2e

Browse files
mfreed7marcoscaceres
authored andcommitted
Check for matching serializable in attachShadow
This parameter was added ([1]) after the initial check code was written ([3]). Note that [2] also added `clonable` but there's an issue [4] about checking that in a similar way. [1] https://chromium-review.googlesource.com/c/chromium/src/+/5239221 [2] https://chromium-review.googlesource.com/c/chromium/src/+/5239277 [3] https://chromium-review.googlesource.com/c/chromium/src/+/5191750 [4] whatwg/html#10107 Bug: 1517959 Change-Id: I689c6a6f84fb7ce298cf187076ae228fef6cc348 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5242281 Commit-Queue: David Baron <[email protected]> Reviewed-by: David Baron <[email protected]> Auto-Submit: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1253972}
1 parent aafd154 commit d463c2e

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

shadow-dom/declarative/declarative-shadow-dom-repeats.html

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,30 @@
5050

5151
<div id=open2>
5252
<template shadowrootmode=open shadowrootdelegatesfocus>
53-
Open, delegates focus (not the default), named slot assignment (the default)
53+
Open, delegates focus (not the default),
54+
named slot assignment (the default), clonable (the default for declarative)
5455
</template>
5556
</div>
5657

5758
<script>
5859
test((t) => {
5960
assert_throws_dom("NotSupportedError",() => {
60-
open2.attachShadow({mode: "closed", delegatesFocus: true, slotAssignment: "named"});
61+
open2.attachShadow({mode: "closed", delegatesFocus: true, slotAssignment: "named", clonable: true});
6162
},'Mismatched shadow root type should throw');
6263
assert_throws_dom("NotSupportedError",() => {
63-
open2.attachShadow({mode: "open", delegatesFocus: false, slotAssignment: "named"});
64+
open2.attachShadow({mode: "open", delegatesFocus: false, slotAssignment: "named", clonable: true});
6465
},'Mismatched shadow root delegatesFocus should throw');
6566
assert_throws_dom("NotSupportedError",() => {
66-
open2.attachShadow({mode: "open", delegatesFocus: true, slotAssignment: "manual"});
67+
open2.attachShadow({mode: "open", delegatesFocus: true, slotAssignment: "manual", clonable: true});
6768
},'Mismatched shadow root slotAssignment should throw');
69+
// See https://github.com/whatwg/html/issues/10107: the behavior of the
70+
// clonable flag is still being discussed.
71+
// assert_throws_dom("NotSupportedError",() => {
72+
// open2.attachShadow({mode: "open", delegatesFocus: true, slotAssignment: "named", clonable: false});
73+
// },'Mismatched shadow root clonable should throw');
74+
6875
const initialShadow = open2.shadowRoot;
69-
const shadow = open2.attachShadow({mode: "open", delegatesFocus: true, slotAssignment: "named"}); // Shouldn't throw
76+
const shadow = open2.attachShadow({mode: "open", delegatesFocus: true, slotAssignment: "named", clonable: true}); // Shouldn't throw
7077
assert_equals(shadow,initialShadow,'Same shadow should be returned');
7178
assert_equals(shadow.textContent,'','Shadow should be empty');
7279
},'Calling attachShadow() on declarative shadow root must match all parameters');

0 commit comments

Comments
 (0)