selection-clip-crash.html (1056B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <link rel="author" title="Philip Rogers" href="mailto:pdr@chromium.org"> 4 <meta name="assert" content="Moving a selection to a different clipper should not crash"> 5 <html class=test-wait> 6 <script> 7 function test() { 8 document.designMode = "on"; 9 10 const a = document.getElementById('a'); 11 const range = new Range(); 12 range.setStart(a, 1); 13 range.setEnd(a, 1); 14 document.getSelection().addRange(range); 15 requestAnimationFrame(function() { 16 requestAnimationFrame(function() { 17 const b = document.getElementById('b'); 18 const updated_range = window.getSelection().getRangeAt(0); 19 updated_range.setStart(b, 1); 20 updated_range.setEnd(b, 1); 21 22 document.documentElement.classList.remove("test-wait"); 23 }); 24 }); 25 } 26 </script> 27 <body onload=test()> 28 <div id=a style="width: 100px; height: 100px;"> </div> 29 <div id=b style="width: 100px; height: 100px; overflow: clip; margin-top: -100px;"> </div> 30 </body> 31 </html>