-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy pathcssstyledeclaration-custom-properties.html
More file actions
19 lines (19 loc) · 1.08 KB
/
cssstyledeclaration-custom-properties.html
File metadata and controls
19 lines (19 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<!doctype html>
<title>CSS Test: computed style declaration includes custom properties.</title>
<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
<link rel="author" href="https://un5pc8f538pd6zm5.julianrbryant.com" title="Mozilla">
<link rel="help" href="https://un5n798jx6qx6j0rmf2verhh.julianrbryant.com/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>
<div style="--foo:bar"></div>
<div></div>
<script>
test(function() {
let withCustom = getComputedStyle(document.querySelector("div"));
let withoutCustom = getComputedStyle(document.querySelector("div + div"));
assert_equals(withCustom.getPropertyValue("--foo"), "bar", "Should be returned from getPropertyValue");
assert_equals(withCustom.length, withoutCustom.length + 1, "Should show up in .length");
assert_equals(withCustom[withCustom.length - 1], "--foo", "Should be after all the non-custom properties");
}, "Custom properties are included in computed style");
</script>