Commit e7a0f059c7 for wordpress.org
commit e7a0f059c734f64cb295c8fff0a6ce5cdeb2da56
Author: lancewillett <lancewillett@git.wordpress.org>
Date: Sun Nov 29 18:11:57 2026 +0000
Build/Test Tools: Type-check the asynchronous password-strength loader.
Guard against missing loader settings or an unavailable insertion point. Use the Core version for the `zxcvbn-async` script URL.
Developed in: https://github.com/WordPress/wordpress-develop/pull/16302
Props shailu25.
See #66751.
Built from https://develop.svn.wordpress.org/trunk@65822
git-svn-id: http://core.svn.wordpress.org/trunk@64851 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/js/zxcvbn-async.js b/wp-includes/js/zxcvbn-async.js
index 114cb5a0d6..d974f775ac 100644
--- a/wp-includes/js/zxcvbn-async.js
+++ b/wp-includes/js/zxcvbn-async.js
@@ -9,22 +9,26 @@
* script tag on the page.
*
* This makes sure zxcvbn isn't blocking loading the page as it is a big
- * library. The source for zxcvbn is read from the _zxcvbnSettings global.
+ * library. The source for zxcvbn is read from the `_zxcvbnSettings` global.
*/
-(function() {
- var async_load = function() {
- var first, s;
- s = document.createElement('script');
- s.src = _zxcvbnSettings.src;
- s.type = 'text/javascript';
- s.async = true;
- first = document.getElementsByTagName('script')[0];
- return first.parentNode.insertBefore(s, first);
- };
+( () => {
+ const asyncLoad = () => {
+ if ( typeof _zxcvbnSettings === 'undefined' || ! _zxcvbnSettings.src ) {
+ return;
+ }
- if (window.attachEvent != null) {
- window.attachEvent('onload', async_load);
- } else {
- window.addEventListener('load', async_load, false);
- }
-}).call(this);
+ const script = document.createElement( 'script' );
+ script.src = _zxcvbnSettings.src;
+ script.type = 'text/javascript';
+ script.async = true;
+
+ const first = document.getElementsByTagName( 'script' )[ 0 ];
+ if ( ! first || ! first.parentNode ) {
+ return;
+ }
+
+ first.parentNode.insertBefore( script, first );
+ };
+
+ window.addEventListener( 'load', asyncLoad );
+} )();
diff --git a/wp-includes/js/zxcvbn-async.min.js b/wp-includes/js/zxcvbn-async.min.js
index 5e445d9e86..0106aece31 100644
--- a/wp-includes/js/zxcvbn-async.min.js
+++ b/wp-includes/js/zxcvbn-async.min.js
@@ -1,2 +1,2 @@
/*! This file is auto-generated */
-!function(){function t(){var t,e=document.createElement("script");return e.src=_zxcvbnSettings.src,e.type="text/javascript",e.async=!0,(t=document.getElementsByTagName("script")[0]).parentNode.insertBefore(e,t)}null!=window.attachEvent?window.attachEvent("onload",t):window.addEventListener("load",t,!1)}.call(this);
\ No newline at end of file
+window.addEventListener("load",()=>{var e,t;"undefined"!=typeof _zxcvbnSettings&&_zxcvbnSettings.src&&((e=document.createElement("script")).src=_zxcvbnSettings.src,e.type="text/javascript",e.async=!0,t=document.getElementsByTagName("script")[0])&&t.parentNode&&t.parentNode.insertBefore(e,t)});
\ No newline at end of file
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index b37f2d5717..ef9b05b0a4 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -1197,7 +1197,7 @@ function wp_default_scripts( $scripts ) {
$scripts->add( 'wp-playlist', "/wp-includes/js/mediaelement/wp-playlist$suffix.js", array( 'wp-util', 'backbone', 'mediaelement' ), false, 1 );
- $scripts->add( 'zxcvbn-async', "/wp-includes/js/zxcvbn-async$suffix.js", array(), '1.0' );
+ $scripts->add( 'zxcvbn-async', "/wp-includes/js/zxcvbn-async$suffix.js" );
did_action( 'init' ) && $scripts->localize(
'zxcvbn-async',
'_zxcvbnSettings',
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 35e0206c6f..8208e3cedd 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.3-alpha-65821';
+$wp_version = '7.3-alpha-65822';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.