Make WordPress Core

Changeset 34977


Ignore:
Timestamp:
10/09/2015 01:26:46 AM (11 years ago)
Author:
azaozz
Message:

JS: in event callbacks replace the very outdated return false with preventDefault().

Props adamsilverstein.
Fixes #18590.

Location:
trunk/src/wp-admin/js
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/dashboard.js

    r32505 r34977  
    6868                $( '#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]' ).prop( 'disabled' , false );
    6969
    70                 t = $('#quick-press').submit( function() {
     70                t = $('#quick-press').submit( function( e ) {
     71                        e.preventDefault();
    7172                        $('#dashboard_quick_press #publishing-action .spinner').show();
    7273                        $('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop('disabled', true);
    … …  
    8889                                }, 1000);
    8990                        }
    90 
    91                         return false;
    9291                } );
    9392
  • trunk/src/wp-admin/js/edit-comments.js

    r34743 r34977  
    285285                        $('.avatar', el).first().clone().prependTo('#undo-' + id + ' .' + action + '-undo-inside');
    286286
    287                         a.click(function(){
     287                        a.click(function( e ){
     288                                e.preventDefault();
    288289                                list.wpList.del(this);
    289290                                $('#undo-' + id).css( {backgroundColor:'#ceb'} ).fadeOut(350, function(){
    … …  
    291292                                        $('#comment-' + id).css('backgroundColor', '').fadeIn(300, function(){ $(this).show(); });
    292293                                });
    293                                 return false;
    294294                        });
    295295                }
    … …  
    855855        setCommentsList();
    856856        commentReply.init();
    857         $(document).delegate('span.delete a.delete', 'click', function(){return false;});
     857
     858        $(document).on( 'click', 'span.delete a.delete', function( e ) {
     859                e.preventDefault();
     860        });
    858861
    859862        if ( typeof $.table_hotkeys != 'undefined' ) {
  • trunk/src/wp-admin/js/gallery.js

    r26269 r34977  
    3939        };
    4040
    41         $('#asc').click( function() {
     41        $('#asc').click( function( e ) {
     42                e.preventDefault();
    4243                desc = false;
    4344                sortIt();
    44                 return false;
    45         });
    46         $('#desc').click( function() {
     45        });
     46        $('#desc').click( function( e ) {
     47                e.preventDefault();
    4748                desc = true;
    4849                sortIt();
    49                 return false;
    50         });
    51         $('#clear').click( function() {
     50        });
     51        $('#clear').click( function( e ) {
     52                e.preventDefault();
    5253                clearAll(1);
    53                 return false;
    54         });
    55         $('#showall').click( function() {
     54        });
     55        $('#showall').click( function( e ) {
     56                e.preventDefault();
    5657                $('#sort-buttons span a').toggle();
    5758                $('a.describe-toggle-on').hide();
    5859                $('a.describe-toggle-off, table.slidetoggle').show();
    5960                $('img.pinkynail').toggle(false);
    60                 return false;
    61         });
    62         $('#hideall').click( function() {
     61        });
     62        $('#hideall').click( function( e ) {
     63                e.preventDefault();
    6364                $('#sort-buttons span a').toggle();
    6465                $('a.describe-toggle-on').show();
    6566                $('a.describe-toggle-off, table.slidetoggle').hide();
    6667                $('img.pinkynail').toggle(true);
    67                 return false;
    6868        });
    6969
  • trunk/src/wp-admin/js/inline-edit-post.js

    r34064 r34977  
    4949
    5050                // add events
    51                 $('#the-list').on('click', 'a.editinline', function(){
     51                $('#the-list').on( 'click', 'a.editinline', function( e ) {
     52                        e.preventDefault();
    5253                        inlineEditPost.edit(this);
    53                         return false;
    5454                });
    5555
  • trunk/src/wp-admin/js/plugin-install.js

    r33462 r34977  
    3939        });
    4040
    41         $( '.plugin-card, .plugins .plugin-version-author-uri' ).on( 'click', 'a.thickbox', function() {
     41        $( '.plugin-card, .plugins .plugin-version-author-uri' ).on( 'click', 'a.thickbox', function( e ) {
     42                e.preventDefault();
    4243                tb_click.call(this);
    4344
    … …  
    4647                $('#TB_iframeContent').attr( 'title', plugininstallL10n.plugin_information + ' ' + $(this).data( 'title' ) );
    4748                $('#TB_closeWindowButton').focus();
    48 
    49                 return false;
    5049        });
    5150
  • trunk/src/wp-admin/js/post.js

    r34671 r34977  
    433433
    434434                // TODO: move to jQuery 1.3+, support for multiple hierarchical taxonomies, see wp-lists.js
    435                 $('a', '#' + taxonomy + '-tabs').click( function(){
     435                $('a', '#' + taxonomy + '-tabs').click( function( e ) {
     436                        e.preventDefault();
    436437                        var t = $(this).attr('href');
    437438                        $(this).parent().addClass('tabs').siblings('li').removeClass('tabs');
    … …  
    442443                        else
    443444                                setUserSetting( settingName, 'pop' );
    444                         return false;
    445445                });
    446446
    … …  
    484484                });
    485485
    486                 $('#' + taxonomy + '-add-toggle').click( function() {
     486                $('#' + taxonomy + '-add-toggle').click( function( e ) {
     487                        e.preventDefault();
    487488                        $('#' + taxonomy + '-adder').toggleClass( 'wp-hidden-children' );
    488489                        $('a[href="#' + taxonomy + '-all"]', '#' + taxonomy + '-tabs').click();
    489490                        $('#new'+taxonomy).focus();
    490                         return false;
    491491                });
    492492
    … …  
    609609                };
    610610
    611                 $( '#visibility .edit-visibility').click( function () {
     611                $( '#visibility .edit-visibility').click( function( e ) {
     612                        e.preventDefault();
    612613                        if ( $postVisibilitySelect.is(':hidden') ) {
    613614                                updateVisibility();
    … …  
    617618                                $(this).hide();
    618619                        }
    619                         return false;
    620620                });
    621621
    … …  
    743743
    744744                buttons.html('<button type="button" class="save button button-small">'+postL10n.ok+'</button> <a class="cancel" href="#">'+postL10n.cancel+'</a>');
    745                 buttons.children('.save').click(function() {
     745                buttons.children('.save').click( function( e ) {
    746746                        var new_slug = e.children('input').val();
     747                        e.preventDefault();
    747748                        if ( new_slug == $('#editable-post-name-full').text() ) {
    748749                                buttons.children('.cancel').click();
    749                                 return false;
     750                                return;
    750751                        }
    751752                        $.post(ajaxurl, {
    … …  
    769770                                $( '.edit-slug' ).focus();
    770771                        });
    771                         return false;
    772                 });
    773 
    774                 buttons.children('.cancel').click(function() {
     772                });
     773
     774                buttons.children('.cancel').click( function( e ) {
     775                        e.preventDefault();
    775776                        $('#view-post-btn').show();
    776777                        e.html(revert_e);
    … …  
    779780                        real_slug.val(revert_slug);
    780781                        $( '.edit-slug' ).focus();
    781                         return false;
    782782                });
    783783
  • trunk/src/wp-admin/js/postbox.js

    r34893 r34977  
    5757                        });
    5858
    59                         $( '.postbox a.dismiss' ).bind( 'click.postboxes', function() {
     59                        $( '.postbox a.dismiss' ).on( 'click.postboxes', function( e ) {
    6060                                var hide_id = $(this).parents('.postbox').attr('id') + '-hide';
     61                                e.preventDefault();
    6162                                $( '#' + hide_id ).prop('checked', false).triggerHandler('click');
    62                                 return false;
    6363                        });
    6464
Note: See TracChangeset for help on using the changeset viewer.