balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

zxcvbn-async.js (821B)


      1 /**
      2  * @output wp-includes/js/zxcvbn-async.js
      3  */
      4 
      5 /* global _zxcvbnSettings */
      6 
      7 /**
      8  * Loads zxcvbn asynchronously by inserting an async script tag before the first
      9  * script tag on the page.
     10  *
     11  * This makes sure zxcvbn isn't blocking loading the page as it is a big
     12  * library. The source for zxcvbn is read from the _zxcvbnSettings global.
     13  */
     14 (function() {
     15   var async_load = function() {
     16     var first, s;
     17     s = document.createElement('script');
     18     s.src = _zxcvbnSettings.src;
     19     s.type = 'text/javascript';
     20     s.async = true;
     21     first = document.getElementsByTagName('script')[0];
     22     return first.parentNode.insertBefore(s, first);
     23   };
     24 
     25   if (window.attachEvent != null) {
     26     window.attachEvent('onload', async_load);
     27   } else {
     28     window.addEventListener('load', async_load, false);
     29   }
     30 }).call(this);