mediawiki.checkboxtoggle: Fix minor issues.
authorTimo Tijhof <krinklemail@gmail.com>
Mon, 13 Jun 2016 20:00:00 +0000 (22:00 +0200)
committerKrinkle <krinklemail@gmail.com>
Mon, 13 Jun 2016 20:10:20 +0000 (20:10 +0000)
commit67849a0e8c7c272c6eeb6fa517467834c8850929
tree1b58886eaa05827ad34b4061a32ea9f83da12a23
parentb8f17417968634b510397df120c5d5cf7fc54eab
mediawiki.checkboxtoggle: Fix minor issues.

Follows-up 606a21c79414f8870c5e2.

* Mention class name in PHP source. Since there is no obvious link
  between "mediawiki.checkboxtoggle.js" and "ListToggle.php" these
  comments make it possible to find the PHP class. Previously
  these css classes had 0 matches across all source code, thus
  risking accidental removing.

* Quote attribute selector.

* Ensure default prevented before instead of after the handler. These toggles
  have no fallback (href="#"). As such, navigation should be prevented
  regardless of whether the JS fails or succeeds.

* Remove use of is(':checked'). These is no need to reach out to the
  selector engine to determine whether 'checked' property is true or false.
  Instead, use prop('checked') for both getting and setting.

* Simplify code by using this.checked directly instead of $().prop().

* Simplify code by using one loop (from $.prop) instead of two loops
  ($.prop inside $.each). This pattern is also used by selectAll().

Test by using "All", "None" and "Invert" on Special:Log.

Bug: T131318
Change-Id: Idfc43f094c6147d69104416b3f8622eabb20b824
includes/ListToggle.php
resources/src/mediawiki/mediawiki.checkboxtoggle.js