Open Bug 1866714 Opened 1 year ago

Mark `var()` fallback value (and the property) invalid if the value does not match the syntax of the registered custom property

Categories

(DevTools :: Inspector: Rules, task)

task

Tracking

(Not tracked)

People

(Reporter: nchevobbe, Unassigned)

References

(Blocks 1 open bug)

Details

Steps to reproduce

  1. Navigate to data:text/html,<meta charset=utf8><style>@property --b { syntax: '<color>'; inherits: true; initial-value: gold; } h1 { color: var(--b, 10px); }</style><h1>hello</h1>
  2. Open the inspector, select the <h1> node

Expected results

The color property should be marked as invalid

The fallback value (10px) doesn't match the registered definition stynax (<color>), and as the spec says::

References to registered custom properties using the var() function may provide a fallback. However, the fallback value must match the syntax definition of the custom property being referenced, otherwise the declaration is invalid at computed-value time.

We should surface this information to the user so they know why the declaration is invalid

You need to log in before you can comment on or make changes to this bug.