OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <style> |
| 3 ::selection { |
| 4 background-color: transparent; |
| 5 color: red |
| 6 } |
| 7 .green::selection { |
| 8 color: green |
| 9 } |
| 10 </style> |
| 11 <span id="t1">This text should be green.</span> |
| 12 <script> |
| 13 if (window.testRunner) |
| 14 testRunner.waitUntilDone(); |
| 15 |
| 16 function setSelection(textNode) { |
| 17 window.getSelection().removeAllRanges(); |
| 18 var range = document.createRange(); |
| 19 range.setStart(textNode, 0); |
| 20 range.setEnd(textNode, textNode.data.length); |
| 21 window.getSelection().addRange(range); |
| 22 } |
| 23 |
| 24 setSelection(t1.firstChild); |
| 25 requestAnimationFrame(() => |
| 26 requestAnimationFrame(() => { |
| 27 t1.className = "green"; |
| 28 if (window.testRunner) |
| 29 testRunner.notifyDone(); |
| 30 })); |
| 31 </script> |
OLD | NEW |