Re: [css-houdini-drafts] [css-properties-values-api] Interaction with setProperty is unfortunate. (#880)

> I don't get the "give feedback to the author" point with setProperty. setProperty doesn't throw, so you need to call getProperty afterwards to check if it actually applied, it's not as different as having to call getComputedStyle afterwards, IMO.

Oh, hrm, you're right; my intention (from <https://github.com/w3c/css-houdini-drafts/issues/778#issuecomment-406440820>) was to make .setProperty() throw for registered properties, like `.set()` does in TypedOM.

> Does toggling src or such count as a "JS-triggered parse"?

4th is one of the easier ones to define, imo, tho I apparently didn't do a good job of describing it. ^_^ The distinction is parses initiated by the host language's semantics, versus CSSOM/etc that interact with CSS concepts directly, independent of the host language.

In definition terms, we'd just be adding text to all the CSSOM methods to do a verifying parse based on current registrations; HTML would invoke the algorithms without that text, and so would get a no-verification parse.

Toggling `src` is thus "host-language initiated", and would not verify custom properties.

> The last one at least is definitely a no-go. Parsing time depends on the network, and if you parse off-main-thread, you can concurrently register a property while you're parsing. Getting some kind of determinism there is really hard.

I'm not sure if you understood what I was saying in 5; all stylesheets parsed from the static markup will be no-verification, so there's no race condition.

The only way to race things is to intentionally kick off a load in JS and then do nothing to sync with it; given how trivial fetch() promises are to work with, I'd be okay with letting authors shoot themselves in the foot there.

Hm, I suppose toggling a `src` from JS will trigger a more-difficult-to-observe timing of the actual parse, tho.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/880#issuecomment-487723806 using your GitHub account

Received on Monday, 29 April 2019 20:06:18 UTC