rtl-selection-with-decoration.html (1233B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8" /> 5 <title>rtl-selection-with-decoration</title> 6 <style> 7 p { 8 font-size: 2em; 9 text-decoration-color: rgba(0, 0, 0, 0.3); 10 text-decoration-skip-ink: none; 11 } 12 #text1 { 13 text-decoration-line: line-through underline; 14 } 15 #text2 { 16 text-decoration-line: line-through overline; 17 } 18 ::-moz-selection { 19 background-color: white; 20 color: black; 21 } 22 </style> 23 <script type="text/javascript" charset="utf-8"> 24 function select() { 25 window.getSelection().removeAllRanges(); 26 var elems = document.getElementsByTagName('p'); 27 for (var i = 0; i < elems.length; ++i) { 28 var range = document.createRange(); 29 range.setStart(elems[i].firstChild, 2); 30 range.setEnd(elems[i].firstChild, 9); 31 window.getSelection().addRange(range); 32 } 33 } 34 </script> 35 </head> 36 <body onload="select()"> 37 <p id="text1" lang="he">זוהי עובדה הקורא שדעתו מבוססת של תהיה</p> 38 <p id="text2" lang="he" dir="rtl">זוהי עובדה הקורא שדעתו מבוססת של תהיה</p> 39 </body> 40 </html>