diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/css/cssom/cssstyledeclaration-registered-custom-properties.html | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/cssom/cssstyledeclaration-registered-custom-properties.html')
-rw-r--r-- | testing/web-platform/tests/css/cssom/cssstyledeclaration-registered-custom-properties.html | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/cssom/cssstyledeclaration-registered-custom-properties.html b/testing/web-platform/tests/css/cssom/cssstyledeclaration-registered-custom-properties.html new file mode 100644 index 0000000000..5aa4ad2532 --- /dev/null +++ b/testing/web-platform/tests/css/cssom/cssstyledeclaration-registered-custom-properties.html @@ -0,0 +1,58 @@ +<!DOCTYPE html> +<title>Computed CSSStyleDeclaration includes registered custom properties</title> +<link rel="help" href="https://drafts.csswg.org/cssom/#dom-window-getcomputedstyle"> +<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/1316"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<style> + @property --non-inherited-length { + syntax: "<length>"; + inherits: false; + initial-value: 0px; + } + @property --inherited-length { + syntax: "<length>"; + inherits: true; + initial-value: 0px; + } + @property --universal-with-initial { + syntax: "*"; + inherits: false; + initial-value: foo; + } + @property --universal-without-initial { + syntax: "*"; + inherits: false; + } + #outer { --non-registered-outer: 1px; } + #inner { --non-registered-inner: 2px; } + #sibling { --universal-without-initial: bar; } +</style> +<div id=outer> + <div id=inner></div> + <div id=sibling></div> +</div> +<script> + const assert_present = (props, name) => assert_not_equals(props.indexOf(name), -1); + const assert_absent = (props, name) => assert_equals(props.indexOf(name), -1); + + test(function() { + let props = Array.from(getComputedStyle(inner)); + assert_present(props, '--non-inherited-length'); + assert_present(props, '--inherited-length'); + assert_present(props, '--non-registered-outer'); + assert_present(props, '--non-registered-inner'); + assert_present(props, '--universal-with-initial'); + assert_absent(props, '--universal-without-initial'); + }, 'Registered custom properties are included in CSSComputedStyleDeclaration'); + + test(function() { + let props = Array.from(getComputedStyle(sibling)); + assert_present(props, '--non-inherited-length'); + assert_present(props, '--inherited-length'); + assert_present(props, '--non-registered-outer'); + assert_present(props, '--universal-with-initial'); + assert_present(props, '--universal-without-initial'); + assert_absent(props, '--non-registered-inner'); + }, 'Only relevant custom properties are included'); +</script> |