zxcvbn-async.js 821 B

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