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
41 stars 7 forks source link

New has-attribute conditional #353

Open bob2517 opened 1 week ago

bob2517 commented 1 week ago

A current solution:

#something:click {
    body {
        toggle-attribute: data-something;
    }
    body[data-something] #something {
        render: "Not something";
    }
    body:not([data-something]) #something {
        render: "Something";
    }
}

This could then become, following the same syntax as has-class:

#something:click {
    body {
        toggle-attribute: data-something;
    }
    @if (has-attribute(body data-something)) {
        render: "Not something";
    } @else {
        render: "Something";
    }
}

No rush on this.

dragontheory commented 1 week ago

Very nice!