Its not safe to bind behavior to css classes. It will lead to conflicts with templates, modules or other scrips. Especially when they are commonly used like .toggle-all.
Why are we triggering the click event on the checkbox instead of just checking it?
Its a common task to check/uncheck checkboxes in joomla. We should have a global helper for it (and we already have one which is tightly coupled to the dom and not flexible enough. Yes, im looking at you Joomla.checkAll())
Changed to forEach. Ready to merge.