attr-universal-selector.html (1013B)
1 <!DOCTYPE html> 2 <title>CSS Values and Units Test: attr() security limitations in universal selector </title> 3 <link rel="help" href="https://drafts.csswg.org/css-values-5/#attr-security"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 7 <style> 8 @property --some-string { 9 syntax: "<string>"; 10 inherits: true; 11 initial-value: "empty"; 12 } 13 * { 14 --some-string: "https://does-not-exist.test/404.png"; 15 } 16 div { 17 --some-string: attr(data-foo); 18 background-image: image-set(var(--some-string)); 19 } 20 </style> 21 22 <html> 23 <body> 24 <div id="attr" data-foo="https://does-not-exist.test/404.png"></div> 25 </body> 26 </html> 27 28 <script> 29 var elem = document.getElementById("attr"); 30 test(() => { 31 assert_equals(window.getComputedStyle(elem).getPropertyValue('background-image'), 32 'none', 33 "'background-image: attr(data-foo)' with data-foo='https://does-not-exist.test/404.png'"); 34 }); 35 </script>