| | 435 | |
| | 436 | /* Chrome doesn't respect autocomplete=off, so we need to detect it ourselves. |
| | 437 | Luckily a change event is sent. */ |
| | 438 | let password_field_selector = $( 'input#pass1' ); |
| | 439 | if ( password_field_selector.length ) { |
| | 440 | function autofilled_password() { |
| | 441 | setTimeout( function() { |
| | 442 | $( 'button.wp-hide-pw' ).click(); |
| | 443 | }, 200 ); |
| | 444 | } |
| | 445 | |
| | 446 | password_field_selector.on( 'change', autofilled_password ); |
| | 447 | |
| | 448 | /* Only detect the changes right away on page load to catch the Chrome event. |
| | 449 | All other changes to the field are ignored. */ |
| | 450 | var change_timeout = setTimeout( function () { |
| | 451 | password_field_selector.off( 'change', autofilled_password ); |
| | 452 | }, 200 ); |
| | 453 | } |
| | 454 | |