selection-content-visibility-hidden.html (779B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Test content-visibility:hidden text is not selected</title> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 </head> 9 <body> 10 <p style="content-visibility: hidden;">This is hidden text.</p> 11 12 <script> 13 promise_test(async t => { 14 const range = document.createRange(); 15 range.selectNodeContents(document.body); 16 const selection = window.getSelection(); 17 selection.addRange(range); 18 19 const selectedText = selection.toString().trim(); 20 assert_equals(selectedText, '', 'Text with content-visibility: hidden should not be selected'); 21 }, 'Text with content-visibility: hidden is not selected'); 22 </script> 23 </body> 24 </html>