From 55d74f86440a5a804d4551e04f7fd39518af0723 Mon Sep 17 00:00:00 2001 From: SerenaFeng Date: Fri, 12 May 2017 01:49:57 +0800 Subject: add web portal framework for TestAPI Change-Id: I62cea8b59ffe6a6cde98051c130f4502c07d3557 Signed-off-by: SerenaFeng --- .../testapi-ui/assets/lib/jquery/src/core/ready.js | 86 ++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 testapi/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/ready.js (limited to 'testapi/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/ready.js') diff --git a/testapi/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/ready.js b/testapi/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/ready.js new file mode 100644 index 0000000..794feee --- /dev/null +++ b/testapi/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/ready.js @@ -0,0 +1,86 @@ +define( [ + "../core", + "../var/document", + "../core/readyException", + "../deferred" +], function( jQuery, document ) { + +"use strict"; + +// The deferred used on DOM ready +var readyList = jQuery.Deferred(); + +jQuery.fn.ready = function( fn ) { + + readyList + .then( fn ) + + // Wrap jQuery.readyException in a function so that the lookup + // happens at the time of error handling instead of callback + // registration. + .catch( function( error ) { + jQuery.readyException( error ); + } ); + + return this; +}; + +jQuery.extend( { + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + } +} ); + +jQuery.ready.then = readyList.then; + +// The ready event handler and self cleanup method +function completed() { + document.removeEventListener( "DOMContentLoaded", completed ); + window.removeEventListener( "load", completed ); + jQuery.ready(); +} + +// Catch cases where $(document).ready() is called +// after the browser event has already occurred. +// Support: IE <=9 - 10 only +// Older IE sometimes signals "interactive" too soon +if ( document.readyState === "complete" || + ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { + + // Handle it asynchronously to allow scripts the opportunity to delay ready + window.setTimeout( jQuery.ready ); + +} else { + + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", completed ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", completed ); +} + +} ); -- cgit 1.2.3-korg