Active-CSS / active-css

The epic event-driven browser language for UI with functionality in one-liner CSS. Over 100 incredible CSS commands for DOM manipulation, ajax, reactive variables, single-page application routing, and lots more. Could CSS be the JavaScript framework of the future?
https://activecss.org
Other
42 stars 7 forks source link

Internally assign &: to beforeComponentOpen and componentOpen type events #26

Closed bob2517 closed 3 years ago

bob2517 commented 4 years ago

Internally assign &: to beforeComponentOpen and componentOpen type events so that developers don't have to remember to do this. These reserved events can only be used inside Active CSS components and they only ever apply to the component itself (&), so there isn't a need to have "&:" in developer code.

Just assign it internally when the parser spots those events. Leave it backward-compatible.

So the code will go from:

&:beforeComponentOpen {
}

to:

beforeComponentOpen {
}
bob2517 commented 3 years ago

After a lot of work with it in production, I'm finding it easy to remember the "&". Also, it's more obvious what needs to happen when adding a conditional to the event if there is already a "&" there specifying the target. So I'm closing this.