Debian Codegraph @

plugins/postcss-focus-within/test/_browser_replace.html

raw
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8">
5 <title></title>
6 <link rel="help" href="https://www.w3.org/TR/selectors-4/#the-focus-within-pseudo">
7 <link rel="stylesheet" href="/test/browser.replacewith.expect.css">
8 <script src="/dist/browser-global.js"></script>
9 <script>self._focusWithinInit = focusWithinInit</script>
10 </head>
11 <body>
12 <div id="a-grand-parent">
13 <input type="text" id="a-grand-parent-input">
14
15 <div id="a-parent">
16 <input type="text" id="a-parent-input">
17
18 <div id="a-child">
19 <input type="text" id="a-child-input">
20 </div>
21 </div>
22 </div>
23
24 <script type="module">
25 const purple = 'rgb(128, 0, 128)';
26 const green = 'rgb(0, 128, 0)';
27
28 self.checkElement = async function checkElement(testName, element, shouldBeStyled) {
29 const el = document.getElementById(element);
30 const bg = getComputedStyle(el).backgroundColor;
31 const matchingColor = el.tagName === 'INPUT' ? green : purple;
32
33 if (shouldBeStyled && bg !== matchingColor) {
34 throw new Error(`${testName}: ${element} should be styled`);
35 } else if (!shouldBeStyled && bg === matchingColor) {
36 throw new Error(`${testName}: ${element} should not be styled`);
37 }
38
39 return true;
40 };
41 </script>
42 </body>
43 </html>