matthewp / corset

Declarative data bindings, bring your own backend.
https://corset.dev/
BSD 2-Clause "Simplified" License
277 stars 2 forks source link

Support unordered shorthand #183

Open matthewp opened 2 years ago

matthewp commented 2 years ago

In CSS shorthand can be unordered: https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties#ordering_properties

In Corset ordering is strictly enforced. This makes it harder to use properties like event which has a very long signature. It would be nice if you could do:

body {
  event: var(--target) onpopstate var(--callback);
}

I think the algorithm would go something like this:

  1. Check if the value is of the right type
    • Probably the type would be part of the longhand prop declaration.
  2. If not, start at the first unfulfilled property until you find one of the right type.