Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

ready-no-deferred.js 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. define( [
  2. "../core",
  3. "../var/document",
  4. "../var/isFunction"
  5. ], function( jQuery, document, isFunction ) {
  6. "use strict";
  7. var readyCallbacks = [],
  8. whenReady = function( fn ) {
  9. readyCallbacks.push( fn );
  10. },
  11. executeReady = function( fn ) {
  12. // Prevent errors from freezing future callback execution (gh-1823)
  13. // Not backwards-compatible as this does not execute sync
  14. window.setTimeout( function() {
  15. fn.call( document, jQuery );
  16. } );
  17. };
  18. jQuery.fn.ready = function( fn ) {
  19. whenReady( fn );
  20. return this;
  21. };
  22. jQuery.extend( {
  23. // Is the DOM ready to be used? Set to true once it occurs.
  24. isReady: false,
  25. // A counter to track how many items to wait for before
  26. // the ready event fires. See #6781
  27. readyWait: 1,
  28. ready: function( wait ) {
  29. // Abort if there are pending holds or we're already ready
  30. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  31. return;
  32. }
  33. // Remember that the DOM is ready
  34. jQuery.isReady = true;
  35. // If a normal DOM Ready event fired, decrement, and wait if need be
  36. if ( wait !== true && --jQuery.readyWait > 0 ) {
  37. return;
  38. }
  39. whenReady = function( fn ) {
  40. readyCallbacks.push( fn );
  41. while ( readyCallbacks.length ) {
  42. fn = readyCallbacks.shift();
  43. if ( isFunction( fn ) ) {
  44. executeReady( fn );
  45. }
  46. }
  47. };
  48. whenReady();
  49. }
  50. } );
  51. // Make jQuery.ready Promise consumable (gh-1778)
  52. jQuery.ready.then = jQuery.fn.ready;
  53. /**
  54. * The ready event handler and self cleanup method
  55. */
  56. function completed() {
  57. document.removeEventListener( "DOMContentLoaded", completed );
  58. window.removeEventListener( "load", completed );
  59. jQuery.ready();
  60. }
  61. // Catch cases where $(document).ready() is called
  62. // after the browser event has already occurred.
  63. // Support: IE9-10 only
  64. // Older IE sometimes signals "interactive" too soon
  65. if ( document.readyState === "complete" ||
  66. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  67. // Handle it asynchronously to allow scripts the opportunity to delay ready
  68. window.setTimeout( jQuery.ready );
  69. } else {
  70. // Use the handy event callback
  71. document.addEventListener( "DOMContentLoaded", completed );
  72. // A fallback to window.onload, that will always work
  73. window.addEventListener( "load", completed );
  74. }
  75. } );