3 ms·
> It is just enough to add support of behavior property to CSS: That's been done before: that's how XBL works in Gecko. Having now worked with it as both API
by bzbarsky 10y ago
> It is just enough to add support of behavior property to CSS:
That's been done before: that's how XBL works in Gecko.
Having now worked with it as both API consumer and API implementor for a while (going on 15 years now), attaching behavior via CSS like that has some really nasty aspects to it. For a start, if you create a "my-toggler" element via createElement, it won't have the behavior attached (because style doesn't get resolved for elements outside the DOM). And if you insert it into the DOM inside a display:none subtree it won't have the behavior, becase style resolution is optimized out inside display:none subtrees. There are various other issues; I don't really have time to write them all out right now.
But suffice it to say that this way of attaching behavior via CSS has been considered, implemented, shipped, used extensively, and found wanting.