attr-invalidation.html (803B)
1 <!DOCTYPE html> 2 <title>CSS Values and Units Test: attr() invalidation</title> 3 <meta name="assert" content="Test attr() invalidation"> 4 <link rel="help" href="https://drafts.csswg.org/css-values/#attr-notation"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <style> 8 div { 9 width: attr(data-foo type(<length>)); 10 } 11 </style> 12 13 <html> 14 <body> 15 <div id="div" data-foo="10px"></div> 16 </body> 17 </html> 18 19 <script> 20 setup({ single_test: true }); 21 let elem = document.getElementById("div"); 22 let old_width = window.getComputedStyle(elem).getPropertyValue("width"); 23 elem.setAttribute("data-foo", "30px"); 24 let new_width = window.getComputedStyle(elem).getPropertyValue("width"); 25 assert_not_equals(new_width, old_width); 26 done(); 27 </script>