bug1529492-1.html (917B)
1 <!DOCTYPE html> 2 <!-- This test relies on caret browsing being enabled. --> 3 <html class="reftest-wait"> 4 <script src="/tests/SimpleTest/EventUtils.js"></script> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <style> 7 .parent { 8 font: 32px monospace; 9 width: 26ch; 10 overflow: hidden; 11 } 12 #child { 13 transform: scaleX(0.5); 14 transform-origin: 0 0; 15 outline: none; 16 } 17 </style> 18 <div class="parent"><div id="child">.BCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz</div></div> 19 <script> 20 SimpleTest.waitForFocus(function() { 21 let r = document.createRange(); 22 let t = child.firstChild; 23 24 // With a scale of 0.5, the bug manifests by limiting the caret's position 25 // to half way through the text. Place the selection somewhere past that. 26 r.setStart(t, 30); 27 r.setEnd(t, 30); 28 29 let sel = getSelection(); 30 sel.empty(); 31 sel.addRange(r); 32 33 document.documentElement.removeAttribute("class"); 34 }); 35 </script>