Add a way to check that property name and values are valid for CSSPropertyRule
Categories
(DevTools :: Inspector, task, P3)
Tracking
(Not tracked)
People
(Reporter: nchevobbe, Unassigned)
References
Details
At the moment, we're using InspectorUtils.supports (based on CSS.supports), to check if a declaration is valid, and also to check if the property name is valid https://searchfox.org/mozilla-central/rev/6602bdf9fff5020fbc8e248c963ddddf09a77b1b/devtools/server/actors/style-rule.js#440-443,447-450
decl.isValid = InspectorUtils.supports(
`${decl.name}:${decl.value}`,
supportsOptions
);
...
decl.isNameValid = InspectorUtils.supports(
`${decl.name}:initial`,
supportsOptions
);
This doesn't work for @property declarations (e.g. CSS.supports('syntax: "<color>"'))
This mean we should either:
- add support for such thing in
InspectorUtils.supports(maybe with a specific option, but not sure how hard this would be/if we want this) - add another method for which would give us information about the validity of the declarations of the CSSPropertyRule telling us:
- if a given property name is valid (this one should be easy)
- if the given value is valid for the property
- but also extra info like is the
initial-valuevalid based on the rulesyntaxvalue, …
| Reporter | ||
Comment 1•2 years ago
|
||
Zach, do you know how complex it would be to implement ?
Comment 2•2 years ago
|
||
It sounds like the fact that an invalid @property rule will still result in a CSSPropertyRule (but not a property registration) might be complicating things a bit. That behavior does not match the spec, and it needs to be fixed (see bug 1857724).
- if the given value is valid for the property
Probably the Servo_GetRegisteredCustomProperties binding from bug 1841265 can be used, but validating would also need another binding to expose properties_and_values::ComputedValue::parse ?
- but also extra info like is the
initial-valuevalid based on the rulesyntaxvalue, …
Validating the initial value should be pretty straightforward, we already do essentially that before registering custom properties from JavaScript:
Updated•2 months ago
|
Description
•