Re: [whatwg] HTML inputs directly toggling CSS classes on elements?

class names are meant to be a tiny wormhole which connects the worlds of
content (HTML), presentation (CSS), and behavior (JS)  - I think this
suggestion begins to widen that rip, and it's inadvisable. It's a question
of taste I guess, just which behaviors are primitive enough to not require
javascript.

As you've proven, this idea is easily implemented in Javascript. If you
were to get an incredible rate of adoption for that script, it might
indicate that there is widespread demand for this feature, and you'd be
able to make a case that it's worth implementing in the browser.

On Sun, Sep 10, 2017 at 7:25 AM Roger Hågensen <rh_whatwg@skuldwyrm.no>
wrote:

> On 2017-09-09 18:41, Alex Vincent wrote:
> > A few days ago, I dipped my toes into web design again for the first time
> > in a while.  One of the results is the CSSClassToggleHandler constructor
> > from [1].  Basically, it takes an radio button or checkbox, and turns
> that
> > input into a toggle for a CSS class on another element.
>
> You do have :checked
>
> While I haven't used that with radio or checkboxes much myself it seems
> to at least partially do what you are describing.
>
> https://developer.mozilla.org/en-US/docs/Web/CSS/:checked
>
>
>
>
> --
> Unless specified otherwise, anything I write publicly is considered
> Public Domain (CC0). My opinions are my own unless specified otherwise.
> Roger Hågensen,
> Freelancer, Norway.
>

Received on Sunday, 10 September 2017 13:31:56 UTC