Closed bob2517-whiteline closed 10 months ago
Note to self: While my mind is on it, a couple of other ideas for commands that would make DOM manipulation a bit easier for toggly-type scenarios - replace-class: .oneClass with .twoClass
, toggle-replace-class: .oneClass .twoClass
, toggle-content-after: "cheese" "bread";
(for toggling content used after/before an element - I dunno if it's possible to manipulate this in JS - could be good though - would have replace-content-after
replace-content-before
commands to go along with that).
toggle-take-class now on 2.14.0 branch.
Closing in preparation for release.
Proposed example syntax (with a sample example scope):
It's either going to be that syntax or this (I need to try it out and see which one feels more intuitive - there are arguments for both syntaxes):
This command will either act like the take-class command and take the class from all other elements within the optional specified scope, but if the class is already there on the element being clicked or mouseovered, or whatever, it just removes it from the element.
The issue with the second syntax example, just adding it to the take-class command, is that it hides the option from a glance over the commands available, so to that degree it might get missed by devs looking for something like it. It doesn't have full "readability clarity". So I'm leaning towards making both syntaxes work, and having the docs for toggle-take-class point to the shorthand take-class command docs. Internally the code will run "take-class" and the code for the toggle will be in there. But personally I'd rather use the toggle-take-class command in config because it's easier to read and search for in my text editor.