File: pseudo-classes-after-part.html

package info (click to toggle)
firefox 144.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,637,504 kB
  • sloc: cpp: 7,576,692; javascript: 6,430,831; ansic: 3,748,119; python: 1,398,978; xml: 628,810; asm: 438,679; java: 186,194; sh: 63,212; makefile: 19,159; objc: 13,086; perl: 12,986; yacc: 4,583; cs: 3,846; pascal: 3,448; lex: 1,720; ruby: 1,003; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 53; csh: 10
file content (93 lines) | stat: -rw-r--r-- 4,394 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!DOCTYPE html>
<title>Pseudo-classes allowed after ::part()</title>
<link rel="help" href="https://drafts.csswg.org/css-shadow-parts/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../support/parsing-testcommon.js"></script>

<script>
"use strict";

// Test that non-structural pseudo-classes are allowed after ::part().
test_valid_selector("::part(mypart):active");
test_valid_selector("::part(mypart):active-view-transition");
test_valid_selector("::part(mypart):active-view-transition-type(mytype)");
test_valid_selector("::part(mypart):any-link");
test_valid_selector("::part(mypart):autofill");
test_valid_selector("::part(mypart):checked");
test_valid_selector("::part(mypart):default");
test_valid_selector("::part(mypart):defined");
test_valid_selector("::part(mypart):dir(ltr)");
test_valid_selector("::part(mypart):disabled");
test_valid_selector("::part(mypart):enabled");
test_valid_selector("::part(mypart):focus");
test_valid_selector("::part(mypart):focus-visible");
test_valid_selector("::part(mypart):focus-within");
test_valid_selector("::part(mypart):fullscreen");
test_valid_selector("::part(mypart):future");
test_valid_selector("::part(mypart):hover");
test_valid_selector("::part(mypart):indeterminate");
test_valid_selector("::part(mypart):in-range");
test_valid_selector("::part(mypart):invalid");
test_valid_selector("::part(mypart):lang(en)");
test_valid_selector("::part(mypart):link");
test_valid_selector("::part(mypart):modal");
test_valid_selector("::part(mypart):open");
test_valid_selector("::part(mypart):optional");
test_valid_selector("::part(mypart):out-of-range");
test_valid_selector("::part(mypart):past");
test_valid_selector("::part(mypart):paused");
test_valid_selector("::part(mypart):picture-in-picture");
test_valid_selector("::part(mypart):placeholder-shown");
test_valid_selector("::part(mypart):playing");
test_valid_selector("::part(mypart):popover-open");
test_valid_selector("::part(mypart):read-only");
test_valid_selector("::part(mypart):read-write");
test_valid_selector("::part(mypart):required");
test_valid_selector("::part(mypart):state(mystate)");
test_valid_selector("::part(mypart):target");
test_valid_selector("::part(mypart):user-invalid");
test_valid_selector("::part(mypart):user-valid");
test_valid_selector("::part(mypart):valid");
test_valid_selector("::part(mypart):visited");
test_valid_selector("::part(mypart):xr-overlay");

// Test that the @page pseudo-classes are not supported after ::part().
test_invalid_selector("::part(mypart):left");
test_invalid_selector("::part(mypart):right");
test_invalid_selector("::part(mypart):first");

// Test that structural pseudo-classes are not allowed after ::part().
test_invalid_selector("::part(mypart):empty");
test_invalid_selector("::part(mypart):first-child");
test_invalid_selector("::part(mypart):first-of-type");
test_invalid_selector("::part(mypart):last-child");
test_invalid_selector("::part(mypart):last-of-type");
test_invalid_selector("::part(mypart):nth-child(1)");
test_invalid_selector("::part(mypart):nth-last-child(1)");
test_invalid_selector("::part(mypart):nth-last-of-type(1)");
test_invalid_selector("::part(mypart):nth-of-type(1)");
test_invalid_selector("::part(mypart):only-child");
test_invalid_selector("::part(mypart):only-of-type");

// Test that pseudo-classes that match based on tree information are not allowed after ::part.
test_invalid_selector("::part(mypart):host");
test_invalid_selector("::part(mypart):host-context(:hover)");
test_invalid_selector("::part(mypart):has(p)");
test_invalid_selector("::part(mypart):has(:hover)");
test_invalid_selector("::part(mypart):scope");

// Test that :not() applies appropriate constraints for being after ::part(),
// but that :is() and :where() (which accept <forgiving-selector-list>) do
// not.
// Note that the serialization behavior of the last two is as-resolved in
// https://github.com/w3c/csswg-drafts/issues/8356 but it doesn't appear to be
// specified yet.
test_valid_selector("::part(mypart):not(:hover)")
test_valid_selector("::part(mypart):is(:hover)")
test_valid_selector("::part(mypart):where(:hover)")
test_invalid_selector("::part(mypart):not(:first-child)")
test_valid_forgiving_selector("::part(mypart):is(:first-child)")
test_valid_forgiving_selector("::part(mypart):where(:first-child)")

</script>