JQuery Mobile Alpha 4 upgrade; change all list items to be wrapped in an anchor tag as instructed
[busui.git] / js / jquery-1.5.js
blob:a/js/jquery-1.5.js -> blob:b/js/jquery-1.5.js
/*! /*!
* jQuery JavaScript Library v1.5 * jQuery JavaScript Library v1.5.2
* http://jquery.com/ * http://jquery.com/
* *
* Copyright 2011, John Resig * Copyright 2011, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses. * Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license * http://jquery.org/license
* *
* Includes Sizzle.js * Includes Sizzle.js
* http://sizzlejs.com/ * http://sizzlejs.com/
* Copyright 2011, The Dojo Foundation * Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses. * Released under the MIT, BSD, and GPL Licenses.
* *
* Date: Mon Jan 31 08:31:29 2011 -0500 * Date: Thu Mar 31 15:28:23 2011 -0400
*/ */
(function( window, undefined ) { (function( window, undefined ) {
   
// Use the correct document accordingly with window argument (sandbox) // Use the correct document accordingly with window argument (sandbox)
var document = window.document; var document = window.document;
var jQuery = (function() { var jQuery = (function() {
   
// Define a local copy of jQuery // Define a local copy of jQuery
var jQuery = function( selector, context ) { var jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced' // The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery ); return new jQuery.fn.init( selector, context, rootjQuery );
}, },
   
// Map over jQuery in case of overwrite // Map over jQuery in case of overwrite
_jQuery = window.jQuery, _jQuery = window.jQuery,
   
// Map over the $ in case of overwrite // Map over the $ in case of overwrite
_$ = window.$, _$ = window.$,
   
// A central reference to the root jQuery(document) // A central reference to the root jQuery(document)
rootjQuery, rootjQuery,
   
// A simple way to check for HTML strings or ID strings // A simple way to check for HTML strings or ID strings
// (both of which we optimize for) // (both of which we optimize for)
quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/, quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
   
// Check if a string has a non-whitespace character in it // Check if a string has a non-whitespace character in it
rnotwhite = /\S/, rnotwhite = /\S/,
   
// Used for trimming whitespace // Used for trimming whitespace
trimLeft = /^\s+/, trimLeft = /^\s+/,
trimRight = /\s+$/, trimRight = /\s+$/,
   
// Check for digits // Check for digits
rdigit = /\d/, rdigit = /\d/,
   
// Match a standalone tag // Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
   
// JSON RegExp // JSON RegExp
rvalidchars = /^[\],:{}\s]*$/, rvalidchars = /^[\],:{}\s]*$/,
rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
   
// Useragent RegExp // Useragent RegExp
rwebkit = /(webkit)[ \/]([\w.]+)/, rwebkit = /(webkit)[ \/]([\w.]+)/,
ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
rmsie = /(msie) ([\w.]+)/, rmsie = /(msie) ([\w.]+)/,
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
   
// Keep a UserAgent string for use with jQuery.browser // Keep a UserAgent string for use with jQuery.browser
userAgent = navigator.userAgent, userAgent = navigator.userAgent,
   
// For matching the engine and version of the browser // For matching the engine and version of the browser
browserMatch, browserMatch,
   
// Has the ready events already been bound?  
readyBound = false,  
   
// The deferred used on DOM ready // The deferred used on DOM ready
readyList, readyList,
   
// Promise methods  
promiseMethods = "then done fail isResolved isRejected promise".split( " " ),  
   
// The ready event handler // The ready event handler
DOMContentLoaded, DOMContentLoaded,
   
// Save a reference to some core methods // Save a reference to some core methods
toString = Object.prototype.toString, toString = Object.prototype.toString,
hasOwn = Object.prototype.hasOwnProperty, hasOwn = Object.prototype.hasOwnProperty,
push = Array.prototype.push, push = Array.prototype.push,
slice = Array.prototype.slice, slice = Array.prototype.slice,
trim = String.prototype.trim, trim = String.prototype.trim,
indexOf = Array.prototype.indexOf, indexOf = Array.prototype.indexOf,
   
// [[Class]] -> type pairs // [[Class]] -> type pairs
class2type = {}; class2type = {};
   
jQuery.fn = jQuery.prototype = { jQuery.fn = jQuery.prototype = {
constructor: jQuery, constructor: jQuery,
init: function( selector, context, rootjQuery ) { init: function( selector, context, rootjQuery ) {
var match, elem, ret, doc; var match, elem, ret, doc;
   
// Handle $(""), $(null), or $(undefined) // Handle $(""), $(null), or $(undefined)
if ( !selector ) { if ( !selector ) {
return this; return this;
} }
   
// Handle $(DOMElement) // Handle $(DOMElement)
if ( selector.nodeType ) { if ( selector.nodeType ) {
this.context = this[0] = selector; this.context = this[0] = selector;
this.length = 1; this.length = 1;
return this; return this;
} }
   
// The body element only exists once, optimize finding it // The body element only exists once, optimize finding it
if ( selector === "body" && !context && document.body ) { if ( selector === "body" && !context && document.body ) {
this.context = document; this.context = document;
this[0] = document.body; this[0] = document.body;
this.selector = "body"; this.selector = "body";
this.length = 1; this.length = 1;
return this; return this;
} }
   
// Handle HTML strings // Handle HTML strings
if ( typeof selector === "string" ) { if ( typeof selector === "string" ) {
// Are we dealing with HTML string or an ID? // Are we dealing with HTML string or an ID?
match = quickExpr.exec( selector ); match = quickExpr.exec( selector );
   
// Verify a match, and that no context was specified for #id // Verify a match, and that no context was specified for #id
if ( match && (match[1] || !context) ) { if ( match && (match[1] || !context) ) {
   
// HANDLE: $(html) -> $(array) // HANDLE: $(html) -> $(array)
if ( match[1] ) { if ( match[1] ) {
context = context instanceof jQuery ? context[0] : context; context = context instanceof jQuery ? context[0] : context;
doc = (context ? context.ownerDocument || context : document); doc = (context ? context.ownerDocument || context : document);
   
// If a single string is passed in and it's a single tag // If a single string is passed in and it's a single tag
// just do a createElement and skip the rest // just do a createElement and skip the rest
ret = rsingleTag.exec( selector ); ret = rsingleTag.exec( selector );
   
if ( ret ) { if ( ret ) {
if ( jQuery.isPlainObject( context ) ) { if ( jQuery.isPlainObject( context ) ) {
selector = [ document.createElement( ret[1] ) ]; selector = [ document.createElement( ret[1] ) ];
jQuery.fn.attr.call( selector, context, true ); jQuery.fn.attr.call( selector, context, true );
   
} else { } else {
selector = [ doc.createElement( ret[1] ) ]; selector = [ doc.createElement( ret[1] ) ];
} }
   
} else { } else {
ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes; selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes;
} }
   
return jQuery.merge( this, selector ); return jQuery.merge( this, selector );
   
// HANDLE: $("#id") // HANDLE: $("#id")
} else { } else {
elem = document.getElementById( match[2] ); elem = document.getElementById( match[2] );
   
// Check parentNode to catch when Blackberry 4.6 returns // Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963 // nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) { if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items // Handle the case where IE and Opera return items
// by name instead of ID // by name instead of ID
if ( elem.id !== match[2] ) { if ( elem.id !== match[2] ) {
return rootjQuery.find( selector ); return rootjQuery.find( selector );
} }
   
// Otherwise, we inject the element directly into the jQuery object // Otherwise, we inject the element directly into the jQuery object
this.length = 1; this.length = 1;
this[0] = elem; this[0] = elem;
} }
   
this.context = document; this.context = document;
this.selector = selector; this.selector = selector;
return this; return this;
} }
   
// HANDLE: $(expr, $(...)) // HANDLE: $(expr, $(...))
} else if ( !context || context.jquery ) { } else if ( !context || context.jquery ) {
return (context || rootjQuery).find( selector ); return (context || rootjQuery).find( selector );
   
// HANDLE: $(expr, context) // HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr) // (which is just equivalent to: $(context).find(expr)
} else { } else {
return this.constructor( context ).find( selector ); return this.constructor( context ).find( selector );
} }
   
// HANDLE: $(function) // HANDLE: $(function)
// Shortcut for document ready // Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) { } else if ( jQuery.isFunction( selector ) ) {
return rootjQuery.ready( selector ); return rootjQuery.ready( selector );
} }
   
if (selector.selector !== undefined) { if (selector.selector !== undefined) {
this.selector = selector.selector; this.selector = selector.selector;
this.context = selector.context; this.context = selector.context;
} }
   
return jQuery.makeArray( selector, this ); return jQuery.makeArray( selector, this );
}, },
   
// Start with an empty selector // Start with an empty selector
selector: "", selector: "",
   
// The current version of jQuery being used // The current version of jQuery being used
jquery: "1.5", jquery: "1.5.2",
   
// The default length of a jQuery object is 0 // The default length of a jQuery object is 0
length: 0, length: 0,
   
// The number of elements contained in the matched element set // The number of elements contained in the matched element set
size: function() { size: function() {
return this.length; return this.length;
}, },
   
toArray: function() { toArray: function() {
return slice.call( this, 0 ); return slice.call( this, 0 );
}, },
   
// Get the Nth element in the matched element set OR // Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array // Get the whole matched element set as a clean array
get: function( num ) { get: function( num ) {
return num == null ? return num == null ?
   
// Return a 'clean' array // Return a 'clean' array
this.toArray() : this.toArray() :
   
// Return just the object // Return just the object
( num < 0 ? this[ this.length + num ] : this[ num ] ); ( num < 0 ? this[ this.length + num ] : this[ num ] );
}, },
   
// Take an array of elements and push it onto the stack // Take an array of elements and push it onto the stack
// (returning the new matched element set) // (returning the new matched element set)
pushStack: function( elems, name, selector ) { pushStack: function( elems, name, selector ) {
// Build a new jQuery matched element set // Build a new jQuery matched element set
var ret = this.constructor(); var ret = this.constructor();
   
if ( jQuery.isArray( elems ) ) { if ( jQuery.isArray( elems ) ) {
push.apply( ret, elems ); push.apply( ret, elems );
   
} else { } else {
jQuery.merge( ret, elems ); jQuery.merge( ret, elems );
} }
   
// Add the old object onto the stack (as a reference) // Add the old object onto the stack (as a reference)
ret.prevObject = this; ret.prevObject = this;
   
ret.context = this.context; ret.context = this.context;
   
if ( name === "find" ) { if ( name === "find" ) {
ret.selector = this.selector + (this.selector ? " " : "") + selector; ret.selector = this.selector + (this.selector ? " " : "") + selector;
} else if ( name ) { } else if ( name ) {
ret.selector = this.selector + "." + name + "(" + selector + ")"; ret.selector = this.selector + "." + name + "(" + selector + ")";
} }
   
// Return the newly-formed element set // Return the newly-formed element set
return ret; return ret;
}, },
   
// Execute a callback for every element in the matched set. // Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is // (You can seed the arguments with an array of args, but this is
// only used internally.) // only used internally.)
each: function( callback, args ) { each: function( callback, args ) {
return jQuery.each( this, callback, args ); return jQuery.each( this, callback, args );
}, },
   
ready: function( fn ) { ready: function( fn ) {
// Attach the listeners // Attach the listeners
jQuery.bindReady(); jQuery.bindReady();
   
// Add the callback // Add the callback
readyList.done( fn ); readyList.done( fn );
   
return this; return this;
}, },
   
eq: function( i ) { eq: function( i ) {
return i === -1 ? return i === -1 ?
this.slice( i ) : this.slice( i ) :
this.slice( i, +i + 1 ); this.slice( i, +i + 1 );
}, },
   
first: function() { first: function() {
return this.eq( 0 ); return this.eq( 0 );
}, },
   
last: function() { last: function() {
return this.eq( -1 ); return this.eq( -1 );
}, },
   
slice: function() { slice: function() {
return this.pushStack( slice.apply( this, arguments ), return this.pushStack( slice.apply( this, arguments ),
"slice", slice.call(arguments).join(",") ); "slice", slice.call(arguments).join(",") );
}, },
   
map: function( callback ) { map: function( callback ) {
return this.pushStack( jQuery.map(this, function( elem, i ) { return this.pushStack( jQuery.map(this, function( elem, i ) {
return callback.call( elem, i, elem ); return callback.call( elem, i, elem );
})); }));
}, },
   
end: function() { end: function() {
return this.prevObject || this.constructor(null); return this.prevObject || this.constructor(null);
}, },
   
// For internal use only. // For internal use only.
// Behaves like an Array's method, not like a jQuery method. // Behaves like an Array's method, not like a jQuery method.
push: push, push: push,
sort: [].sort, sort: [].sort,
splice: [].splice splice: [].splice
}; };
   
// Give the init function the jQuery prototype for later instantiation // Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn; jQuery.fn.init.prototype = jQuery.fn;
   
jQuery.extend = jQuery.fn.extend = function() { jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone, var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {}, target = arguments[0] || {},
i = 1, i = 1,
length = arguments.length, length = arguments.length,
deep = false; deep = false;
   
// Handle a deep copy situation // Handle a deep copy situation
if ( typeof target === "boolean" ) { if ( typeof target === "boolean" ) {
deep = target; deep = target;
target = arguments[1] || {}; target = arguments[1] || {};
// skip the boolean and the target // skip the boolean and the target
i = 2; i = 2;
} }
   
// Handle case when target is a string or something (possible in deep copy) // Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction(target) ) { if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
target = {}; target = {};
} }
   
// extend jQuery itself if only one argument is passed // extend jQuery itself if only one argument is passed
if ( length === i ) { if ( length === i ) {
target = this; target = this;
--i; --i;
} }
   
for ( ; i < length; i++ ) { for ( ; i < length; i++ ) {
// Only deal with non-null/undefined values // Only deal with non-null/undefined values
if ( (options = arguments[ i ]) != null ) { if ( (options = arguments[ i ]) != null ) {
// Extend the base object // Extend the base object
for ( name in options ) { for ( name in options ) {
src = target[ name ]; src = target[ name ];
copy = options[ name ]; copy = options[ name ];
   
// Prevent never-ending loop // Prevent never-ending loop
if ( target === copy ) { if ( target === copy ) {
continue; continue;
} }
   
// Recurse if we're merging plain objects or arrays // Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
if ( copyIsArray ) { if ( copyIsArray ) {
copyIsArray = false; copyIsArray = false;
clone = src && jQuery.isArray(src) ? src : []; clone = src && jQuery.isArray(src) ? src : [];
   
} else { } else {
clone = src && jQuery.isPlainObject(src) ? src : {}; clone = src && jQuery.isPlainObject(src) ? src : {};
} }
   
// Never move original objects, clone them // Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy ); target[ name ] = jQuery.extend( deep, clone, copy );
   
// Don't bring in undefined values // Don't bring in undefined values
} else if ( copy !== undefined ) { } else if ( copy !== undefined ) {
target[ name ] = copy; target[ name ] = copy;
} }
} }
} }
} }
   
// Return the modified object // Return the modified object
return target; return target;
}; };
   
jQuery.extend({ jQuery.extend({
noConflict: function( deep ) { noConflict: function( deep ) {
window.$ = _$; window.$ = _$;
   
if ( deep ) { if ( deep ) {
window.jQuery = _jQuery; window.jQuery = _jQuery;
} }
   
return jQuery; return jQuery;
}, },
   
// Is the DOM ready to be used? Set to true once it occurs. // Is the DOM ready to be used? Set to true once it occurs.
isReady: false, isReady: false,
   
// A counter to track how many items to wait for before // A counter to track how many items to wait for before
// the ready event fires. See #6781 // the ready event fires. See #6781
readyWait: 1, readyWait: 1,
   
// Handle when the DOM is ready // Handle when the DOM is ready
ready: function( wait ) { ready: function( wait ) {
// A third-party is pushing the ready event forwards // A third-party is pushing the ready event forwards
if ( wait === true ) { if ( wait === true ) {
jQuery.readyWait--; jQuery.readyWait--;
} }
   
// Make sure that the DOM is not already loaded // Make sure that the DOM is not already loaded
if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) { if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) {
// Make sure body exists, at