diff options
Diffstat (limited to 'bower_components/jquery/src/core')
| -rw-r--r-- | bower_components/jquery/src/core/access.js | 60 | ||||
| -rw-r--r-- | bower_components/jquery/src/core/init.js | 123 | ||||
| -rw-r--r-- | bower_components/jquery/src/core/parseHTML.js | 39 | ||||
| -rw-r--r-- | bower_components/jquery/src/core/ready.js | 97 | ||||
| -rw-r--r-- | bower_components/jquery/src/core/var/rsingleTag.js | 4 | 
5 files changed, 323 insertions, 0 deletions
| diff --git a/bower_components/jquery/src/core/access.js b/bower_components/jquery/src/core/access.js new file mode 100644 index 0000000..b6110c8 --- /dev/null +++ b/bower_components/jquery/src/core/access.js @@ -0,0 +1,60 @@ +define([ +	"../core" +], function( jQuery ) { + +// Multifunctional method to get and set values of a collection +// The value/s can optionally be executed if it's a function +var access = jQuery.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 ) { +			jQuery.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 ) ) ); +			} +		} +	} + +	return chainable ? +		elems : + +		// Gets +		bulk ? +			fn.call( elems ) : +			len ? fn( elems[0], key ) : emptyGet; +}; + +return access; + +}); diff --git a/bower_components/jquery/src/core/init.js b/bower_components/jquery/src/core/init.js new file mode 100644 index 0000000..daf5d19 --- /dev/null +++ b/bower_components/jquery/src/core/init.js @@ -0,0 +1,123 @@ +// Initialize a jQuery object +define([ +	"../core", +	"./var/rsingleTag", +	"../traversing/findFilter" +], function( jQuery, rsingleTag ) { + +// 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 <) +	rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, + +	init = jQuery.fn.init = function( selector, context ) { +		var match, elem; + +		// HANDLE: $(""), $(null), $(undefined), $(false) +		if ( !selector ) { +			return this; +		} + +		// 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; + +					// 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] ); + +					// Check parentNode to catch when Blackberry 4.6 returns +					// nodes that are no longer in the document #6963 +					if ( elem && elem.parentNode ) { +						// Inject the element directly into the jQuery object +						this.length = 1; +						this[0] = elem; +					} + +					this.context = document; +					this.selector = selector; +					return this; +				} + +			// HANDLE: $(expr, $(...)) +			} else if ( !context || context.jquery ) { +				return ( context || rootjQuery ).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.context = this[0] = selector; +			this.length = 1; +			return this; + +		// HANDLE: $(function) +		// Shortcut for document ready +		} else if ( jQuery.isFunction( selector ) ) { +			return typeof rootjQuery.ready !== "undefined" ? +				rootjQuery.ready( selector ) : +				// Execute immediately if ready is not present +				selector( jQuery ); +		} + +		if ( selector.selector !== undefined ) { +			this.selector = selector.selector; +			this.context = selector.context; +		} + +		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/bower_components/jquery/src/core/parseHTML.js b/bower_components/jquery/src/core/parseHTML.js new file mode 100644 index 0000000..64cf2a1 --- /dev/null +++ b/bower_components/jquery/src/core/parseHTML.js @@ -0,0 +1,39 @@ +define([ +	"../core", +	"./var/rsingleTag", +	"../manipulation" // buildFragment +], function( jQuery, rsingleTag ) { + +// data: 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 ( !data || typeof data !== "string" ) { +		return null; +	} +	if ( typeof context === "boolean" ) { +		keepScripts = context; +		context = false; +	} +	context = context || document; + +	var parsed = rsingleTag.exec( data ), +		scripts = !keepScripts && []; + +	// Single tag +	if ( parsed ) { +		return [ context.createElement( parsed[1] ) ]; +	} + +	parsed = jQuery.buildFragment( [ data ], context, scripts ); + +	if ( scripts && scripts.length ) { +		jQuery( scripts ).remove(); +	} + +	return jQuery.merge( [], parsed.childNodes ); +}; + +return jQuery.parseHTML; + +}); diff --git a/bower_components/jquery/src/core/ready.js b/bower_components/jquery/src/core/ready.js new file mode 100644 index 0000000..122b161 --- /dev/null +++ b/bower_components/jquery/src/core/ready.js @@ -0,0 +1,97 @@ +define([ +	"../core", +	"../core/init", +	"../deferred" +], function( jQuery ) { + +// The deferred used on DOM ready +var readyList; + +jQuery.fn.ready = function( fn ) { +	// Add the callback +	jQuery.ready.promise().done( 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, + +	// Hold (or release) the ready event +	holdReady: function( hold ) { +		if ( hold ) { +			jQuery.readyWait++; +		} else { +			jQuery.ready( true ); +		} +	}, + +	// 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 ] ); + +		// Trigger any bound ready events +		if ( jQuery.fn.triggerHandler ) { +			jQuery( document ).triggerHandler( "ready" ); +			jQuery( document ).off( "ready" ); +		} +	} +}); + +/** + * The ready event handler and self cleanup method + */ +function completed() { +	document.removeEventListener( "DOMContentLoaded", completed, false ); +	window.removeEventListener( "load", completed, false ); +	jQuery.ready(); +} + +jQuery.ready.promise = function( obj ) { +	if ( !readyList ) { + +		readyList = jQuery.Deferred(); + +		// Catch cases where $(document).ready() is called after the browser event has already occurred. +		// we once tried to use readyState "interactive" here, but it caused issues like the one +		// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 +		if ( document.readyState === "complete" ) { +			// Handle it asynchronously to allow scripts the opportunity to delay ready +			setTimeout( jQuery.ready ); + +		} else { + +			// Use the handy event callback +			document.addEventListener( "DOMContentLoaded", completed, false ); + +			// A fallback to window.onload, that will always work +			window.addEventListener( "load", completed, false ); +		} +	} +	return readyList.promise( obj ); +}; + +// Kick off the DOM ready check even if the user does not +jQuery.ready.promise(); + +}); diff --git a/bower_components/jquery/src/core/var/rsingleTag.js b/bower_components/jquery/src/core/var/rsingleTag.js new file mode 100644 index 0000000..7e7090b --- /dev/null +++ b/bower_components/jquery/src/core/var/rsingleTag.js @@ -0,0 +1,4 @@ +define(function() { +	// Match a standalone tag +	return (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); +}); | 
