-
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.
Speculativly test :has-slotted() (#47587)
* Speculativly test :has-slotted(), see: w3c/csswg-drafts#10586 * Speculatively test :has-slotted() flattened through multiple slot elements * Lint
- Loading branch information
Showing
15 changed files
with
380 additions
and
0 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
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> |
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,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> |
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> |
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,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> |
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,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> |
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,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> |
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</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> |
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,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> |
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,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> |
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,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> |
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,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> |
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,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> |
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,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> |
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,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> |
Oops, something went wrong.