-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This should work per spec, see w3c/csswg-drafts#9509. Tweak a bit the selector flags set up so that checking for :host selectors during CascadeData rebuilds is cheap. Differential Revision: https://phabricator.services.mozilla.com/D191570 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1850974 gecko-commit: 8b16994e8df5ba96e720e00a4f0289fdb3a83708 gecko-reviewers: zrhoffman
- Loading branch information
1 parent
910f2ed
commit 8c1c9d5
Showing
10 changed files
with
230 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>:host and nesting (basic) </title> | ||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> | ||
<link rel="author" title="Mozilla" href="https://mozilla.org"> | ||
<link rel="help" href="https://drafts.csswg.org/css-nesting/#nest-selector"> | ||
<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"></div> | ||
<script> | ||
host.attachShadow({mode: "open"}).innerHTML = ` | ||
<style> | ||
:host { | ||
.nested { | ||
width: 100px; | ||
height: 100px; | ||
background-color: green; | ||
} | ||
} | ||
</style> | ||
<div class="nested"></div> | ||
`; | ||
</script> |
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>:host and nesting (bare declarations)</title> | ||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> | ||
<link rel="author" title="Mozilla" href="https://mozilla.org"> | ||
<link rel="help" href="https://drafts.csswg.org/css-nesting/#nest-selector"> | ||
<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"></div> | ||
<script> | ||
host.attachShadow({mode: "open"}).innerHTML = ` | ||
<style> | ||
:host { | ||
@media (width >= 0) { | ||
width: 100px; | ||
height: 100px; | ||
background-color: green; | ||
} | ||
} | ||
</style> | ||
`; | ||
</script> |
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,26 @@ | ||
<!doctype html> | ||
<meta charset="utf-8"> | ||
<title>:host and nesting (combined with something else)</title> | ||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> | ||
<link rel="author" title="Mozilla" href="https://mozilla.org"> | ||
<link rel="help" href="https://drafts.csswg.org/css-nesting/#nest-selector"> | ||
<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"></div> | ||
<script> | ||
host.attachShadow({mode: "open"}).innerHTML = ` | ||
<style> | ||
.nested { | ||
width: 100px; | ||
height: 100px; | ||
background-color: green; | ||
} | ||
:host(#not-host), #host { | ||
.nested { | ||
background-color: red; | ||
} | ||
} | ||
</style> | ||
<div class="nested"></div> | ||
`; | ||
</script> |
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>:host and nesting (combined with something else, bare declarations)</title> | ||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> | ||
<link rel="author" title="Mozilla" href="https://mozilla.org"> | ||
<link rel="help" href="https://drafts.csswg.org/css-nesting/#nest-selector"> | ||
<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"></div> | ||
<script> | ||
host.attachShadow({mode: "open"}).innerHTML = ` | ||
<style> | ||
:host { | ||
width: 100px; | ||
height: 100px; | ||
background-color: green; | ||
} | ||
:host(#not-host), #host { | ||
@media (width >= 0) { | ||
background-color: red; | ||
} | ||
} | ||
</style> | ||
`; | ||
</script> |
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>:host and nesting (with pseudos)</title> | ||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> | ||
<link rel="author" title="Mozilla" href="https://mozilla.org"> | ||
<link rel="help" href="https://drafts.csswg.org/css-nesting/#nest-selector"> | ||
<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"></div> | ||
<script> | ||
host.attachShadow({mode: "open"}).innerHTML = ` | ||
<style> | ||
:host { | ||
&::before { | ||
display: block; | ||
content: ""; | ||
width: 100px; | ||
height: 100px; | ||
background-color: green; | ||
} | ||
} | ||
</style> | ||
`; | ||
</script> |
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>:host and :is (basic) </title> | ||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> | ||
<link rel="author" title="Mozilla" href="https://mozilla.org"> | ||
<link rel="help" href="https://drafts.csswg.org/selectors/#featureless"> | ||
<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"></div> | ||
<script> | ||
host.attachShadow({mode: "open"}).innerHTML = ` | ||
<style> | ||
:is(:host) .nested { | ||
width: 100px; | ||
height: 100px; | ||
background-color: green; | ||
} | ||
</style> | ||
<div class="nested"></div> | ||
`; | ||
</script> |
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>:host and :is (basic)</title> | ||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> | ||
<link rel="author" title="Mozilla" href="https://mozilla.org"> | ||
<link rel="help" href="https://drafts.csswg.org/selectors/#featureless"> | ||
<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"></div> | ||
<script> | ||
host.attachShadow({mode: "open"}).innerHTML = ` | ||
<style> | ||
:is(:host) { | ||
width: 100px; | ||
height: 100px; | ||
background-color: green; | ||
} | ||
</style> | ||
`; | ||
</script> |
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>:host and :is() (combined with something else)</title> | ||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> | ||
<link rel="author" title="Mozilla" href="https://mozilla.org"> | ||
<link rel="help" href="https://drafts.csswg.org/selectors/#featureless"> | ||
<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"></div> | ||
<script> | ||
host.attachShadow({mode: "open"}).innerHTML = ` | ||
<style> | ||
.nested { | ||
width: 100px; | ||
height: 100px; | ||
background-color: green; | ||
} | ||
:is(:host(#not-host), #host) .nested { | ||
background-color: red; | ||
} | ||
</style> | ||
<div class="nested"></div> | ||
`; | ||
</script> |
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>:host and :is (combined with something else)</title> | ||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> | ||
<link rel="author" title="Mozilla" href="https://mozilla.org"> | ||
<link rel="help" href="https://drafts.csswg.org/selectors/#featureless"> | ||
<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"></div> | ||
<script> | ||
host.attachShadow({mode: "open"}).innerHTML = ` | ||
<style> | ||
:host { | ||
width: 100px; | ||
height: 100px; | ||
background-color: green; | ||
} | ||
:is(:host(#not-host), #host) { | ||
background-color: red; | ||
} | ||
</style> | ||
`; | ||
</script> |
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>:host and :is() (with pseudos)</title> | ||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> | ||
<link rel="author" title="Mozilla" href="https://mozilla.org"> | ||
<link rel="help" href="https://drafts.csswg.org/selectors/#featureless"> | ||
<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"></div> | ||
<script> | ||
host.attachShadow({mode: "open"}).innerHTML = ` | ||
<style> | ||
:is(:host)::before { | ||
display: block; | ||
content: ""; | ||
width: 100px; | ||
height: 100px; | ||
background-color: green; | ||
} | ||
</style> | ||
`; | ||
</script> |