stringifier.tentative.html (821B)
1 <!DOCTYPE HTML> 2 <meta charset=utf-8> 3 <title>Selection: stringifier</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script> 7 window.onload = () => { 8 test(() => { 9 const selection = getSelection(); 10 const p = document.querySelector("p"); 11 12 const range = document.createRange(); 13 range.selectNode(p); 14 selection.addRange(range); 15 16 // In Chrome there are trailing \n characters. There is no spec for the 17 // stringifier, just a link to 18 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=10583 19 assert_equals(selection.toString(), "foo bar"); 20 }); 21 }; 22 </script> 23 <!-- The structure of the document matters, in particular making this look like 24 in addRange.htm would mask the problem. --> 25 <body> 26 <p>foo bar</p> 27 </body> 28 </html>