user-select-inheritance.html (1101B)
1 <!DOCTYPE html> 2 <title>Tests inheritance of CSS user-select property</title> 3 <link rel="author" title="Google LLC" href="https://www.google.com/"> 4 <link rel="help" href="https://drafts.csswg.org/css-ui/#content-selection"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <div id="container">abc<div id="target">xyz</div>def</div> 8 <script> 9 const container = document.getElementById('container'); 10 const target = document.getElementById('target'); 11 function test_inheritance(value) { 12 const property = `user-select:${value}`; 13 test(() => { 14 container.setAttribute('style', property); 15 assert_equals(getComputedStyle(container).userSelect, value, 16 `${property} should be supported.`); 17 assert_equals(getComputedStyle(target).userSelect, 'auto', 18 `${property} should not be inherited.`); 19 }, `${property} should not be inherited.`); 20 } 21 test_inheritance('all'); 22 test_inheritance('auto'); 23 test_inheritance('contain'); 24 test_inheritance('none'); 25 test_inheritance('text'); 26 </script>