Changeset 34078 for branches/4.3
- Timestamp:
- 09/12/2015 12:29:54 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.3/src/wp-admin/js/user-profile.js
r34063 r34078 8 8 $pass1Text, 9 9 $pass1Label, 10 11 10 $pass2, 12 13 11 $weakRow, 14 12 $weakCheckbox, 15 16 13 $toggleButton, 17 14 $submitButtons, 18 15 $submitButton, 19 currentPass; 16 currentPass, 17 inputEvent; 18 19 /* 20 * Use feature detection to determine whether password inputs should use 21 * the `keyup` or `input` event. Input is preferred but lacks support 22 * in legacy browsers. 23 */ 24 if ( 'oninput' in document.createElement( 'input' ) ) { 25 inputEvent = 'input'; 26 } else { 27 inputEvent = 'keyup'; 28 } 20 29 21 30 function generatePassword() { … … 49 58 .data( 'pw', $pass1.data( 'pw' ) ) 50 59 .val( $pass1.val() ) 51 .on( 'keyup', function () {60 .on( inputEvent, function () { 52 61 if ( $pass1Text.val() === currentPass ) { 53 62 return; … … 64 73 } 65 74 66 $pass1.on( 'keyuppwupdate', function () {75 $pass1.on( inputEvent + ' pwupdate', function () { 67 76 if ( $pass1.val() === currentPass ) { 68 77 return; … … 173 182 * pass2 field to the pass1 field, then running check_pass_strength. 174 183 */ 175 $pass2 = $('#pass2').on( 'keyup', function () {184 $pass2 = $('#pass2').on( inputEvent, function () { 176 185 if ( $pass2.val().length > 0 ) { 177 186 $pass1.val( $pass2.val() ); … … 258 267 select = $( '#display_name' ); 259 268 260 $('#pass1').val('').on( 'keyuppwupdate', check_pass_strength );269 $('#pass1').val('').on( inputEvent + ' pwupdate', check_pass_strength ); 261 270 $('#pass-strength-result').show(); 262 271 $('.color-palette').click( function() {
Note: See TracChangeset
for help on using the changeset viewer.