gnat / surreal

🗿 Mini jQuery alternative. Dependency-free animations. Locality of Behavior. Use one element or arrays transparently. Pairs with htmx. Vanilla querySelector() but better!
https://gnat.github.io/surreal/example.html
MIT License
1.2k stars 24 forks source link

update(classToggle): add force option #38

Closed kennycallado closed 2 months ago

kennycallado commented 2 months ago

Add an optional force parameter to classToggle as MDN describes.

gnat commented 2 months ago

This looks really good. Will test and likely merge soon.

kennycallado commented 2 months ago

This way, you can directly incorporate the condition into classToggle:

me().classToggle('show', 1 == 1)

instead of:

if (1 == 1) {
  me().classToggle('show')
}

And congratulations on the 1k milestone! :clap:

gnat commented 2 months ago

Thank you @kennycallado !