testing/web-platform/tests/css/css-values/attr-universal-selector.html
author dadaa <daisuke.akatsuka@birchill.co.jp>
Wed, 09 Jul 2025 04:53:58 +0000 (9 hours ago)
changeset 795836 a5500d271fe3a1fefb4d81d96fc4abd00d9eade7
parent 764693 2da7cadd85d722119ac8622c6326f27f7de74886
permissions -rw-r--r--
Bug 1957280: Limit user's mouse amount for tree component r=places-reviewers,reusable-components-reviewers,masayuki,mstriemer Differential Revision: https://phabricator.services.mozilla.com/D251224
<!DOCTYPE html>
<title>CSS Values and Units Test: attr() security limitations in universal selector </title>
<link rel="help" href="https://drafts.csswg.org/css-values-5/#attr-security">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<style>
  @property --some-string {
    syntax: "<string>";
    inherits: true;
    initial-value: "empty";
  }
  * {
    --some-string: "https://does-not-exist.test/404.png";
  }
  div {
    --some-string: attr(data-foo);
    background-image: image-set(var(--some-string));
  }
</style>

<html>
  <body>
    <div id="attr" data-foo="https://does-not-exist.test/404.png"></div>
  </body>
</html>

<script>
    var elem = document.getElementById("attr");
    test(() => {
        assert_equals(window.getComputedStyle(elem).getPropertyValue('background-image'),
                    'none',
                    "'background-image: attr(data-foo)' with data-foo='https://does-not-exist.test/404.png'");
    });
</script>