UPDATE: Jake found a workaround to bypass that Chrome bug: register the custom property with @property.
That works.
But
…
Safari doesn’t like it. It seems to be stuck in a transition loop when the custom props is registered to contain string values ("<string>" or "*") 😕
Here’s something nice by @matthewp built on top of all this: a Selector Matcher Observer powered by CSSStyleObserver.
When the element matches the given selector, a custom property gets flipped, triggering the callback attached to the CSSStyleObserver.
https://codepen.io/bramus/pen/zYVJBje