From d34ac897df8c5b5534ba25fa8aa9afb9280440e5 Mon Sep 17 00:00:00 2001 From: MatmaRex Date: Sun, 16 Jun 2013 22:35:18 +0200 Subject: [PATCH] jquery.checkboxShiftClick: Don't toggle disabled checkboxes They are not togglable via normal user interaction, so shouldn't be togglable this way either. Bug: 49648 Change-Id: I14b90c86007b583aa27ab5312768b51f3a25cdbb --- resources/jquery/jquery.checkboxShiftClick.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/resources/jquery/jquery.checkboxShiftClick.js b/resources/jquery/jquery.checkboxShiftClick.js index aced0633dc..b206566541 100644 --- a/resources/jquery/jquery.checkboxShiftClick.js +++ b/resources/jquery/jquery.checkboxShiftClick.js @@ -15,11 +15,17 @@ $box.click( function ( e ) { // And one has been clicked before... if ( prevCheckbox !== null && e.shiftKey ) { - // Check or uncheck this one and all in-between checkboxes - $box.slice( - Math.min( $box.index( prevCheckbox ), $box.index( e.target ) ), - Math.max( $box.index( prevCheckbox ), $box.index( e.target ) ) + 1 - ).prop( 'checked', !!e.target.checked ); + // Check or uncheck this one and all in-between checkboxes, + // except for disabled ones + $box + .slice( + Math.min( $box.index( prevCheckbox ), $box.index( e.target ) ), + Math.max( $box.index( prevCheckbox ), $box.index( e.target ) ) + 1 + ) + .filter( function () { + return !this.disabled; + } ) + .prop( 'checked', !!e.target.checked ); } // Either way, update the prevCheckbox variable to the one clicked now prevCheckbox = e.target; -- 2.20.1