Revision 82e47ae0
Added by Amos Benari about 12 years ago
- ID 82e47ae0f86994702c3a084cc6150250a81034ee
public/javascripts/jquery.js | ||
---|---|---|
/*!
|
||
* jQuery JavaScript Library v1.6.4
|
||
* http://jquery.com/
|
||
*
|
||
* Copyright 2011, John Resig
|
||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||
* http://jquery.org/license
|
||
*
|
||
* Includes Sizzle.js
|
||
* http://sizzlejs.com/
|
||
* Copyright 2011, The Dojo Foundation
|
||
* Released under the MIT, BSD, and GPL Licenses.
|
||
*
|
||
* Date: Mon Sep 12 18:54:48 2011 -0400
|
||
*/
|
||
(function( window, undefined ) {
|
||
|
||
// Use the correct document accordingly with window argument (sandbox)
|
||
var document = window.document,
|
||
navigator = window.navigator,
|
||
location = window.location;
|
||
var jQuery = (function() {
|
||
|
||
// Define a local copy of jQuery
|
||
var jQuery = function( selector, context ) {
|
||
// The jQuery object is actually just the init constructor 'enhanced'
|
||
return new jQuery.fn.init( selector, context, rootjQuery );
|
||
},
|
||
|
||
// Map over jQuery in case of overwrite
|
||
_jQuery = window.jQuery,
|
||
|
||
// Map over the $ in case of overwrite
|
||
_$ = window.$,
|
||
|
||
// A central reference to the root jQuery(document)
|
||
rootjQuery,
|
||
|
||
// A simple way to check for HTML strings or ID strings
|
||
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
|
||
quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
|
||
|
||
// Check if a string has a non-whitespace character in it
|
||
rnotwhite = /\S/,
|
||
|
||
// Used for trimming whitespace
|
||
trimLeft = /^\s+/,
|
||
trimRight = /\s+$/,
|
||
|
||
// Check for digits
|
||
rdigit = /\d/,
|
||
|
||
// Match a standalone tag
|
||
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
|
||
|
||
// JSON RegExp
|
||
rvalidchars = /^[\],:{}\s]*$/,
|
||
rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
|
||
rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
|
||
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
|
||
|
||
// Useragent RegExp
|
||
rwebkit = /(webkit)[ \/]([\w.]+)/,
|
||
ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
|
||
rmsie = /(msie) ([\w.]+)/,
|
||
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
|
||
|
||
// Matches dashed string for camelizing
|
||
rdashAlpha = /-([a-z]|[0-9])/ig,
|
||
rmsPrefix = /^-ms-/,
|
||
|
||
// Used by jQuery.camelCase as callback to replace()
|
||
fcamelCase = function( all, letter ) {
|
||
return ( letter + "" ).toUpperCase();
|
||
},
|
||
|
||
// Keep a UserAgent string for use with jQuery.browser
|
||
userAgent = navigator.userAgent,
|
||
|
||
// For matching the engine and version of the browser
|
||
browserMatch,
|
||
|
||
// The deferred used on DOM ready
|
||
readyList,
|
||
|
||
// The ready event handler
|
||
DOMContentLoaded,
|
||
|
||
// Save a reference to some core methods
|
||
toString = Object.prototype.toString,
|
||
hasOwn = Object.prototype.hasOwnProperty,
|
||
push = Array.prototype.push,
|
||
slice = Array.prototype.slice,
|
||
trim = String.prototype.trim,
|
||
indexOf = Array.prototype.indexOf,
|
||
|
||
// [[Class]] -> type pairs
|
||
class2type = {};
|
||
|
||
jQuery.fn = jQuery.prototype = {
|
||
constructor: jQuery,
|
||
init: function( selector, context, rootjQuery ) {
|
||
var match, elem, ret, doc;
|
||
|
||
// Handle $(""), $(null), or $(undefined)
|
||
if ( !selector ) {
|
||
return this;
|
||
}
|
||
|
||
// Handle $(DOMElement)
|
||
if ( selector.nodeType ) {
|
||
this.context = this[0] = selector;
|
||
this.length = 1;
|
||
return this;
|
||
}
|
||
|
||
// The body element only exists once, optimize finding it
|
||
if ( selector === "body" && !context && document.body ) {
|
||
this.context = document;
|
||
this[0] = document.body;
|
||
this.selector = selector;
|
||
this.length = 1;
|
||
return this;
|
||
}
|
||
|
||
// Handle HTML strings
|
||
if ( typeof selector === "string" ) {
|
||
// Are we dealing with HTML string or an ID?
|
||
if ( selector.charAt(0) === "<" && selector.charAt( 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 = quickExpr.exec( selector );
|
||
}
|
||
|
||
// Verify a match, and that no context was specified for #id
|
||
if ( match && (match[1] || !context) ) {
|
||
|
||
// HANDLE: $(html) -> $(array)
|
||
if ( match[1] ) {
|
||
context = context instanceof jQuery ? context[0] : context;
|
||
doc = (context ? context.ownerDocument || context : document);
|
||
|
||
// If a single string is passed in and it's a single tag
|
||
// just do a createElement and skip the rest
|
||
ret = rsingleTag.exec( selector );
|
||
|
||
if ( ret ) {
|
||
if ( jQuery.isPlainObject( context ) ) {
|
||
selector = [ document.createElement( ret[1] ) ];
|
||
jQuery.fn.attr.call( selector, context, true );
|
||
|
||
} else {
|
||
selector = [ doc.createElement( ret[1] ) ];
|
||
}
|
||
|
||
} else {
|
||
ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
|
||
selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes;
|
||
}
|
||
|
||
return jQuery.merge( this, selector );
|
||
|
||
// 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 ) {
|
||
// Handle the case where IE and Opera return items
|
||
// by name instead of ID
|
||
if ( elem.id !== match[2] ) {
|
||
return rootjQuery.find( selector );
|
||
}
|
||
|
||
// Otherwise, we 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: $(function)
|
||
// Shortcut for document ready
|
||
} else if ( jQuery.isFunction( selector ) ) {
|
||
return rootjQuery.ready( selector );
|
||
}
|
||
|
||
if (selector.selector !== undefined) {
|
||
this.selector = selector.selector;
|
||
this.context = selector.context;
|
||
}
|
||
|
||
return jQuery.makeArray( selector, this );
|
||
},
|
||
|
||
// Start with an empty selector
|
||
selector: "",
|
||
|
||
// The current version of jQuery being used
|
||
jquery: "1.6.4",
|
||
|
||
// The default length of a jQuery object is 0
|
||
length: 0,
|
||
|
||
// The number of elements contained in the matched element set
|
||
size: function() {
|
||
return this.length;
|
||
},
|
||
|
||
toArray: function() {
|
||
return slice.call( this, 0 );
|
||
},
|
||
|
||
// Get the Nth element in the matched element set OR
|
||
// Get the whole matched element set as a clean array
|
||
get: function( num ) {
|
||
return num == null ?
|
||
|
||
// Return a 'clean' array
|
||
this.toArray() :
|
||
|
||
// Return just the object
|
||
( num < 0 ? this[ this.length + num ] : this[ num ] );
|
||
},
|
||
|
||
// Take an array of elements and push it onto the stack
|
||
// (returning the new matched element set)
|
||
pushStack: function( elems, name, selector ) {
|
||
// Build a new jQuery matched element set
|
||
var ret = this.constructor();
|
||
|
||
if ( jQuery.isArray( elems ) ) {
|
||
push.apply( ret, elems );
|
||
|
||
} else {
|
||
jQuery.merge( ret, elems );
|
||
}
|
||
|
||
// Add the old object onto the stack (as a reference)
|
||
ret.prevObject = this;
|
||
|
||
ret.context = this.context;
|
||
|
||
if ( name === "find" ) {
|
||
ret.selector = this.selector + (this.selector ? " " : "") + selector;
|
||
} else if ( name ) {
|
||
ret.selector = this.selector + "." + name + "(" + selector + ")";
|
||
}
|
||
|
||
// Return the newly-formed element set
|
||
return ret;
|
||
},
|
||
|
||
// Execute a callback for every element in the matched set.
|
||
// (You can seed the arguments with an array of args, but this is
|
||
// only used internally.)
|
||
each: function( callback, args ) {
|
||
return jQuery.each( this, callback, args );
|
||
},
|
||
|
||
ready: function( fn ) {
|
||
// Attach the listeners
|
||
jQuery.bindReady();
|
||
|
||
// Add the callback
|
||
readyList.done( fn );
|
||
|
||
return this;
|
||
},
|
||
|
||
eq: function( i ) {
|
||
return i === -1 ?
|
||
this.slice( i ) :
|
||
this.slice( i, +i + 1 );
|
||
},
|
||
|
||
first: function() {
|
||
return this.eq( 0 );
|
||
},
|
||
|
||
last: function() {
|
||
return this.eq( -1 );
|
||
},
|
||
|
||
slice: function() {
|
||
return this.pushStack( slice.apply( this, arguments ),
|
||
"slice", slice.call(arguments).join(",") );
|
||
},
|
||
|
||
map: function( callback ) {
|
||
return this.pushStack( jQuery.map(this, function( elem, i ) {
|
||
return callback.call( elem, i, elem );
|
||
}));
|
||
},
|
||
|
||
end: function() {
|
||
return this.prevObject || this.constructor(null);
|
||
},
|
||
|
||
// For internal use only.
|
||
// Behaves like an Array's method, not like a jQuery method.
|
||
push: push,
|
||
sort: [].sort,
|
||
splice: [].splice
|
||
};
|
||
|
||
// Give the init function the jQuery prototype for later instantiation
|
||
jQuery.fn.init.prototype = jQuery.fn;
|
||
|
||
jQuery.extend = jQuery.fn.extend = function() {
|
||
var options, name, src, copy, copyIsArray, clone,
|
||
target = arguments[0] || {},
|
||
i = 1,
|
||
length = arguments.length,
|
||
deep = false;
|
||
|
||
// Handle a deep copy situation
|
||
if ( typeof target === "boolean" ) {
|
||
deep = target;
|
||
target = arguments[1] || {};
|
||
// skip the boolean and the target
|
||
i = 2;
|
||
}
|
||
|
||
// Handle case when target is a string or something (possible in deep copy)
|
||
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
|
||
target = {};
|
||
}
|
||
|
||
// extend jQuery itself if only one argument is passed
|
||
if ( length === i ) {
|
||
target = this;
|
||
--i;
|
||
}
|
||
|
||
for ( ; i < length; i++ ) {
|
||
// Only deal with non-null/undefined values
|
||
if ( (options = arguments[ i ]) != null ) {
|
||
// Extend the base object
|
||
for ( name in options ) {
|
||
src = target[ name ];
|
||
copy = options[ name ];
|
||
|
||
// Prevent never-ending loop
|
||
if ( target === copy ) {
|
||
continue;
|
||
}
|
||
|
||
// Recurse if we're merging plain objects or arrays
|
||
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
|
||
if ( copyIsArray ) {
|
||
copyIsArray = false;
|
||
clone = src && jQuery.isArray(src) ? src : [];
|
||
|
||
} else {
|
||
clone = src && jQuery.isPlainObject(src) ? src : {};
|
||
}
|
||
|
||
// Never move original objects, clone them
|
||
target[ name ] = jQuery.extend( deep, clone, copy );
|
||
|
||
// Don't bring in undefined values
|
||
} else if ( copy !== undefined ) {
|
||
target[ name ] = copy;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// Return the modified object
|
||
return target;
|
||
};
|
||
|
||
jQuery.extend({
|
||
noConflict: function( deep ) {
|
||
if ( window.$ === jQuery ) {
|
||
window.$ = _$;
|
||
}
|
||
|
||
if ( deep && window.jQuery === jQuery ) {
|
||
window.jQuery = _jQuery;
|
||
}
|
||
|
||
return jQuery;
|
||
},
|
||
|
||
// 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 ) {
|
||
// Either a released hold or an DOMready/load event and not yet ready
|
||
if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
|
||
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
|
||
if ( !document.body ) {
|
||
return setTimeout( jQuery.ready, 1 );
|
||
}
|
||
|
||
// 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.trigger ) {
|
||
jQuery( document ).trigger( "ready" ).unbind( "ready" );
|
||
}
|
||
}
|
||
},
|
||
|
||
bindReady: function() {
|
||
if ( readyList ) {
|
||
return;
|
||
}
|
||
|
||
readyList = jQuery._Deferred();
|
||
|
||
// Catch cases where $(document).ready() is called after the
|
||
// browser event has already occurred.
|
||
if ( document.readyState === "complete" ) {
|
||
// Handle it asynchronously to allow scripts the opportunity to delay ready
|
||
return setTimeout( jQuery.ready, 1 );
|
||
}
|
||
|
||
// Mozilla, Opera and webkit nightlies currently support this event
|
||
if ( document.addEventListener ) {
|
||
// Use the handy event callback
|
||
document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
|
||
|
||
// A fallback to window.onload, that will always work
|
||
window.addEventListener( "load", jQuery.ready, false );
|
||
|
||
// If IE event model is used
|
||
} else if ( document.attachEvent ) {
|
||
// ensure firing before onload,
|
||
// maybe late but safe also for iframes
|
||
document.attachEvent( "onreadystatechange", DOMContentLoaded );
|
||
|
||
// A fallback to window.onload, that will always work
|
||
window.attachEvent( "onload", jQuery.ready );
|
||
|
||
// If IE and not a frame
|
||
// continually check to see if the document is ready
|
||
var toplevel = false;
|
||
|
||
try {
|
||
toplevel = window.frameElement == null;
|
||
} catch(e) {}
|
||
|
||
if ( document.documentElement.doScroll && toplevel ) {
|
||
doScrollCheck();
|
||
}
|
||
}
|
||
},
|
||
|
||
// See test/unit/core.js for details concerning isFunction.
|
||
// Since version 1.3, DOM methods and functions like alert
|
||
// aren't supported. They return false on IE (#2968).
|
||
isFunction: function( obj ) {
|
||
return jQuery.type(obj) === "function";
|
||
},
|
||
|
||
isArray: Array.isArray || function( obj ) {
|
||
return jQuery.type(obj) === "array";
|
||
},
|
||
|
||
// A crude way of determining if an object is a window
|
||
isWindow: function( obj ) {
|
||
return obj && typeof obj === "object" && "setInterval" in obj;
|
||
},
|
||
|
||
isNaN: function( obj ) {
|
||
return obj == null || !rdigit.test( obj ) || isNaN( obj );
|
||
},
|
||
|
||
type: function( obj ) {
|
||
return obj == null ?
|
||
String( obj ) :
|
||
class2type[ toString.call(obj) ] || "object";
|
||
},
|
||
|
||
isPlainObject: function( obj ) {
|
||
// Must be an Object.
|
||
// Because of IE, we also have to check the presence of the constructor property.
|
||
// Make sure that DOM nodes and window objects don't pass through, as well
|
||
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
|
||
return false;
|
||
}
|
||
|
||
try {
|
||
// Not own constructor property must be Object
|
||
if ( obj.constructor &&
|
||
!hasOwn.call(obj, "constructor") &&
|
||
!hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
|
||
return false;
|
||
}
|
||
} catch ( e ) {
|
||
// IE8,9 Will throw exceptions on certain host objects #9897
|
||
return false;
|
||
}
|
||
|
||
// Own properties are enumerated firstly, so to speed up,
|
||
// if last one is own, then all properties are own.
|
||
|
||
var key;
|
||
for ( key in obj ) {}
|
||
|
||
return key === undefined || hasOwn.call( obj, key );
|
||
},
|
||
|
||
isEmptyObject: function( obj ) {
|
||
for ( var name in obj ) {
|
||
return false;
|
||
}
|
||
return true;
|
||
},
|
||
|
||
error: function( msg ) {
|
||
throw msg;
|
||
},
|
||
|
||
parseJSON: function( data ) {
|
||
if ( typeof data !== "string" || !data ) {
|
||
return null;
|
||
}
|
||
|
||
// Make sure leading/trailing whitespace is removed (IE can't handle it)
|
||
data = jQuery.trim( data );
|
||
|
||
// Attempt to parse using the native JSON parser first
|
||
if ( window.JSON && window.JSON.parse ) {
|
||
return window.JSON.parse( data );
|
||
}
|
||
|
||
// Make sure the incoming data is actual JSON
|
||
// Logic borrowed from http://json.org/json2.js
|
||
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
|
||
.replace( rvalidtokens, "]" )
|
||
.replace( rvalidbraces, "")) ) {
|
||
|
||
return (new Function( "return " + data ))();
|
||
|
||
}
|
||
jQuery.error( "Invalid JSON: " + data );
|
||
},
|
||
|
||
// Cross-browser xml parsing
|
||
parseXML: function( data ) {
|
||
var xml, tmp;
|
||
try {
|
||
if ( window.DOMParser ) { // Standard
|
||
tmp = new DOMParser();
|
||
xml = tmp.parseFromString( data , "text/xml" );
|
||
} else { // IE
|
||
xml = new ActiveXObject( "Microsoft.XMLDOM" );
|
||
xml.async = "false";
|
||
xml.loadXML( data );
|
||
}
|
||
} catch( e ) {
|
||
xml = undefined;
|
||
}
|
||
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
|
||
jQuery.error( "Invalid XML: " + data );
|
||
}
|
||
return xml;
|
||
},
|
||
|
||
noop: function() {},
|
||
|
||
// Evaluates a script in a global context
|
||
// Workarounds based on findings by Jim Driscoll
|
||
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
|
||
globalEval: function( data ) {
|
||
if ( data && rnotwhite.test( data ) ) {
|
||
// We use execScript on Internet Explorer
|
||
// We use an anonymous function so that context is window
|
||
// rather than jQuery in Firefox
|
||
( window.execScript || function( data ) {
|
||
window[ "eval" ].call( window, data );
|
||
} )( data );
|
||
}
|
||
},
|
||
|
||
// Convert dashed to camelCase; used by the css and data modules
|
||
// Microsoft forgot to hump their vendor prefix (#9572)
|
||
camelCase: function( string ) {
|
||
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
|
||
},
|
||
|
||
nodeName: function( elem, name ) {
|
||
return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
|
||
},
|
||
|
||
// args is for internal usage only
|
||
each: function( object, callback, args ) {
|
||
var name, i = 0,
|
||
length = object.length,
|
||
isObj = length === undefined || jQuery.isFunction( object );
|
||
|
||
if ( args ) {
|
||
if ( isObj ) {
|
||
for ( name in object ) {
|
||
if ( callback.apply( object[ name ], args ) === false ) {
|
||
break;
|
||
}
|
||
}
|
||
} else {
|
||
for ( ; i < length; ) {
|
||
if ( callback.apply( object[ i++ ], args ) === false ) {
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
// A special, fast, case for the most common use of each
|
||
} else {
|
||
if ( isObj ) {
|
||
for ( name in object ) {
|
||
if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
|
||
break;
|
||
}
|
||
}
|
||
} else {
|
||
for ( ; i < length; ) {
|
||
if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
return object;
|
||
},
|
||
|
||
// Use native String.trim function wherever possible
|
||
trim: trim ?
|
||
function( text ) {
|
||
return text == null ?
|
||
"" :
|
||
trim.call( text );
|
||
} :
|
||
|
||
// Otherwise use our own trimming functionality
|
||
function( text ) {
|
||
return text == null ?
|
||
"" :
|
||
text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
|
||
},
|
||
|
||
// results is for internal usage only
|
||
makeArray: function( array, results ) {
|
||
var ret = results || [];
|
||
|
||
if ( array != null ) {
|
||
// The window, strings (and functions) also have 'length'
|
||
// The extra typeof function check is to prevent crashes
|
||
// in Safari 2 (See: #3039)
|
||
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
|
||
var type = jQuery.type( array );
|
||
|
||
if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
|
||
push.call( ret, array );
|
||
} else {
|
||
jQuery.merge( ret, array );
|
||
}
|
||
}
|
||
|
||
return ret;
|
||
},
|
||
|
||
inArray: function( elem, array ) {
|
||
if ( !array ) {
|
||
return -1;
|
||
}
|
||
|
||
if ( indexOf ) {
|
||
return indexOf.call( array, elem );
|
||
}
|
||
|
||
for ( var i = 0, length = array.length; i < length; i++ ) {
|
||
if ( array[ i ] === elem ) {
|
||
return i;
|
||
}
|
||
}
|
||
|
||
return -1;
|
||
},
|
||
|
||
merge: function( first, second ) {
|
||
var i = first.length,
|
||
j = 0;
|
||
|
||
if ( typeof second.length === "number" ) {
|
||
for ( var l = second.length; j < l; j++ ) {
|
||
first[ i++ ] = second[ j ];
|
||
}
|
||
|
||
} else {
|
||
while ( second[j] !== undefined ) {
|
||
first[ i++ ] = second[ j++ ];
|
||
}
|
||
}
|
||
|
||
first.length = i;
|
||
|
||
return first;
|
||
},
|
||
|
||
grep: function( elems, callback, inv ) {
|
||
var ret = [], retVal;
|
||
inv = !!inv;
|
||
|
||
// Go through the array, only saving the items
|
||
// that pass the validator function
|
||
for ( var i = 0, length = elems.length; i < length; i++ ) {
|
||
retVal = !!callback( elems[ i ], i );
|
||
if ( inv !== retVal ) {
|
||
ret.push( elems[ i ] );
|
||
}
|
||
}
|
||
|
||
return ret;
|
||
},
|
||
|
||
// arg is for internal usage only
|
||
map: function( elems, callback, arg ) {
|
||
var value, key, ret = [],
|
||
i = 0,
|
||
length = elems.length,
|
||
// jquery objects are treated as arrays
|
||
isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
|
||
|
||
// Go through the array, translating each of the items to their
|
||
if ( isArray ) {
|
||
for ( ; i < length; i++ ) {
|
||
value = callback( elems[ i ], i, arg );
|
||
|
||
if ( value != null ) {
|
||
ret[ ret.length ] = value;
|
||
}
|
||
}
|
||
|
||
// Go through every key on the object,
|
||
} else {
|
||
for ( key in elems ) {
|
||
value = callback( elems[ key ], key, arg );
|
||
|
||
if ( value != null ) {
|
||
ret[ ret.length ] = value;
|
||
}
|
||
}
|
||
}
|
||
|
||
// Flatten any nested arrays
|
||
return ret.concat.apply( [], ret );
|
||
},
|
||
|
||
// A global GUID counter for objects
|
||
guid: 1,
|
||
|
||
// Bind a function to a context, optionally partially applying any
|
||
// arguments.
|
||
proxy: function( fn, context ) {
|
||
if ( typeof context === "string" ) {
|
||
var tmp = fn[ context ];
|
||
context = fn;
|
||
fn = tmp;
|
||
}
|
||
|
||
// Quick check to determine if target is callable, in the spec
|
||
// this throws a TypeError, but we will just return undefined.
|
||
if ( !jQuery.isFunction( fn ) ) {
|
||
return undefined;
|
||
}
|
||
|
||
// Simulated bind
|
||
var args = slice.call( arguments, 2 ),
|
||
proxy = function() {
|
||
return fn.apply( context, args.concat( slice.call( arguments ) ) );
|
||
};
|
||
|
||
// Set the guid of unique handler to the same of original handler, so it can be removed
|
||
proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
|
||
|
||
return proxy;
|
||
},
|
||
|
||
// Mutifunctional method to get and set values to a collection
|
||
// The value/s can optionally be executed if it's a function
|
||
access: function( elems, key, value, exec, fn, pass ) {
|
||
var length = elems.length;
|
||
|
||
// Setting many attributes
|
||
if ( typeof key === "object" ) {
|
||
for ( var k in key ) {
|
||
jQuery.access( elems, k, key[k], exec, fn, value );
|
||
}
|
||
return elems;
|
||
}
|
||
|
||
// Setting one attribute
|
||
if ( value !== undefined ) {
|
||
// Optionally, function values get executed if exec is true
|
||
exec = !pass && exec && jQuery.isFunction(value);
|
||
|
||
for ( var i = 0; i < length; i++ ) {
|
||
fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
|
||
}
|
||
|
||
return elems;
|
||
}
|
||
|
||
// Getting an attribute
|
||
return length ? fn( elems[0], key ) : undefined;
|
||
},
|
||
|
||
now: function() {
|
||
return (new Date()).getTime();
|
||
},
|
||
|
||
// Use of jQuery.browser is frowned upon.
|
||
// More details: http://docs.jquery.com/Utilities/jQuery.browser
|
||
uaMatch: function( ua ) {
|
||
ua = ua.toLowerCase();
|
||
|
||
var match = rwebkit.exec( ua ) ||
|
||
ropera.exec( ua ) ||
|
||
rmsie.exec( ua ) ||
|
||
ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
|
||
[];
|
||
|
||
return { browser: match[1] || "", version: match[2] || "0" };
|
||
},
|
||
|
||
sub: function() {
|
||
function jQuerySub( selector, context ) {
|
||
return new jQuerySub.fn.init( selector, context );
|
||
}
|
||
jQuery.extend( true, jQuerySub, this );
|
||
jQuerySub.superclass = this;
|
||
jQuerySub.fn = jQuerySub.prototype = this();
|
||
jQuerySub.fn.constructor = jQuerySub;
|
||
jQuerySub.sub = this.sub;
|
||
jQuerySub.fn.init = function init( selector, context ) {
|
||
if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
|
||
context = jQuerySub( context );
|
||
}
|
||
|
||
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
|
||
};
|
||
jQuerySub.fn.init.prototype = jQuerySub.fn;
|
||
var rootjQuerySub = jQuerySub(document);
|
||
return jQuerySub;
|
||
},
|
||
|
||
browser: {}
|
||
});
|
||
|
||
// Populate the class2type map
|
||
jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
|
||
class2type[ "[object " + name + "]" ] = name.toLowerCase();
|
||
});
|
||
|
||
browserMatch = jQuery.uaMatch( userAgent );
|
||
if ( browserMatch.browser ) {
|
||
jQuery.browser[ browserMatch.browser ] = true;
|
||
jQuery.browser.version = browserMatch.version;
|
||
}
|
||
|
||
// Deprecated, use jQuery.browser.webkit instead
|
||
if ( jQuery.browser.webkit ) {
|
||
jQuery.browser.safari = true;
|
||
}
|
||
|
||
// IE doesn't match non-breaking spaces with \s
|
||
if ( rnotwhite.test( "\xA0" ) ) {
|
||
trimLeft = /^[\s\xA0]+/;
|
||
trimRight = /[\s\xA0]+$/;
|
||
}
|
||
|
||
// All jQuery objects should point back to these
|
||
rootjQuery = jQuery(document);
|
||
|
||
// Cleanup functions for the document ready method
|
||
if ( document.addEventListener ) {
|
||
DOMContentLoaded = function() {
|
||
document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
|
||
jQuery.ready();
|
||
};
|
||
|
||
} else if ( document.attachEvent ) {
|
||
DOMContentLoaded = function() {
|
||
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
|
||
if ( document.readyState === "complete" ) {
|
||
document.detachEvent( "onreadystatechange", DOMContentLoaded );
|
||
jQuery.ready();
|
||
}
|
||
};
|
||
}
|
||
|
||
// The DOM ready check for Internet Explorer
|
||
function doScrollCheck() {
|
||
if ( jQuery.isReady ) {
|
||
return;
|
||
}
|
||
|
||
try {
|
||
// If IE is used, use the trick by Diego Perini
|
||
// http://javascript.nwbox.com/IEContentLoaded/
|
||
document.documentElement.doScroll("left");
|
||
} catch(e) {
|
||
setTimeout( doScrollCheck, 1 );
|
||
return;
|
||
}
|
||
|
||
// and execute any waiting functions
|
||
jQuery.ready();
|
||
}
|
||
|
||
return jQuery;
|
||
|
||
})();
|
||
|
||
|
||
var // Promise methods
|
||
promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ),
|
||
// Static reference to slice
|
||
sliceDeferred = [].slice;
|
||
|
||
jQuery.extend({
|
||
// Create a simple deferred (one callbacks list)
|
||
_Deferred: function() {
|
||
var // callbacks list
|
||
callbacks = [],
|
||
// stored [ context , args ]
|
||
fired,
|
||
// to avoid firing when already doing so
|
||
firing,
|
||
// flag to know if the deferred has been cancelled
|
||
cancelled,
|
||
// the deferred itself
|
||
deferred = {
|
||
|
||
// done( f1, f2, ...)
|
||
done: function() {
|
||
if ( !cancelled ) {
|
||
var args = arguments,
|
||
i,
|
||
length,
|
||
elem,
|
||
type,
|
||
_fired;
|
||
if ( fired ) {
|
||
_fired = fired;
|
||
fired = 0;
|
||
}
|
||
for ( i = 0, length = args.length; i < length; i++ ) {
|
||
elem = args[ i ];
|
||
type = jQuery.type( elem );
|
||
if ( type === "array" ) {
|
||
deferred.done.apply( deferred, elem );
|
||
} else if ( type === "function" ) {
|
||
callbacks.push( elem );
|
||
}
|
||
}
|
||
if ( _fired ) {
|
||
deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] );
|
||
}
|
||
}
|
||
return this;
|
||
},
|
||
|
||
// resolve with given context and args
|
||
resolveWith: function( context, args ) {
|
||
if ( !cancelled && !fired && !firing ) {
|
||
// make sure args are available (#8421)
|
||
args = args || [];
|
||
firing = 1;
|
||
try {
|
||
while( callbacks[ 0 ] ) {
|
||
callbacks.shift().apply( context, args );
|
||
}
|
||
}
|
||
finally {
|
||
fired = [ context, args ];
|
||
firing = 0;
|
||
}
|
||
}
|
||
return this;
|
||
},
|
||
|
||
// resolve with this as context and given arguments
|
||
resolve: function() {
|
||
deferred.resolveWith( this, arguments );
|
||
return this;
|
||
},
|
||
|
||
// Has this deferred been resolved?
|
||
isResolved: function() {
|
||
return !!( firing || fired );
|
||
},
|
||
|
||
// Cancel
|
||
cancel: function() {
|
||
cancelled = 1;
|
||
callbacks = [];
|
||
return this;
|
||
}
|
||
};
|
||
|
||
return deferred;
|
||
},
|
||
|
||
// Full fledged deferred (two callbacks list)
|
||
Deferred: function( func ) {
|
||
var deferred = jQuery._Deferred(),
|
||
failDeferred = jQuery._Deferred(),
|
||
promise;
|
||
// Add errorDeferred methods, then and promise
|
||
jQuery.extend( deferred, {
|
||
then: function( doneCallbacks, failCallbacks ) {
|
||
deferred.done( doneCallbacks ).fail( failCallbacks );
|
||
return this;
|
||
},
|
||
always: function() {
|
||
return deferred.done.apply( deferred, arguments ).fail.apply( this, arguments );
|
||
},
|
||
fail: failDeferred.done,
|
||
rejectWith: failDeferred.resolveWith,
|
||
reject: failDeferred.resolve,
|
||
isRejected: failDeferred.isResolved,
|
||
pipe: function( fnDone, fnFail ) {
|
||
return jQuery.Deferred(function( newDefer ) {
|
||
jQuery.each( {
|
||
done: [ fnDone, "resolve" ],
|
||
fail: [ fnFail, "reject" ]
|
||
}, function( handler, data ) {
|
||
var fn = data[ 0 ],
|
||
action = data[ 1 ],
|
||
returned;
|
||
if ( jQuery.isFunction( fn ) ) {
|
||
deferred[ handler ](function() {
|
||
returned = fn.apply( this, arguments );
|
||
if ( returned && jQuery.isFunction( returned.promise ) ) {
|
||
returned.promise().then( newDefer.resolve, newDefer.reject );
|
||
} else {
|
||
newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
|
||
}
|
||
});
|
||
} else {
|
||
deferred[ handler ]( newDefer[ action ] );
|
||
}
|
||
});
|
||
}).promise();
|
||
},
|
||
// Get a promise for this deferred
|
||
// If obj is provided, the promise aspect is added to the object
|
||
promise: function( obj ) {
|
||
if ( obj == null ) {
|
||
if ( promise ) {
|
||
return promise;
|
||
}
|
||
promise = obj = {};
|
||
}
|
||
var i = promiseMethods.length;
|
||
while( i-- ) {
|
||
obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ];
|
||
}
|
||
return obj;
|
||
}
|
||
});
|
||
// Make sure only one callback list will be used
|
||
deferred.done( failDeferred.cancel ).fail( deferred.cancel );
|
||
// Unexpose cancel
|
||
delete deferred.cancel;
|
||
// Call given func if any
|
||
if ( func ) {
|
||
func.call( deferred, deferred );
|
||
}
|
||
return deferred;
|
||
},
|
||
|
||
// Deferred helper
|
||
when: function( firstParam ) {
|
||
var args = arguments,
|
||
i = 0,
|
||
length = args.length,
|
||
count = length,
|
||
deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
|
||
firstParam :
|
||
jQuery.Deferred();
|
||
function resolveFunc( i ) {
|
||
return function( value ) {
|
||
args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
|
||
if ( !( --count ) ) {
|
||
// Strange bug in FF4:
|
||
// Values changed onto the arguments object sometimes end up as undefined values
|
||
// outside the $.when method. Cloning the object into a fresh array solves the issue
|
||
deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) );
|
||
}
|
||
};
|
||
}
|
||
if ( length > 1 ) {
|
||
for( ; i < length; i++ ) {
|
||
if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) {
|
||
args[ i ].promise().then( resolveFunc(i), deferred.reject );
|
||
} else {
|
||
--count;
|
||
}
|
||
}
|
||
if ( !count ) {
|
||
deferred.resolveWith( deferred, args );
|
||
}
|
||
} else if ( deferred !== firstParam ) {
|
||
deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
|
||
}
|
||
return deferred.promise();
|
||
}
|
||
});
|
||
|
||
|
||
|
||
jQuery.support = (function() {
|
||
|
||
var div = document.createElement( "div" ),
|
||
documentElement = document.documentElement,
|
||
all,
|
||
a,
|
||
select,
|
||
opt,
|
||
input,
|
||
marginDiv,
|
||
support,
|
||
fragment,
|
||
body,
|
||
testElementParent,
|
||
testElement,
|
||
testElementStyle,
|
||
tds,
|
||
events,
|
||
eventName,
|
||
i,
|
||
isSupported;
|
||
|
||
// Preliminary tests
|
||
div.setAttribute("className", "t");
|
||
div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
|
||
|
||
|
||
all = div.getElementsByTagName( "*" );
|
||
a = div.getElementsByTagName( "a" )[ 0 ];
|
||
|
||
// Can't get basic test support
|
||
if ( !all || !all.length || !a ) {
|
||
return {};
|
||
}
|
||
|
||
// First batch of supports tests
|
||
select = document.createElement( "select" );
|
||
opt = select.appendChild( document.createElement("option") );
|
||
input = div.getElementsByTagName( "input" )[ 0 ];
|
||
|
||
support = {
|
||
// IE strips leading whitespace when .innerHTML is used
|
||
leadingWhitespace: ( div.firstChild.nodeType === 3 ),
|
||
|
||
// Make sure that tbody elements aren't automatically inserted
|
||
// IE will insert them into empty tables
|
||
tbody: !div.getElementsByTagName( "tbody" ).length,
|
||
|
||
// Make sure that link elements get serialized correctly by innerHTML
|
||
// This requires a wrapper element in IE
|
||
htmlSerialize: !!div.getElementsByTagName( "link" ).length,
|
||
|
||
// Get the style information from getAttribute
|
||
// (IE uses .cssText instead)
|
||
style: /top/.test( a.getAttribute("style") ),
|
||
|
||
// Make sure that URLs aren't manipulated
|
||
// (IE normalizes it by default)
|
||
hrefNormalized: ( a.getAttribute( "href" ) === "/a" ),
|
||
|
||
// Make sure that element opacity exists
|
||
// (IE uses filter instead)
|
||
// Use a regex to work around a WebKit issue. See #5145
|
||
opacity: /^0.55$/.test( a.style.opacity ),
|
||
|
||
// Verify style float existence
|
||
// (IE uses styleFloat instead of cssFloat)
|
||
cssFloat: !!a.style.cssFloat,
|
||
|
||
// Make sure that if no value is specified for a checkbox
|
||
// that it defaults to "on".
|
||
// (WebKit defaults to "" instead)
|
||
checkOn: ( input.value === "on" ),
|
||
|
||
// Make sure that a selected-by-default option has a working selected property.
|
||
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
|
||
optSelected: opt.selected,
|
||
|
||
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
|
||
getSetAttribute: div.className !== "t",
|
||
|
||
// Will be defined later
|
||
submitBubbles: true,
|
||
changeBubbles: true,
|
||
focusinBubbles: false,
|
||
deleteExpando: true,
|
||
noCloneEvent: true,
|
||
inlineBlockNeedsLayout: false,
|
||
shrinkWrapBlocks: false,
|
||
reliableMarginRight: true
|
||
};
|
||
|
||
// Make sure checked status is properly cloned
|
||
input.checked = true;
|
||
support.noCloneChecked = input.cloneNode( true ).checked;
|
||
|
||
// Make sure that the options inside disabled selects aren't marked as disabled
|
||
// (WebKit marks them as disabled)
|
||
select.disabled = true;
|
||
support.optDisabled = !opt.disabled;
|
||
|
||
// Test to see if it's possible to delete an expando from an element
|
||
// Fails in Internet Explorer
|
||
try {
|
||
delete div.test;
|
||
} catch( e ) {
|
||
support.deleteExpando = false;
|
||
}
|
||
|
||
if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
|
||
div.attachEvent( "onclick", function() {
|
||
// Cloning a node shouldn't copy over any
|
||
// bound event handlers (IE does this)
|
||
support.noCloneEvent = false;
|
||
});
|
||
div.cloneNode( true ).fireEvent( "onclick" );
|
||
}
|
||
|
||
// Check if a radio maintains it's value
|
||
// after being appended to the DOM
|
||
input = document.createElement("input");
|
||
input.value = "t";
|
||
input.setAttribute("type", "radio");
|
||
support.radioValue = input.value === "t";
|
||
|
||
input.setAttribute("checked", "checked");
|
||
div.appendChild( input );
|
||
fragment = document.createDocumentFragment();
|
||
fragment.appendChild( div.firstChild );
|
||
|
||
// WebKit doesn't clone checked state correctly in fragments
|
||
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
|
||
|
||
div.innerHTML = "";
|
||
|
||
// Figure out if the W3C box model works as expected
|
||
div.style.width = div.style.paddingLeft = "1px";
|
||
|
||
body = document.getElementsByTagName( "body" )[ 0 ];
|
||
// We use our own, invisible, body unless the body is already present
|
||
// in which case we use a div (#9239)
|
||
testElement = document.createElement( body ? "div" : "body" );
|
||
testElementStyle = {
|
||
visibility: "hidden",
|
||
width: 0,
|
||
height: 0,
|
||
border: 0,
|
||
margin: 0,
|
||
background: "none"
|
||
};
|
||
if ( body ) {
|
||
jQuery.extend( testElementStyle, {
|
||
position: "absolute",
|
||
left: "-1000px",
|
||
top: "-1000px"
|
||
});
|
||
}
|
||
for ( i in testElementStyle ) {
|
||
testElement.style[ i ] = testElementStyle[ i ];
|
||
}
|
||
testElement.appendChild( div );
|
||
testElementParent = body || documentElement;
|
||
testElementParent.insertBefore( testElement, testElementParent.firstChild );
|
||
|
||
// Check if a disconnected checkbox will retain its checked
|
||
// value of true after appended to the DOM (IE6/7)
|
||
support.appendChecked = input.checked;
|
||
|
||
support.boxModel = div.offsetWidth === 2;
|
||
|
||
if ( "zoom" in div.style ) {
|
||
// Check if natively block-level elements act like inline-block
|
||
// elements when setting their display to 'inline' and giving
|
||
// them layout
|
||
// (IE < 8 does this)
|
||
div.style.display = "inline";
|
||
div.style.zoom = 1;
|
||
support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
|
||
|
||
// Check if elements with layout shrink-wrap their children
|
||
// (IE 6 does this)
|
||
div.style.display = "";
|
||
div.innerHTML = "<div style='width:4px;'></div>";
|
||
support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
|
||
}
|
||
|
||
div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
|
||
tds = div.getElementsByTagName( "td" );
|
||
|
||
// Check if table cells still have offsetWidth/Height when they are set
|
||
// to display:none and there are still other visible table cells in a
|
||
// table row; if so, offsetWidth/Height are not reliable for use when
|
||
// determining if an element has been hidden directly using
|
||
// display:none (it is still safe to use offsets if a parent element is
|
||
// hidden; don safety goggles and see bug #4512 for more information).
|
||
// (only IE 8 fails this test)
|
||
isSupported = ( tds[ 0 ].offsetHeight === 0 );
|
||
|
||
tds[ 0 ].style.display = "";
|
||
tds[ 1 ].style.display = "none";
|
||
|
||
// Check if empty table cells still have offsetWidth/Height
|
||
// (IE < 8 fail this test)
|
||
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
|
||
div.innerHTML = "";
|
||
|
||
// Check if div with explicit width and no margin-right incorrectly
|
||
// gets computed margin-right based on width of container. For more
|
||
// info see bug #3333
|
||
// Fails in WebKit before Feb 2011 nightlies
|
||
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
|
||
if ( document.defaultView && document.defaultView.getComputedStyle ) {
|
||
marginDiv = document.createElement( "div" );
|
||
marginDiv.style.width = "0";
|
||
marginDiv.style.marginRight = "0";
|
||
div.appendChild( marginDiv );
|
||
support.reliableMarginRight =
|
||
( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
|
||
}
|
||
|
||
// Remove the body element we added
|
||
testElement.innerHTML = "";
|
||
testElementParent.removeChild( testElement );
|
||
|
||
// Technique from Juriy Zaytsev
|
||
// http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
|
||
// We only care about the case where non-standard event systems
|
||
// are used, namely in IE. Short-circuiting here helps us to
|
||
// avoid an eval call (in setAttribute) which can cause CSP
|
||
// to go haywire. See: https://developer.mozilla.org/en/Security/CSP
|
||
if ( div.attachEvent ) {
|
||
for( i in {
|
||
submit: 1,
|
||
change: 1,
|
||
focusin: 1
|
||
} ) {
|
||
eventName = "on" + i;
|
||
isSupported = ( eventName in div );
|
||
if ( !isSupported ) {
|
||
div.setAttribute( eventName, "return;" );
|
||
isSupported = ( typeof div[ eventName ] === "function" );
|
||
}
|
||
support[ i + "Bubbles" ] = isSupported;
|
||
}
|
||
}
|
||
|
||
// Null connected elements to avoid leaks in IE
|
||
testElement = fragment = select = opt = body = marginDiv = div = input = null;
|
||
|
||
return support;
|
||
})();
|
||
|
||
// Keep track of boxModel
|
||
jQuery.boxModel = jQuery.support.boxModel;
|
||
|
||
|
||
|
||
|
||
var rbrace = /^(?:\{.*\}|\[.*\])$/,
|
||
rmultiDash = /([A-Z])/g;
|
||
|
||
jQuery.extend({
|
||
cache: {},
|
||
|
||
// Please use with caution
|
||
uuid: 0,
|
||
|
||
// Unique for each copy of jQuery on the page
|
||
// Non-digits removed to match rinlinejQuery
|
||
expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
|
||
|
||
// The following elements throw uncatchable exceptions if you
|
||
// attempt to add expando properties to them.
|
||
noData: {
|
||
"embed": true,
|
||
// Ban all objects except for Flash (which handle expandos)
|
||
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
|
||
"applet": true
|
||
},
|
||
|
||
hasData: function( elem ) {
|
||
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
|
||
|
||
return !!elem && !isEmptyDataObject( elem );
|
||
},
|
||
|
||
data: function( elem, name, data, pvt /* Internal Use Only */ ) {
|
||
if ( !jQuery.acceptData( elem ) ) {
|
||
return;
|
||
}
|
||
|
||
var thisCache, ret,
|
||
internalKey = jQuery.expando,
|
||
getByName = typeof name === "string",
|
||
|
||
// We have to handle DOM nodes and JS objects differently because IE6-7
|
||
// can't GC object references properly across the DOM-JS boundary
|
||
isNode = elem.nodeType,
|
||
|
||
// Only DOM nodes need the global jQuery cache; JS object data is
|
||
// attached directly to the object so GC can occur automatically
|
||
cache = isNode ? jQuery.cache : elem,
|
||
|
||
// Only defining an ID for JS objects if its cache already exists allows
|
||
// the code to shortcut on the same path as a DOM node with no cache
|
||
id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando;
|
||
|
||
// Avoid doing any more work than we need to when trying to get data on an
|
||
// object that has no data at all
|
||
if ( (!id || (pvt && id && (cache[ id ] && !cache[ id ][ internalKey ]))) && getByName && data === undefined ) {
|
||
return;
|
||
}
|
||
|
||
if ( !id ) {
|
||
// Only DOM nodes need a new unique ID for each element since their data
|
||
// ends up in the global cache
|
||
if ( isNode ) {
|
||
elem[ jQuery.expando ] = id = ++jQuery.uuid;
|
||
} else {
|
||
id = jQuery.expando;
|
||
}
|
||
}
|
||
|
||
if ( !cache[ id ] ) {
|
||
cache[ id ] = {};
|
||
|
||
// TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
|
||
// metadata on plain JS objects when the object is serialized using
|
||
// JSON.stringify
|
||
if ( !isNode ) {
|
||
cache[ id ].toJSON = jQuery.noop;
|
||
}
|
||
}
|
Also available in: Unified diff
updates UI to bootstrap v2