Changeset 34060
- Timestamp:
- 09/11/2015 09:51:31 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/user-profile.js
r33766 r34060 7 7 $pass1, 8 8 $pass1Text, 9 10 9 $pass2, 11 12 10 $weakRow, 13 11 $weakCheckbox, 14 15 12 $toggleButton, 16 13 $submitButtons, 17 14 $submitButton, 18 currentPass; 15 currentPass, 16 inputEvent; 17 18 /* 19 * Use feature detection to determine whether password inputs should use 20 * the `keyup` or `input` event. Input is preferred but lacks support 21 * in legacy browsers. 22 */ 23 if ( 'oninput' in document.createElement( 'input' ) ) { 24 inputEvent = 'input'; 25 } else { 26 inputEvent = 'keyup'; 27 } 19 28 20 29 function generatePassword() { … … 48 57 .data( 'pw', $pass1.data( 'pw' ) ) 49 58 .val( $pass1.val() ) 50 .on( 'keyup', function () {59 .on( inputEvent, function () { 51 60 if ( $pass1Text.val() === currentPass ) { 52 61 return; … … 63 72 } 64 73 65 $pass1.on( 'keyuppwupdate', function () {74 $pass1.on( inputEvent + ' pwupdate', function () { 66 75 if ( $pass1.val() === currentPass ) { 67 76 return; … … 166 175 * pass2 field to the pass1 field, then running check_pass_strength. 167 176 */ 168 $pass2 = $('#pass2').on( 'keyup', function () {177 $pass2 = $('#pass2').on( inputEvent, function () { 169 178 if ( $pass2.val().length > 0 ) { 170 179 $pass1.val( $pass2.val() ); … … 251 260 select = $( '#display_name' ); 252 261 253 $('#pass1').val('').on( 'keyuppwupdate', check_pass_strength );262 $('#pass1').val('').on( inputEvent + ' pwupdate', check_pass_strength ); 254 263 $('#pass-strength-result').show(); 255 264 $('.color-palette').click( function() {
Note: See TracChangeset
for help on using the changeset viewer.