diff options
Diffstat (limited to '3rd_party/static/testapi-ui/assets/lib/jquery/src/core')
10 files changed, 521 insertions, 0 deletions
diff --git a/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/DOMEval.js b/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/DOMEval.js new file mode 100644 index 0000000..c49c12e --- /dev/null +++ b/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/DOMEval.js @@ -0,0 +1,16 @@ +define( [ + "../var/document" +], function( document ) { + "use strict"; + + function DOMEval( code, doc ) { + doc = doc || document; + + var script = doc.createElement( "script" ); + + script.text = code; + doc.head.appendChild( script ).parentNode.removeChild( script ); + } + + return DOMEval; +} ); diff --git a/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/access.js b/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/access.js new file mode 100644 index 0000000..86cdbc7 --- /dev/null +++ b/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/access.js @@ -0,0 +1,70 @@ +define( [ + "../core" +], function( jQuery ) { + +"use strict"; + +// Multifunctional method to get and set values of a collection +// The value/s can optionally be executed if it's a function +var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { + var i = 0, + len = elems.length, + bulk = key == null; + + // Sets many values + if ( jQuery.type( key ) === "object" ) { + chainable = true; + for ( i in key ) { + access( elems, fn, i, key[ i ], true, emptyGet, raw ); + } + + // Sets one value + } else if ( value !== undefined ) { + chainable = true; + + if ( !jQuery.isFunction( value ) ) { + raw = true; + } + + if ( bulk ) { + + // Bulk operations run against the entire set + if ( raw ) { + fn.call( elems, value ); + fn = null; + + // ...except when executing function values + } else { + bulk = fn; + fn = function( elem, key, value ) { + return bulk.call( jQuery( elem ), value ); + }; + } + } + + if ( fn ) { + for ( ; i < len; i++ ) { + fn( + elems[ i ], key, raw ? + value : + value.call( elems[ i ], i, fn( elems[ i ], key ) ) + ); + } + } + } + + if ( chainable ) { + return elems; + } + + // Gets + if ( bulk ) { + return fn.call( elems ); + } + + return len ? fn( elems[ 0 ], key ) : emptyGet; +}; + +return access; + +} ); diff --git a/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/init.js b/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/init.js new file mode 100644 index 0000000..8841264 --- /dev/null +++ b/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/init.js @@ -0,0 +1,128 @@ +// Initialize a jQuery object +define( [ + "../core", + "../var/document", + "./var/rsingleTag", + + "../traversing/findFilter" +], function( jQuery, document, rsingleTag ) { + +"use strict"; + +// A central reference to the root jQuery(document) +var rootjQuery, + + // A simple way to check for HTML strings + // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) + // Strict HTML recognition (#11290: must start with <) + // Shortcut simple #id case for speed + rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, + + init = jQuery.fn.init = function( selector, context, root ) { + var match, elem; + + // HANDLE: $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Method init() accepts an alternate rootjQuery + // so migrate can support jQuery.sub (gh-2101) + root = root || rootjQuery; + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector[ 0 ] === "<" && + selector[ selector.length - 1 ] === ">" && + selector.length >= 3 ) { + + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && ( match[ 1 ] || !context ) ) { + + // HANDLE: $(html) -> $(array) + if ( match[ 1 ] ) { + context = context instanceof jQuery ? context[ 0 ] : context; + + // Option to run scripts is true for back-compat + // Intentionally let the error be thrown if parseHTML is not present + jQuery.merge( this, jQuery.parseHTML( + match[ 1 ], + context && context.nodeType ? context.ownerDocument || context : document, + true + ) ); + + // HANDLE: $(html, props) + if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { + for ( match in context ) { + + // Properties of context are called as methods if possible + if ( jQuery.isFunction( this[ match ] ) ) { + this[ match ]( context[ match ] ); + + // ...and otherwise set as attributes + } else { + this.attr( match, context[ match ] ); + } + } + } + + return this; + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[ 2 ] ); + + if ( elem ) { + + // Inject the element directly into the jQuery object + this[ 0 ] = elem; + this.length = 1; + } + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || root ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(DOMElement) + } else if ( selector.nodeType ) { + this[ 0 ] = selector; + this.length = 1; + return this; + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return root.ready !== undefined ? + root.ready( selector ) : + + // Execute immediately if ready is not present + selector( jQuery ); + } + + return jQuery.makeArray( selector, this ); + }; + +// Give the init function the jQuery prototype for later instantiation +init.prototype = jQuery.fn; + +// Initialize central reference +rootjQuery = jQuery( document ); + +return init; + +} ); diff --git a/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/nodeName.js b/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/nodeName.js new file mode 100644 index 0000000..8a5f5f0 --- /dev/null +++ b/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/nodeName.js @@ -0,0 +1,13 @@ +define( function() { + +"use strict"; + +function nodeName( elem, name ) { + + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + +}; + +return nodeName; + +} ); diff --git a/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/parseHTML.js b/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/parseHTML.js new file mode 100644 index 0000000..21ff6bf --- /dev/null +++ b/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/parseHTML.js @@ -0,0 +1,65 @@ +define( [ + "../core", + "../var/document", + "./var/rsingleTag", + "../manipulation/buildFragment", + + // This is the only module that needs core/support + "./support" +], function( jQuery, document, rsingleTag, buildFragment, support ) { + +"use strict"; + +// Argument "data" should be string of html +// context (optional): If specified, the fragment will be created in this context, +// defaults to document +// keepScripts (optional): If true, will include scripts passed in the html string +jQuery.parseHTML = function( data, context, keepScripts ) { + if ( typeof data !== "string" ) { + return []; + } + if ( typeof context === "boolean" ) { + keepScripts = context; + context = false; + } + + var base, parsed, scripts; + + if ( !context ) { + + // Stop scripts or inline event handlers from being executed immediately + // by using document.implementation + if ( support.createHTMLDocument ) { + context = document.implementation.createHTMLDocument( "" ); + + // Set the base href for the created document + // so any parsed elements with URLs + // are based on the document's URL (gh-2965) + base = context.createElement( "base" ); + base.href = document.location.href; + context.head.appendChild( base ); + } else { + context = document; + } + } + + parsed = rsingleTag.exec( data ); + scripts = !keepScripts && []; + + // Single tag + if ( parsed ) { + return [ context.createElement( parsed[ 1 ] ) ]; + } + + parsed = buildFragment( [ data ], context, scripts ); + + if ( scripts && scripts.length ) { + jQuery( scripts ).remove(); + } + + return jQuery.merge( [], parsed.childNodes ); +}; + +return jQuery.parseHTML; + +} ); diff --git a/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/ready-no-deferred.js b/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/ready-no-deferred.js new file mode 100644 index 0000000..a7722ae --- /dev/null +++ b/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/ready-no-deferred.js @@ -0,0 +1,96 @@ +define( [ + "../core", + "../var/document" +], function( jQuery, document ) { + +"use strict"; + +var readyCallbacks = [], + whenReady = function( fn ) { + readyCallbacks.push( fn ); + }, + executeReady = function( fn ) { + + // Prevent errors from freezing future callback execution (gh-1823) + // Not backwards-compatible as this does not execute sync + window.setTimeout( function() { + fn.call( document, jQuery ); + } ); + }; + +jQuery.fn.ready = function( fn ) { + whenReady( fn ); + 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, + + 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; + } + + whenReady = function( fn ) { + readyCallbacks.push( fn ); + + while ( readyCallbacks.length ) { + fn = readyCallbacks.shift(); + if ( jQuery.isFunction( fn ) ) { + executeReady( fn ); + } + } + }; + + whenReady(); + } +} ); + +// Make jQuery.ready Promise consumable (gh-1778) +jQuery.ready.then = jQuery.fn.ready; + +/** + * 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: IE9-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 ); +} + +} ); diff --git a/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/ready.js b/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/ready.js new file mode 100644 index 0000000..794feee --- /dev/null +++ b/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 ); +} + +} ); diff --git a/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/readyException.js b/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/readyException.js new file mode 100644 index 0000000..72bdd90 --- /dev/null +++ b/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/readyException.js @@ -0,0 +1,13 @@ +define( [ + "../core" +], function( jQuery ) { + +"use strict"; + +jQuery.readyException = function( error ) { + window.setTimeout( function() { + throw error; + } ); +}; + +} ); diff --git a/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/stripAndCollapse.js b/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/stripAndCollapse.js new file mode 100644 index 0000000..ccad660 --- /dev/null +++ b/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/stripAndCollapse.js @@ -0,0 +1,14 @@ +define( [ + "../var/rnothtmlwhite" +], function( rnothtmlwhite ) { + "use strict"; + + // Strip and collapse whitespace according to HTML spec + // https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace + function stripAndCollapse( value ) { + var tokens = value.match( rnothtmlwhite ) || []; + return tokens.join( " " ); + } + + return stripAndCollapse; +} ); diff --git a/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/support.js b/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/support.js new file mode 100644 index 0000000..13ae02f --- /dev/null +++ b/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/support.js @@ -0,0 +1,20 @@ +define( [ + "../var/document", + "../var/support" +], function( document, support ) { + +"use strict"; + +// Support: Safari 8 only +// In Safari 8 documents created via document.implementation.createHTMLDocument +// collapse sibling forms: the second one becomes a child of the first one. +// Because of that, this security measure has to be disabled in Safari 8. +// https://bugs.webkit.org/show_bug.cgi?id=137337 +support.createHTMLDocument = ( function() { + var body = document.implementation.createHTMLDocument( "" ).body; + body.innerHTML = "<form></form><form></form>"; + return body.childNodes.length === 2; +} )(); + +return support; +} ); |