Skip to content

Commit 80703b2

Browse files
authored
WebKit export: [CSS] Support :visited as the scoping root selectors (#54723)
https://bugs.webkit.org/show_bug.cgi?id=296947
1 parent 6044c1d commit 80703b2

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

css/css-cascade/scope-visited-ref.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@
9191
// Insert inner <a> with JS, since the parser can't produce this result.
9292
let inner_a = document.createElement('a');
9393
inner_a.setAttribute('href', '');
94+
inner_a.setAttribute('class', 'with_class_inner');
95+
inner_a.setAttribute('style', 'color: green');
9496
inner_a.textContent = 'Visited2';
9597
outer_visited.append(inner_a);
9698
</script>

css/css-cascade/scope-visited.html

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
<template shadowrootmode=open>
187187
<main>
188188
Main
189-
<a href="">
189+
<a href="" class="with_class_outer">
190190
Visited1
191191
</a>
192192
</main>
@@ -198,6 +198,17 @@
198198
@scope (:visited) {
199199
:scope > :visited { background-color: coral; }
200200
}
201+
@scope (:visited) {
202+
:visited > :scope { background-color: lightgrey; }
203+
}
204+
@scope(.with_class_inner) {
205+
:visited > :scope { color: yellow; }
206+
}
207+
208+
/* Should match */
209+
@scope(.with_class_outer) {
210+
:scope > :visited { color: green; }
211+
}
201212
</style>
202213
</template>
203214
</div>
@@ -207,8 +218,10 @@
207218
// Insert the inner :visited link with JS, since the parser
208219
// can't produce this.
209220
let outer_a = visited_in_visited.shadowRoot.querySelector('main > a');
221+
210222
let inner_a = document.createElement('a');
211223
inner_a.setAttribute('href', '');
224+
inner_a.setAttribute('class', 'with_class_inner');
212225
inner_a.textContent = 'Visited2';
213226
outer_a.append(inner_a);
214227
}

0 commit comments

Comments
 (0)