commit d25ec29bece2fd189063e8b8ae91892b346a5878
parent 485407fee83fce092e011378c6a4af832ae887d1
Author: Diego Escalante <descalante@mozilla.com>
Date: Fri, 9 Jan 2026 15:44:47 +0000
Bug 2009026 - Add web platform test to ensure attr values are substituted from the specified values. r=emilio,firefox-style-system-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D278206
Diffstat:
2 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/testing/web-platform/meta/css/css-values/attr-length-specified.html.ini b/testing/web-platform/meta/css/css-values/attr-length-specified.html.ini
@@ -0,0 +1,3 @@
+[attr-length-specified.html]
+ [Unit (em) number]
+ expected: FAIL
diff --git a/testing/web-platform/tests/css/css-values/attr-length-specified.html b/testing/web-platform/tests/css/css-values/attr-length-specified.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<title>CSS Values and Units Test: attr() specified length</title>
+<meta name="assert" content="Test attr() specified length">
+<link rel="help" href="https://drafts.csswg.org/css-values/#attr-notation">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+div {
+ --foo: attr(data-foo type(<length>));
+ --bar: attr(data-bar type(<length>));
+ --baz: attr(data-baz em);
+}
+</style>
+
+<div
+ data-foo="3em"
+ data-bar="3EM"
+ data-baz="3"
+/ >
+
+<script>
+ var elem = getComputedStyle(document.querySelector("div"));
+ test(() => {
+ assert_equals(elem.getPropertyValue("--foo"), "3em");
+ }, "type(<length>) lowercase")
+ test(() => {
+ assert_equals(elem.getPropertyValue("--bar"), "3em");
+ }, "type(<length>) uppercase")
+ test(() => {
+ assert_equals(elem.getPropertyValue("--baz"), "3em");
+ }, "Unit (em) number")
+</script>