commit b40a8ab6e501ffde5078be75919518b87adf664c
parent 6b72f0a4301abfbd2bad47524e87e22503edbdd5
Author: Diego Escalante <descalante@mozilla.com>
Date: Wed, 17 Dec 2025 15:00:43 +0000
Bug 1986631 - Add WPT to test not parsing type(*) in var. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D276239
Diffstat:
1 file changed, 18 insertions(+), 0 deletions(-)
diff --git a/testing/web-platform/tests/css/css-values/attr-all-types.html b/testing/web-platform/tests/css/css-values/attr-all-types.html
@@ -95,6 +95,24 @@
elem.style.setProperty(property, null);
}
+ function test_invalid_var(property, varName, varValue, varUse) {
+ var elem = document.getElementById("attr");
+ var expectedValue = window.getComputedStyle(elem).getPropertyValue(property);
+
+ elem.style.setProperty(varName, varValue);
+ elem.style.setProperty(property, varUse);
+
+ test(() => {
+ assert_equals(window.getComputedStyle(elem).getPropertyValue(property), expectedValue,
+ "Setting property \'" + property + "\' to the value \'" + varUse +
+ "\', where \'" + varName + ": " + varValue + "\' should not change it's value.");
+ }, "Invariant behaviour for var");
+ elem.style.setProperty(varName, null);
+ elem.style.setProperty(property, null);
+ }
+
+ test_invalid_var('background-color', '--foo', 'red', 'var(--foo type(*))');
+
test_valid_attr('content', 'attr(data-foo)', 'abc', '"abc"');
test_valid_attr('content', 'attr(data-foo)', 'var(--number)', '"var(--number)"');
test_valid_attr('content', 'attr(data-foo raw-string)', 'abc', '"abc"');