Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <meta charset="utf-8"> | |
| 3 <script src=../../resources/testharness.js></script> | |
| 4 <script src=../../resources/testharnessreport.js></script> | |
| 5 <iframe id="frame"></iframe> | |
| 6 <script> | |
| 7 test(() => assert_not_equals(window.internals, undefined), | |
| 8 "Check window.internals is available"); | |
| 9 | |
| 10 const frame = document.getElementById("frame"); | |
| 11 frame.contentDocument.open(); | |
| 12 frame.contentDocument.write(` | |
| 13 <!DOCTYPE html> | |
| 14 <style> | |
| 15 input { | |
| 16 background-color: rgb(50, 150, 200); | |
| 17 } | |
| 18 input:focus-within { | |
| 19 background-color: rgb(250, 200, 150); | |
| 20 } | |
| 21 </style> | |
| 22 <input id="input" /> | |
| 23 `); | |
| 24 frame.contentDocument.close(); | |
|
rune
2017/04/28 13:00:03
You could probably just use the srcdoc attribute o
Manuel Rego
2017/05/02 07:53:35
Done.
| |
| 25 | |
| 26 const input = frame.contentDocument.getElementById("input"); | |
| 27 input.focus(); | |
| 28 | |
| 29 test(() => assert_equals(frame.contentWindow.getComputedStyle(input).backgroun dColor, "rgb(250, 200, 150)"), | |
| 30 "Check ':focus-within' is applied after focusing the input"); | |
| 31 | |
| 32 frame.contentWindow.internals.setFocused(false); | |
| 33 test(() => assert_equals(frame.contentWindow.getComputedStyle(input).backgroun dColor, "rgb(50, 150, 200)"), | |
| 34 "Check ':focus-within' is not applied when the frame is unfocused"); | |
| 35 | |
| 36 frame.contentWindow.internals.setFocused(true); | |
| 37 test(() => assert_equals(frame.contentWindow.getComputedStyle(input).backgroun dColor, "rgb(250, 200, 150)"), | |
| 38 "Check ':focus-within' is applied when the frame is focsued again"); | |
| 39 </script> | |
| OLD | NEW |