Skip to content

Commit

Permalink
Speculativly test :has-slotted() (#47587)
Browse files Browse the repository at this point in the history
* Speculativly test :has-slotted(), see: w3c/csswg-drafts#10586

* Speculatively test :has-slotted() flattened through multiple slot elements

* Lint
  • Loading branch information
Westbrook authored Sep 23, 2024
1 parent 64995b3 commit 43f3ba0
Show file tree
Hide file tree
Showing 15 changed files with 380 additions and 0 deletions.
23 changes: 23 additions & 0 deletions css/css-scoping/has-slotted-001.tentative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!doctype html>
<meta charset="utf-8">
<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>
slot {
display: block;
width: 100px;
height: 100px;
background-color: red;
}
:has-slotted(*) {
background-color: green;
}
</style>
<slot></slot>
</template>
<div></div>
</div>
21 changes: 21 additions & 0 deletions css/css-scoping/has-slotted-002.tentative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!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(*),
:has-slotted {
background-color: red;
}
</style>
<slot></slot>
</template></div>
22 changes: 22 additions & 0 deletions css/css-scoping/has-slotted-003.tentative.html
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>
23 changes: 23 additions & 0 deletions css/css-scoping/has-slotted-004.tentative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!doctype html>
<meta charset="utf-8">
<title>:has-slotted(.class)</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: red;
}
:has-slotted(.slotted-element) {
background-color: green;
}
</style>
<slot></slot>
</template>
<div class="slotted-element"></div>
</div>
23 changes: 23 additions & 0 deletions css/css-scoping/has-slotted-005.tentative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!doctype html>
<meta charset="utf-8">
<title>:has-slotted(.class) negative test</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(.not-slotted-element) {
background-color: red;
}
</style>
<slot></slot>
</template>
<div class="slotted-element"></div>
</div>
25 changes: 25 additions & 0 deletions css/css-scoping/has-slotted-006.tentative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!doctype html>
<meta charset="utf-8">
<title>:has-slotted(el) + :has-slotted(el)</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>
[name] {
display: block;
width: 100px;
height: 100px;
background-color: red;
}
:has-slotted(div) + :has-slotted(div) {
background-color: green;
}
</style>
<slot></slot>
<slot name="after"></slot>
</template>
<div></div>
<div slot="after"></div>
</div>
22 changes: 22 additions & 0 deletions css/css-scoping/has-slotted-007.tentative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!doctype html>
<meta charset="utf-8">
<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>
slot {
display: block;
width: 100px;
height: 100px;
background-color: red;
}
:has-slotted {
background-color: green;
}
</style>
<slot></slot>
</template>
</div>
28 changes: 28 additions & 0 deletions css/css-scoping/has-slotted-flattened-001.tentative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!doctype html>
<meta charset="utf-8">
<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>
<slot></slot>
</div>
</template>
<div></div>
</div>
23 changes: 23 additions & 0 deletions css/css-scoping/has-slotted-flattened-002.tentative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!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="ancestor"><template shadowrootmode="open">
<div id="host"><template shadowrootmode="open">
<style>
slot {
display: block;
width: 100px;
height: 100px;
background-color: green;
}
:has-slotted(*),
:has-slotted {
background-color: red;
}
</style>
<slot></slot>
</template><slot></slot></div>
</template></div>
27 changes: 27 additions & 0 deletions css/css-scoping/has-slotted-flattened-003.tentative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!doctype html>
<meta charset="utf-8">
<title>:has-slotted(...) flattened through multiple slots, 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="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>
</template>
</div>
28 changes: 28 additions & 0 deletions css/css-scoping/has-slotted-flattened-004.tentative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!doctype html>
<meta charset="utf-8">
<title>:has-slotted(.class) 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(.slotted-element) {
background-color: green;
}
</style>
<slot></slot>
</template>
<slot></slot>
</div>
</template>
<div class="slotted-element"></div>
</div>
28 changes: 28 additions & 0 deletions css/css-scoping/has-slotted-flattened-005.tentative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!doctype html>
<meta charset="utf-8">
<title>:has-slotted(.class) flattened through multiple slots, negative test</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(.not-slotted-element) {
background-color: red;
}
</style>
<slot></slot>
</template>
<slot></slot>
</div>
</template>
<div class="slotted-element"></div>
</div>
31 changes: 31 additions & 0 deletions css/css-scoping/has-slotted-flattened-006.tentative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!doctype html>
<meta charset="utf-8">
<title>:has-slotted(el) + :has-slotted(el) 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>
[name] {
display: block;
width: 100px;
height: 100px;
background-color: red;
}
:has-slotted(div) + :has-slotted(div) {
background-color: green;
}
</style>
<slot></slot>
<slot name="after"></slot>
</template>
<slot></slot>
<slot name="after" slot="after"></slot>
</div>
</template>
<div></div>
<div slot="after"></div>
</div>
24 changes: 24 additions & 0 deletions css/css-scoping/has-slotted-flattened-007.tentative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!doctype html>
<meta charset="utf-8">
<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><slot></slot></div>
</template>
</div>
Loading

0 comments on commit 43f3ba0

Please sign in to comment.