|
11 | 11 | #state-and-part:state(outerFoo)::part(inner) {
|
12 | 12 | opacity: 0.25;
|
13 | 13 | }
|
14 |
| -:state(--\)escaped\ state) {} |
| 14 | +:state( \(escaped\ state ) {} |
15 | 15 | </style>
|
16 | 16 | <body>
|
17 | 17 | <script>
|
|
60 | 60 | document.querySelector(':state(--16px)');
|
61 | 61 | }, ':state() parsing passes');
|
62 | 62 |
|
| 63 | +test(() => { |
| 64 | + assert_throws_dom('SyntaxError', () => { document.querySelector(':state'); }); |
| 65 | + assert_throws_dom('SyntaxError', () => { document.querySelector(':state('); }); |
| 66 | + assert_throws_dom('SyntaxError', () => { document.querySelector(':state()'); }); |
| 67 | + assert_throws_dom('SyntaxError', () => { document.querySelector(':state(=)'); }); |
| 68 | + assert_throws_dom('SyntaxError', () => { document.querySelector(':state(name=value)'); }); |
| 69 | + assert_throws_dom('SyntaxError', () => { document.querySelector(':state( foo bar)'); }); |
| 70 | + assert_throws_dom('SyntaxError', () => { document.querySelector(':state(16px)'); }); |
| 71 | +}, ':state() parsing failures'); |
| 72 | + |
63 | 73 | test(() => {
|
64 | 74 | assert_throws_dom('SyntaxError', () => { document.querySelector(':--('); });
|
65 | 75 | assert_throws_dom('SyntaxError', () => { document.querySelector(':--()'); });
|
66 |
| - assert_throws_dom('SyntaxError', () => { document.querySelector(':state()'); }); |
67 | 76 | assert_throws_dom('SyntaxError', () => { document.querySelector(':--)'); });
|
68 | 77 | assert_throws_dom('SyntaxError', () => { document.querySelector(':--='); });
|
69 | 78 | assert_throws_dom('SyntaxError', () => { document.querySelector(':--name=value'); });
|
70 |
| - assert_throws_dom('SyntaxError', () => { document.querySelector(':state(--name=value'); }); |
71 |
| - assert_throws_dom('SyntaxError', () => { document.querySelector(':state(--name=value)'); }); |
72 |
| -}, ':state() parsing failures'); |
| 79 | +}, 'deprecated :--state parsing failures'); |
73 | 80 |
|
74 | 81 | test(() => {
|
75 | 82 | assert_equals(document.styleSheets[0].cssRules[1].cssText,
|
76 | 83 | '#state-and-part::part(inner):state(innerFoo) { opacity: 0.5; }');
|
77 | 84 | assert_equals(document.styleSheets[0].cssRules[3].selectorText,
|
78 |
| - ':state(--\\)escaped\\ state)'); |
| 85 | + ':state(\\(escaped\\ state)'); |
79 | 86 | }, ':state(foo) serialization');
|
80 | 87 |
|
81 | 88 | test(() => {
|
|
112 | 119 | let inner = outer.innerElement;
|
113 | 120 | let innerStates = inner.i.states;
|
114 | 121 |
|
115 |
| - innerStates.add(':state(innerFoo)'); |
| 122 | + innerStates.add('innerFoo'); |
116 | 123 | assert_equals(getComputedStyle(inner).opacity, '0.5',
|
117 |
| - '::part() followed by :state(innerFoo)'); |
| 124 | + '::part() followed by :state()'); |
118 | 125 | innerStates.delete('innerFoo');
|
119 | 126 | innerStates.add('innerfoo');
|
120 | 127 | assert_equals(getComputedStyle(inner).opacity, '0',
|
121 |
| - ':state(foo) matching should be case-sensitive'); |
| 128 | + ':state() matching should be case-sensitive'); |
122 | 129 | innerStates.delete('innerfoo');
|
123 | 130 |
|
124 | 131 | outer.i.states.add('outerFoo');
|
|
0 commit comments