From b0b4f3844a632c71561dad752750191e49948cf1 Mon Sep 17 00:00:00 2001 From: Anders Hartvoll Ruud Date: Wed, 24 Jul 2019 05:45:07 -0700 Subject: [PATCH] [css-properties-values-api] Accept any value through setProperty. According to a recent spec change, the syntax of a registered custom property must be ignored until computed-value time. This means that setProperty may not inspect the PropertyRegistry and reject values based on that. This CL also removes the PropertyRegistry parameter in many places, to avoid incorrectly using it in the future. Bug: 641877 Change-Id: I99c58775e800500862378420118d81fe3186e739 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1714590 Reviewed-by: Rune Lillesveen Commit-Queue: Anders Hartvoll Ruud Cr-Commit-Position: refs/heads/master@{#680388} --- .../registered-property-cssom.html | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/css/css-properties-values-api/registered-property-cssom.html b/css/css-properties-values-api/registered-property-cssom.html index 59443b3323a89f..d408fa98f9fb23 100644 --- a/css/css-properties-values-api/registered-property-cssom.html +++ b/css/css-properties-values-api/registered-property-cssom.html @@ -52,9 +52,9 @@ test(function() { inlineStyle.setProperty('--length', 'hi'); inlineStyle.setProperty('--color', '20'); - assert_equals(inlineStyle.getPropertyValue('--length'), '5'); - assert_equals(inlineStyle.getPropertyValue('--color'), 'hello'); -}, "Values not matching the registered type can't be set"); + assert_equals(inlineStyle.getPropertyValue('--length'), 'hi'); + assert_equals(inlineStyle.getPropertyValue('--color'), '20'); +}, "Values not matching the registered type can still be set"); test(function() { inlineStyle.removeProperty('--length'); @@ -66,8 +66,9 @@ }, "Values can be removed from inline styles"); test(function() { - sheetStyle.setProperty('--length', 'banana'); // Invalid, no change - assert_equals(computedStyle.getPropertyValue('--length'), '10px'); + // 'banana' is not a valid , but still accepted. + sheetStyle.setProperty('--length', 'banana'); + assert_equals(computedStyle.getPropertyValue('--length'), '0px'); sheetStyle.setProperty('--length', '20px'); assert_equals(computedStyle.getPropertyValue('--length'), '20px'); sheetStyle.setProperty('--length', 'initial');