зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1494918 - FlattenAssignedNodes should check that slots are in shadow root , r=edgar
--HG-- extra : rebase_source : eeb5049f916b7a417c102a32c86637c7ac5bcf36
This commit is contained in:
Родитель
70744c3261
Коммит
774f1c7600
|
@ -143,7 +143,8 @@ FlattenAssignedNodes(HTMLSlotElement* aSlot, nsTArray<RefPtr<nsINode>>& aNodes)
|
|||
}
|
||||
|
||||
for (const RefPtr<nsINode>& assignedNode : assignedNodes) {
|
||||
if (auto* slot = HTMLSlotElement::FromNode(assignedNode)) {
|
||||
auto* slot = HTMLSlotElement::FromNode(assignedNode);
|
||||
if (slot && slot->GetContainingShadow()) {
|
||||
FlattenAssignedNodes(slot, aNodes);
|
||||
} else {
|
||||
aNodes.AppendElement(assignedNode);
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
[slots-fallback-in-document.html]
|
||||
[Children of a slot in a document tree should not be counted in flattened assigned nodes.]
|
||||
expected: FAIL
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title></title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id="host1"><slot>foo</slot></div>
|
||||
<script>
|
||||
|
||||
test(() => {
|
||||
var host1 = document.getElementById("host1");
|
||||
var sr = host1.attachShadow({mode: "open"});
|
||||
sr.innerHTML = "<slot></slot>";
|
||||
assert_array_equals(sr.firstChild.assignedNodes({ flatten: true }), [host1.firstChild]);
|
||||
}, "Light DOM slot element should be in flattened assignedNodes");
|
||||
|
||||
</script>
|
Загрузка…
Ссылка в новой задаче