Making WordPress.org

Changeset 9073


Ignore:
Timestamp:
07/24/2019 06:35:34 AM (7 years ago)
Author:
dd32
Message:

Trac: JS: Check that there existed a matched element before attempting to call .val() in capital_P_dangit().

Was causing an annoying JS exception during ticket creation, where $comment was an empty set.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/style/trac/wp-trac.js

    r9053 r9073  
    501501                    var replacement = value.replace( 'Wordpress', 'WordPress' );
    502502
    503                     $description.val( $description.val().replace( value, replacement ) );
    504                     $comment.val( $comment.val().replace( value, replacement ) );
     503                    if ( $description.length ) {
     504                        $description.val( $description.val().replace( value, replacement ) );
     505                    }
     506                    if ( $comment.length ) {
     507                        $comment.val( $comment.val().replace( value, replacement ) );
     508                    }
    505509                } );
    506510            } );
Note: See TracChangeset for help on using the changeset viewer.