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

& < not working in take-class scope #331

Closed bob2517-whiteline closed 1 year ago

bob2517-whiteline commented 1 year ago

This isn't working:

#leftMenu > div > div:nth-of-type(2) > a:click {
    take-class: .optionSelected scope(& < #leftMenu);
}

This is:

#leftMenu > div > div:nth-of-type(2) > a:click {
    take-class: .optionSelected scope(#leftMenu);
}

Error: "Document.querySelectorAll: '& < #leftMenu .optionSelected,& < #leftMenu.optionSelected' is not a valid selector" in eachRemoveClass.

bob2517 commented 1 year ago

Looking at the code, the ACSS special combinators were never added to this.

bob2517 commented 1 year ago

Fixed offline - will commit at a good point. It actually gives us a nice tool, can now do this, useful for menu items or accordion selection (which reminds me - there's a trick I use for slideup/down with auto heights - need to add that in as commands):

div > div:click {
    take-class: .taken scope(& < div);
}
dragontheory commented 1 year ago

Nice!

bob2517 commented 1 year ago

Closing in preparation for release.