diff --git a/src/wp-admin/js/common.js b/src/wp-admin/js/common.js index 200d3e4780..d4caaff4ce 100644 --- a/src/wp-admin/js/common.js +++ b/src/wp-admin/js/common.js @@ -426,10 +426,11 @@ $document.ready( function() { // Init screen meta screenMeta.init(); - // check all checkboxes - $('tbody').children().children('.check-column').find(':checkbox').click( function(e) { - if ( 'undefined' == e.shiftKey ) { return true; } - if ( e.shiftKey ) { + // This event needs to be delegated. Ticket #37973. + $body.on( 'click', 'tbody .check-column :checkbox', function( even ) { + // Shift click to select a range of checkboxes. + if ( 'undefined' == event.shiftKey ) { return true; } + if ( event.shiftKey ) { if ( !lastClicked ) { return true; } checks = $( lastClicked ).closest( 'form' ).find( ':checkbox' ).filter( ':visible:enabled' ); first = checks.index( lastClicked ); @@ -447,7 +448,7 @@ $document.ready( function() { } lastClicked = this; - // toggle "check all" checkboxes + // Toggle the "Select all" checkboxes depending if the other ones are all checked or not. var unchecked = $(this).closest('tbody').find(':checkbox').filter(':visible:enabled').not(':checked'); $(this).closest('table').children('thead, tfoot').find(':checkbox').prop('checked', function() { return ( 0 === unchecked.length ); @@ -456,7 +457,8 @@ $document.ready( function() { return true; }); - $('thead, tfoot').find('.check-column :checkbox').on( 'click.wp-toggle-checkboxes', function( event ) { + // This event needs to be delegated. Ticket #37973. + $body.on( 'click.wp-toggle-checkboxes', 'thead .check-column :checkbox, tfoot .check-column :checkbox', function( event ) { var $this = $(this), $table = $this.closest( 'table' ), controlChecked = $this.prop('checked'),