-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cover changing content targetting :has-slotted and :has-slotted(...) (#…
…48317) * Cover changing content targetting :has-slotted and :has-slotted(...) * Diversify DOM interactions * Lint * Make test file "tentative" * Include missing `.shadowRoot`s * Split out functional :has-slotted() from non-functional :has-slotted * Correc titles and :has-slotted(div + div) test
- Loading branch information
Showing
26 changed files
with
579 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
<!doctype html> | ||
<meta charset="utf-8"> | ||
<title>:has-slotted(...) negative test: no children, but whitespace present</title> | ||
<title>:has-slotted</title> | ||
<link rel="help" href="https://github.com/w3c/csswg-drafts/pull/10586"> | ||
<link rel="match" href="/css/reference/ref-filled-green-100px-square-only.html"> | ||
<p>Test passes if there is a filled green square.</p> | ||
<div id="host"> | ||
<template shadowrootmode="open"> | ||
<style> | ||
<style> | ||
slot { | ||
display: block; | ||
width: 100px; | ||
height: 100px; | ||
background-color: green; | ||
display: block; | ||
width: 100px; | ||
height: 100px; | ||
background-color: red; | ||
} | ||
:has-slotted(*) { | ||
background-color: red; | ||
:has-slotted { | ||
background-color: green; | ||
} | ||
</style> | ||
<slot></slot> | ||
</style> | ||
<slot></slot> | ||
</template> | ||
<div></div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>Changing content targetting :has-slotted through a single shadow root</title> | ||
<link rel="help" href="https://github.com/w3c/csswg-drafts/pull/10586"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
<script src="/resources/testdriver-actions.js"></script> | ||
</head> | ||
|
||
<body> | ||
|
||
<div id="test"><template shadowrootmode="open"> | ||
<slot></slot> | ||
<p id="target">This text will be styled.</p> | ||
<style> | ||
p { | ||
color: rgb(0 255 0); | ||
} | ||
slot:not(:has-slotted) + p { | ||
color: rgb(0 0 255); | ||
} | ||
</style> | ||
</template></div> | ||
|
||
<script> | ||
const blue = 'rgb(0, 0, 255)'; | ||
const green = 'rgb(0, 255, 0)'; | ||
test(function () { | ||
const test = document.getElementById('test'); | ||
const target = test.shadowRoot.getElementById('target'); | ||
let styles = getComputedStyle(target); | ||
assert_equals(styles.getPropertyValue('color'), green); | ||
test.innerHTML = ' '; | ||
styles = getComputedStyle(target); | ||
assert_equals(styles.getPropertyValue('color'), blue); | ||
test.replaceChildren();; | ||
styles = getComputedStyle(target); | ||
assert_equals(styles.getPropertyValue('color'), green); | ||
const div = document.createElement('div'); | ||
test.append(div); | ||
styles = getComputedStyle(target); | ||
assert_equals(styles.getPropertyValue('color'), blue); | ||
const node = document.createTextNode(' '); | ||
test.replaceChildren(node); | ||
styles = getComputedStyle(target); | ||
assert_equals(styles.getPropertyValue('color'), blue); | ||
test.innerHTML = ''; | ||
styles = getComputedStyle(target); | ||
assert_equals(styles.getPropertyValue('color'), green); | ||
}, name); | ||
</script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>Changing content targetting :has-slotted through multiple shadow roots</title> | ||
<link rel="help" href="https://github.com/w3c/csswg-drafts/pull/10586"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
<script src="/resources/testdriver-actions.js"></script> | ||
</head> | ||
|
||
<body> | ||
|
||
<div id="test"><template shadowrootmode="open"><div id="inner"><template shadowrootmode="open"> | ||
<slot></slot> | ||
<p id="target">This text will be styled.</p> | ||
<style> | ||
p { | ||
color: rgb(0 255 0); | ||
} | ||
slot:not(:has-slotted) + p { | ||
color: rgb(0 0 255); | ||
} | ||
</style> | ||
</template><slot></slot></div></template></div> | ||
|
||
|
||
<script> | ||
const blue = 'rgb(0, 0, 255)'; | ||
const green = 'rgb(0, 255, 0)'; | ||
test(function () { | ||
const test = document.getElementById('test'); | ||
const inner = test.shadowRoot.getElementById('inner'); | ||
const target = inner.shadowRoot.getElementById('target'); | ||
let styles = getComputedStyle(target); | ||
assert_equals(styles.getPropertyValue('color'), green); | ||
const node = document.createTextNode(' '); | ||
test.replaceChildren(node); | ||
styles = getComputedStyle(target); | ||
assert_equals(styles.getPropertyValue('color'), blue); | ||
node.remove(); | ||
styles = getComputedStyle(target); | ||
assert_equals(styles.getPropertyValue('color'), green); | ||
test.innerHTML = '<div></div>'; | ||
styles = getComputedStyle(target); | ||
assert_equals(styles.getPropertyValue('color'), blue); | ||
test.appendChild(node); | ||
styles = getComputedStyle(target); | ||
assert_equals(styles.getPropertyValue('color'), blue); | ||
test.textContent = ''; | ||
styles = getComputedStyle(target); | ||
assert_equals(styles.getPropertyValue('color'), green); | ||
}, name); | ||
</script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,24 @@ | ||
<!doctype html> | ||
<meta charset="utf-8"> | ||
<title>:has-slotted(*) flattened through multiple slots</title> | ||
<title>:has-slotted flattened through multiple slots</title> | ||
<link rel="help" href="https://github.com/w3c/csswg-drafts/pull/10586"> | ||
<link rel="match" href="/css/reference/ref-filled-green-100px-square-only.html"> | ||
<p>Test passes if there is a filled green square.</p> | ||
<div id="ancestor"> | ||
<template shadowrootmode="open"> | ||
<div id="host"> | ||
<template shadowrootmode="open"> | ||
<style> | ||
slot { | ||
display: block; | ||
width: 100px; | ||
height: 100px; | ||
background-color: red; | ||
} | ||
:has-slotted(*) { | ||
background-color: green; | ||
} | ||
</style> | ||
<slot></slot> | ||
</template> | ||
<div id="host"><template shadowrootmode="open"> | ||
<style> | ||
slot { | ||
display: block; | ||
width: 100px; | ||
height: 100px; | ||
background-color: red; | ||
} | ||
:has-slotted { | ||
background-color: green; | ||
} | ||
</style> | ||
<slot></slot> | ||
</div> | ||
</template><slot></slot></div> | ||
</template> | ||
<div></div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,25 @@ | ||
<!doctype html> | ||
<meta charset="utf-8"> | ||
<title>:has-slotted(...) flattened through multiple slots, negative test: no children, but whitespace present</title> | ||
<title>:has-slotted flattened through multiple slots</title> | ||
<link rel="help" href="https://github.com/w3c/csswg-drafts/pull/10586"> | ||
<link rel="match" href="/css/reference/ref-filled-green-100px-square-only.html"> | ||
<p>Test passes if there is a filled green square.</p> | ||
<div id="ancestor"> | ||
<template shadowrootmode="open"> | ||
<div id="host"> | ||
<template shadowrootmode="open"> | ||
<style> | ||
slot { | ||
display: block; | ||
width: 100px; | ||
height: 100px; | ||
background-color: green; | ||
} | ||
:has-slotted(*) { | ||
background-color: red; | ||
} | ||
</style> | ||
<slot></slot> | ||
</template> | ||
</div> | ||
<slot></slot> | ||
<div id="host"><template shadowrootmode="open"> | ||
<style> | ||
slot { | ||
display: block; | ||
width: 100px; | ||
height: 100px; | ||
background-color: red; | ||
} | ||
:has-slotted { | ||
background-color: green; | ||
} | ||
</style> | ||
<slot></slot> | ||
</template><slot></slot></div> | ||
</template> | ||
<div></div> | ||
</div> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!doctype html> | ||
<meta charset="utf-8"> | ||
<title>:has-slotted(...) negative test: no children or white space</title> | ||
<link rel="help" href="https://github.com/w3c/csswg-drafts/pull/10586"> | ||
<link rel="match" href="/css/reference/ref-filled-green-100px-square-only.html"> | ||
<p>Test passes if there is a filled green square.</p> | ||
<div id="host"><template shadowrootmode="open"> | ||
<style> | ||
slot { | ||
display: block; | ||
width: 100px; | ||
height: 100px; | ||
background-color: green; | ||
} | ||
:has-slotted(*) { | ||
background-color: red; | ||
} | ||
</style> | ||
<slot></slot> | ||
</template></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!doctype html> | ||
<meta charset="utf-8"> | ||
<title>:has-slotted(...) negative test: no children, but whitespace present</title> | ||
<link rel="help" href="https://github.com/w3c/csswg-drafts/pull/10586"> | ||
<link rel="match" href="/css/reference/ref-filled-green-100px-square-only.html"> | ||
<p>Test passes if there is a filled green square.</p> | ||
<div id="host"> | ||
<template shadowrootmode="open"> | ||
<style> | ||
slot { | ||
display: block; | ||
width: 100px; | ||
height: 100px; | ||
background-color: green; | ||
} | ||
:has-slotted(*) { | ||
background-color: red; | ||
} | ||
</style> | ||
<slot></slot> | ||
</template> | ||
</div> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.