- From: andruud via GitHub <sysbot+gh@w3.org>
- Date: Thu, 05 Jul 2018 15:29:33 +0000
- To: public-houdini-archive@w3.org
andruud has just created a new issue for https://github.com/w3c/css-houdini-drafts:
== [css-properties-values-api] Syntax-checking in CSSStyleDeclaration.setProperty ==
In the current implementation of css-properties-values-api/cssom in Blink, it is not allowed to set a registered custom property to an invalid value using setProperty. The value is just discarded.
**Should setProperty still discard invalid values for registered custom properties?**
Example:
```
<!DOCTYPE html>
<script>
CSS.registerProperty({
name: '--color',
syntax: '<color>',
initialValue: 'green',
inherits: false
});
</script>
<style>div { --color: red; }</style>
<div id=target></div>
<script>
// Has no effect:
target.style.setProperty('--color', 'url("not-a-url")');
// Actual: red
// Expected (by andruud): green
console.log(getComputedStyle(target).getPropertyValue('--color'));
</script>
```
This was allegedly [1] the agreed-upon behavior at some point, but as of https://github.com/w3c/css-houdini-drafts/commit/8dfc2d985618a23f97e05c42f7ef6b083ef3256d , this behavior seems inconsistent. I think it's more in line with the new spec wording to let setProperty ignore whether the property is registered or not, and do syntax-checking computed-value time.
[1] https://codereview.chromium.org/2607403002
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/778 using your GitHub account
Received on Thursday, 5 July 2018 15:29:36 UTC