Daniel@0: /*! Daniel@0: * jQuery JavaScript Library v1.10.2 Daniel@0: * http://jquery.com/ Daniel@0: * Daniel@0: * Includes Sizzle.js Daniel@0: * http://sizzlejs.com/ Daniel@0: * Daniel@0: * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors Daniel@0: * Released under the MIT license Daniel@0: * http://jquery.org/license Daniel@0: * Daniel@0: * Date: 2013-07-03T13:48Z Daniel@0: */ Daniel@0: (function( window, undefined ) { Daniel@0: Daniel@0: // Can't do this because several apps including ASP.NET trace Daniel@0: // the stack via arguments.caller.callee and Firefox dies if Daniel@0: // you try to trace through "use strict" call chains. (#13335) Daniel@0: // Support: Firefox 18+ Daniel@0: //"use strict"; Daniel@0: var Daniel@0: // The deferred used on DOM ready Daniel@0: readyList, Daniel@0: Daniel@0: // A central reference to the root jQuery(document) Daniel@0: rootjQuery, Daniel@0: Daniel@0: // Support: IE<10 Daniel@0: // For `typeof xmlNode.method` instead of `xmlNode.method !== undefined` Daniel@0: core_strundefined = typeof undefined, Daniel@0: Daniel@0: // Use the correct document accordingly with window argument (sandbox) Daniel@0: location = window.location, Daniel@0: document = window.document, Daniel@0: docElem = document.documentElement, Daniel@0: Daniel@0: // Map over jQuery in case of overwrite Daniel@0: _jQuery = window.jQuery, Daniel@0: Daniel@0: // Map over the $ in case of overwrite Daniel@0: _$ = window.$, Daniel@0: Daniel@0: // [[Class]] -> type pairs Daniel@0: class2type = {}, Daniel@0: Daniel@0: // List of deleted data cache ids, so we can reuse them Daniel@0: core_deletedIds = [], Daniel@0: Daniel@0: core_version = "1.10.2", Daniel@0: Daniel@0: // Save a reference to some core methods Daniel@0: core_concat = core_deletedIds.concat, Daniel@0: core_push = core_deletedIds.push, Daniel@0: core_slice = core_deletedIds.slice, Daniel@0: core_indexOf = core_deletedIds.indexOf, Daniel@0: core_toString = class2type.toString, Daniel@0: core_hasOwn = class2type.hasOwnProperty, Daniel@0: core_trim = core_version.trim, Daniel@0: Daniel@0: // Define a local copy of jQuery Daniel@0: jQuery = function( selector, context ) { Daniel@0: // The jQuery object is actually just the init constructor 'enhanced' Daniel@0: return new jQuery.fn.init( selector, context, rootjQuery ); Daniel@0: }, Daniel@0: Daniel@0: // Used for matching numbers Daniel@0: core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, Daniel@0: Daniel@0: // Used for splitting on whitespace Daniel@0: core_rnotwhite = /\S+/g, Daniel@0: Daniel@0: // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) Daniel@0: rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, Daniel@0: Daniel@0: // A simple way to check for HTML strings Daniel@0: // Prioritize #id over to avoid XSS via location.hash (#9521) Daniel@0: // Strict HTML recognition (#11290: must start with <) Daniel@0: rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, Daniel@0: Daniel@0: // Match a standalone tag Daniel@0: rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, Daniel@0: Daniel@0: // JSON RegExp Daniel@0: rvalidchars = /^[\],:{}\s]*$/, Daniel@0: rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, Daniel@0: rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, Daniel@0: rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, Daniel@0: Daniel@0: // Matches dashed string for camelizing Daniel@0: rmsPrefix = /^-ms-/, Daniel@0: rdashAlpha = /-([\da-z])/gi, Daniel@0: Daniel@0: // Used by jQuery.camelCase as callback to replace() Daniel@0: fcamelCase = function( all, letter ) { Daniel@0: return letter.toUpperCase(); Daniel@0: }, Daniel@0: Daniel@0: // The ready event handler Daniel@0: completed = function( event ) { Daniel@0: Daniel@0: // readyState === "complete" is good enough for us to call the dom ready in oldIE Daniel@0: if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { Daniel@0: detach(); Daniel@0: jQuery.ready(); Daniel@0: } Daniel@0: }, Daniel@0: // Clean-up method for dom ready events Daniel@0: detach = function() { Daniel@0: if ( document.addEventListener ) { Daniel@0: document.removeEventListener( "DOMContentLoaded", completed, false ); Daniel@0: window.removeEventListener( "load", completed, false ); Daniel@0: Daniel@0: } else { Daniel@0: document.detachEvent( "onreadystatechange", completed ); Daniel@0: window.detachEvent( "onload", completed ); Daniel@0: } Daniel@0: }; Daniel@0: Daniel@0: jQuery.fn = jQuery.prototype = { Daniel@0: // The current version of jQuery being used Daniel@0: jquery: core_version, Daniel@0: Daniel@0: constructor: jQuery, Daniel@0: init: function( selector, context, rootjQuery ) { Daniel@0: var match, elem; Daniel@0: Daniel@0: // HANDLE: $(""), $(null), $(undefined), $(false) Daniel@0: if ( !selector ) { Daniel@0: return this; Daniel@0: } Daniel@0: Daniel@0: // Handle HTML strings Daniel@0: if ( typeof selector === "string" ) { Daniel@0: if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { Daniel@0: // Assume that strings that start and end with <> are HTML and skip the regex check Daniel@0: match = [ null, selector, null ]; Daniel@0: Daniel@0: } else { Daniel@0: match = rquickExpr.exec( selector ); Daniel@0: } Daniel@0: Daniel@0: // Match html or make sure no context is specified for #id Daniel@0: if ( match && (match[1] || !context) ) { Daniel@0: Daniel@0: // HANDLE: $(html) -> $(array) Daniel@0: if ( match[1] ) { Daniel@0: context = context instanceof jQuery ? context[0] : context; Daniel@0: Daniel@0: // scripts is true for back-compat Daniel@0: jQuery.merge( this, jQuery.parseHTML( Daniel@0: match[1], Daniel@0: context && context.nodeType ? context.ownerDocument || context : document, Daniel@0: true Daniel@0: ) ); Daniel@0: Daniel@0: // HANDLE: $(html, props) Daniel@0: if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { Daniel@0: for ( match in context ) { Daniel@0: // Properties of context are called as methods if possible Daniel@0: if ( jQuery.isFunction( this[ match ] ) ) { Daniel@0: this[ match ]( context[ match ] ); Daniel@0: Daniel@0: // ...and otherwise set as attributes Daniel@0: } else { Daniel@0: this.attr( match, context[ match ] ); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return this; Daniel@0: Daniel@0: // HANDLE: $(#id) Daniel@0: } else { Daniel@0: elem = document.getElementById( match[2] ); Daniel@0: Daniel@0: // Check parentNode to catch when Blackberry 4.6 returns Daniel@0: // nodes that are no longer in the document #6963 Daniel@0: if ( elem && elem.parentNode ) { Daniel@0: // Handle the case where IE and Opera return items Daniel@0: // by name instead of ID Daniel@0: if ( elem.id !== match[2] ) { Daniel@0: return rootjQuery.find( selector ); Daniel@0: } Daniel@0: Daniel@0: // Otherwise, we inject the element directly into the jQuery object Daniel@0: this.length = 1; Daniel@0: this[0] = elem; Daniel@0: } Daniel@0: Daniel@0: this.context = document; Daniel@0: this.selector = selector; Daniel@0: return this; Daniel@0: } Daniel@0: Daniel@0: // HANDLE: $(expr, $(...)) Daniel@0: } else if ( !context || context.jquery ) { Daniel@0: return ( context || rootjQuery ).find( selector ); Daniel@0: Daniel@0: // HANDLE: $(expr, context) Daniel@0: // (which is just equivalent to: $(context).find(expr) Daniel@0: } else { Daniel@0: return this.constructor( context ).find( selector ); Daniel@0: } Daniel@0: Daniel@0: // HANDLE: $(DOMElement) Daniel@0: } else if ( selector.nodeType ) { Daniel@0: this.context = this[0] = selector; Daniel@0: this.length = 1; Daniel@0: return this; Daniel@0: Daniel@0: // HANDLE: $(function) Daniel@0: // Shortcut for document ready Daniel@0: } else if ( jQuery.isFunction( selector ) ) { Daniel@0: return rootjQuery.ready( selector ); Daniel@0: } Daniel@0: Daniel@0: if ( selector.selector !== undefined ) { Daniel@0: this.selector = selector.selector; Daniel@0: this.context = selector.context; Daniel@0: } Daniel@0: Daniel@0: return jQuery.makeArray( selector, this ); Daniel@0: }, Daniel@0: Daniel@0: // Start with an empty selector Daniel@0: selector: "", Daniel@0: Daniel@0: // The default length of a jQuery object is 0 Daniel@0: length: 0, Daniel@0: Daniel@0: toArray: function() { Daniel@0: return core_slice.call( this ); Daniel@0: }, Daniel@0: Daniel@0: // Get the Nth element in the matched element set OR Daniel@0: // Get the whole matched element set as a clean array Daniel@0: get: function( num ) { Daniel@0: return num == null ? Daniel@0: Daniel@0: // Return a 'clean' array Daniel@0: this.toArray() : Daniel@0: Daniel@0: // Return just the object Daniel@0: ( num < 0 ? this[ this.length + num ] : this[ num ] ); Daniel@0: }, Daniel@0: Daniel@0: // Take an array of elements and push it onto the stack Daniel@0: // (returning the new matched element set) Daniel@0: pushStack: function( elems ) { Daniel@0: Daniel@0: // Build a new jQuery matched element set Daniel@0: var ret = jQuery.merge( this.constructor(), elems ); Daniel@0: Daniel@0: // Add the old object onto the stack (as a reference) Daniel@0: ret.prevObject = this; Daniel@0: ret.context = this.context; Daniel@0: Daniel@0: // Return the newly-formed element set Daniel@0: return ret; Daniel@0: }, Daniel@0: Daniel@0: // Execute a callback for every element in the matched set. Daniel@0: // (You can seed the arguments with an array of args, but this is Daniel@0: // only used internally.) Daniel@0: each: function( callback, args ) { Daniel@0: return jQuery.each( this, callback, args ); Daniel@0: }, Daniel@0: Daniel@0: ready: function( fn ) { Daniel@0: // Add the callback Daniel@0: jQuery.ready.promise().done( fn ); Daniel@0: Daniel@0: return this; Daniel@0: }, Daniel@0: Daniel@0: slice: function() { Daniel@0: return this.pushStack( core_slice.apply( this, arguments ) ); Daniel@0: }, Daniel@0: Daniel@0: first: function() { Daniel@0: return this.eq( 0 ); Daniel@0: }, Daniel@0: Daniel@0: last: function() { Daniel@0: return this.eq( -1 ); Daniel@0: }, Daniel@0: Daniel@0: eq: function( i ) { Daniel@0: var len = this.length, Daniel@0: j = +i + ( i < 0 ? len : 0 ); Daniel@0: return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); Daniel@0: }, Daniel@0: Daniel@0: map: function( callback ) { Daniel@0: return this.pushStack( jQuery.map(this, function( elem, i ) { Daniel@0: return callback.call( elem, i, elem ); Daniel@0: })); Daniel@0: }, Daniel@0: Daniel@0: end: function() { Daniel@0: return this.prevObject || this.constructor(null); Daniel@0: }, Daniel@0: Daniel@0: // For internal use only. Daniel@0: // Behaves like an Array's method, not like a jQuery method. Daniel@0: push: core_push, Daniel@0: sort: [].sort, Daniel@0: splice: [].splice Daniel@0: }; Daniel@0: Daniel@0: // Give the init function the jQuery prototype for later instantiation Daniel@0: jQuery.fn.init.prototype = jQuery.fn; Daniel@0: Daniel@0: jQuery.extend = jQuery.fn.extend = function() { Daniel@0: var src, copyIsArray, copy, name, options, clone, Daniel@0: target = arguments[0] || {}, Daniel@0: i = 1, Daniel@0: length = arguments.length, Daniel@0: deep = false; Daniel@0: Daniel@0: // Handle a deep copy situation Daniel@0: if ( typeof target === "boolean" ) { Daniel@0: deep = target; Daniel@0: target = arguments[1] || {}; Daniel@0: // skip the boolean and the target Daniel@0: i = 2; Daniel@0: } Daniel@0: Daniel@0: // Handle case when target is a string or something (possible in deep copy) Daniel@0: if ( typeof target !== "object" && !jQuery.isFunction(target) ) { Daniel@0: target = {}; Daniel@0: } Daniel@0: Daniel@0: // extend jQuery itself if only one argument is passed Daniel@0: if ( length === i ) { Daniel@0: target = this; Daniel@0: --i; Daniel@0: } Daniel@0: Daniel@0: for ( ; i < length; i++ ) { Daniel@0: // Only deal with non-null/undefined values Daniel@0: if ( (options = arguments[ i ]) != null ) { Daniel@0: // Extend the base object Daniel@0: for ( name in options ) { Daniel@0: src = target[ name ]; Daniel@0: copy = options[ name ]; Daniel@0: Daniel@0: // Prevent never-ending loop Daniel@0: if ( target === copy ) { Daniel@0: continue; Daniel@0: } Daniel@0: Daniel@0: // Recurse if we're merging plain objects or arrays Daniel@0: if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { Daniel@0: if ( copyIsArray ) { Daniel@0: copyIsArray = false; Daniel@0: clone = src && jQuery.isArray(src) ? src : []; Daniel@0: Daniel@0: } else { Daniel@0: clone = src && jQuery.isPlainObject(src) ? src : {}; Daniel@0: } Daniel@0: Daniel@0: // Never move original objects, clone them Daniel@0: target[ name ] = jQuery.extend( deep, clone, copy ); Daniel@0: Daniel@0: // Don't bring in undefined values Daniel@0: } else if ( copy !== undefined ) { Daniel@0: target[ name ] = copy; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Return the modified object Daniel@0: return target; Daniel@0: }; Daniel@0: Daniel@0: jQuery.extend({ Daniel@0: // Unique for each copy of jQuery on the page Daniel@0: // Non-digits removed to match rinlinejQuery Daniel@0: expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ), Daniel@0: Daniel@0: noConflict: function( deep ) { Daniel@0: if ( window.$ === jQuery ) { Daniel@0: window.$ = _$; Daniel@0: } Daniel@0: Daniel@0: if ( deep && window.jQuery === jQuery ) { Daniel@0: window.jQuery = _jQuery; Daniel@0: } Daniel@0: Daniel@0: return jQuery; Daniel@0: }, Daniel@0: Daniel@0: // Is the DOM ready to be used? Set to true once it occurs. Daniel@0: isReady: false, Daniel@0: Daniel@0: // A counter to track how many items to wait for before Daniel@0: // the ready event fires. See #6781 Daniel@0: readyWait: 1, Daniel@0: Daniel@0: // Hold (or release) the ready event Daniel@0: holdReady: function( hold ) { Daniel@0: if ( hold ) { Daniel@0: jQuery.readyWait++; Daniel@0: } else { Daniel@0: jQuery.ready( true ); Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: // Handle when the DOM is ready Daniel@0: ready: function( wait ) { Daniel@0: Daniel@0: // Abort if there are pending holds or we're already ready Daniel@0: if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). Daniel@0: if ( !document.body ) { Daniel@0: return setTimeout( jQuery.ready ); Daniel@0: } Daniel@0: Daniel@0: // Remember that the DOM is ready Daniel@0: jQuery.isReady = true; Daniel@0: Daniel@0: // If a normal DOM Ready event fired, decrement, and wait if need be Daniel@0: if ( wait !== true && --jQuery.readyWait > 0 ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: // If there are functions bound, to execute Daniel@0: readyList.resolveWith( document, [ jQuery ] ); Daniel@0: Daniel@0: // Trigger any bound ready events Daniel@0: if ( jQuery.fn.trigger ) { Daniel@0: jQuery( document ).trigger("ready").off("ready"); Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: // See test/unit/core.js for details concerning isFunction. Daniel@0: // Since version 1.3, DOM methods and functions like alert Daniel@0: // aren't supported. They return false on IE (#2968). Daniel@0: isFunction: function( obj ) { Daniel@0: return jQuery.type(obj) === "function"; Daniel@0: }, Daniel@0: Daniel@0: isArray: Array.isArray || function( obj ) { Daniel@0: return jQuery.type(obj) === "array"; Daniel@0: }, Daniel@0: Daniel@0: isWindow: function( obj ) { Daniel@0: /* jshint eqeqeq: false */ Daniel@0: return obj != null && obj == obj.window; Daniel@0: }, Daniel@0: Daniel@0: isNumeric: function( obj ) { Daniel@0: return !isNaN( parseFloat(obj) ) && isFinite( obj ); Daniel@0: }, Daniel@0: Daniel@0: type: function( obj ) { Daniel@0: if ( obj == null ) { Daniel@0: return String( obj ); Daniel@0: } Daniel@0: return typeof obj === "object" || typeof obj === "function" ? Daniel@0: class2type[ core_toString.call(obj) ] || "object" : Daniel@0: typeof obj; Daniel@0: }, Daniel@0: Daniel@0: isPlainObject: function( obj ) { Daniel@0: var key; Daniel@0: Daniel@0: // Must be an Object. Daniel@0: // Because of IE, we also have to check the presence of the constructor property. Daniel@0: // Make sure that DOM nodes and window objects don't pass through, as well Daniel@0: if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { Daniel@0: return false; Daniel@0: } Daniel@0: Daniel@0: try { Daniel@0: // Not own constructor property must be Object Daniel@0: if ( obj.constructor && Daniel@0: !core_hasOwn.call(obj, "constructor") && Daniel@0: !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { Daniel@0: return false; Daniel@0: } Daniel@0: } catch ( e ) { Daniel@0: // IE8,9 Will throw exceptions on certain host objects #9897 Daniel@0: return false; Daniel@0: } Daniel@0: Daniel@0: // Support: IE<9 Daniel@0: // Handle iteration over inherited properties before own properties. Daniel@0: if ( jQuery.support.ownLast ) { Daniel@0: for ( key in obj ) { Daniel@0: return core_hasOwn.call( obj, key ); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Own properties are enumerated firstly, so to speed up, Daniel@0: // if last one is own, then all properties are own. Daniel@0: for ( key in obj ) {} Daniel@0: Daniel@0: return key === undefined || core_hasOwn.call( obj, key ); Daniel@0: }, Daniel@0: Daniel@0: isEmptyObject: function( obj ) { Daniel@0: var name; Daniel@0: for ( name in obj ) { Daniel@0: return false; Daniel@0: } Daniel@0: return true; Daniel@0: }, Daniel@0: Daniel@0: error: function( msg ) { Daniel@0: throw new Error( msg ); Daniel@0: }, Daniel@0: Daniel@0: // data: string of html Daniel@0: // context (optional): If specified, the fragment will be created in this context, defaults to document Daniel@0: // keepScripts (optional): If true, will include scripts passed in the html string Daniel@0: parseHTML: function( data, context, keepScripts ) { Daniel@0: if ( !data || typeof data !== "string" ) { Daniel@0: return null; Daniel@0: } Daniel@0: if ( typeof context === "boolean" ) { Daniel@0: keepScripts = context; Daniel@0: context = false; Daniel@0: } Daniel@0: context = context || document; Daniel@0: Daniel@0: var parsed = rsingleTag.exec( data ), Daniel@0: scripts = !keepScripts && []; Daniel@0: Daniel@0: // Single tag Daniel@0: if ( parsed ) { Daniel@0: return [ context.createElement( parsed[1] ) ]; Daniel@0: } Daniel@0: Daniel@0: parsed = jQuery.buildFragment( [ data ], context, scripts ); Daniel@0: if ( scripts ) { Daniel@0: jQuery( scripts ).remove(); Daniel@0: } Daniel@0: return jQuery.merge( [], parsed.childNodes ); Daniel@0: }, Daniel@0: Daniel@0: parseJSON: function( data ) { Daniel@0: // Attempt to parse using the native JSON parser first Daniel@0: if ( window.JSON && window.JSON.parse ) { Daniel@0: return window.JSON.parse( data ); Daniel@0: } Daniel@0: Daniel@0: if ( data === null ) { Daniel@0: return data; Daniel@0: } Daniel@0: Daniel@0: if ( typeof data === "string" ) { Daniel@0: Daniel@0: // Make sure leading/trailing whitespace is removed (IE can't handle it) Daniel@0: data = jQuery.trim( data ); Daniel@0: Daniel@0: if ( data ) { Daniel@0: // Make sure the incoming data is actual JSON Daniel@0: // Logic borrowed from http://json.org/json2.js Daniel@0: if ( rvalidchars.test( data.replace( rvalidescape, "@" ) Daniel@0: .replace( rvalidtokens, "]" ) Daniel@0: .replace( rvalidbraces, "")) ) { Daniel@0: Daniel@0: return ( new Function( "return " + data ) )(); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: jQuery.error( "Invalid JSON: " + data ); Daniel@0: }, Daniel@0: Daniel@0: // Cross-browser xml parsing Daniel@0: parseXML: function( data ) { Daniel@0: var xml, tmp; Daniel@0: if ( !data || typeof data !== "string" ) { Daniel@0: return null; Daniel@0: } Daniel@0: try { Daniel@0: if ( window.DOMParser ) { // Standard Daniel@0: tmp = new DOMParser(); Daniel@0: xml = tmp.parseFromString( data , "text/xml" ); Daniel@0: } else { // IE Daniel@0: xml = new ActiveXObject( "Microsoft.XMLDOM" ); Daniel@0: xml.async = "false"; Daniel@0: xml.loadXML( data ); Daniel@0: } Daniel@0: } catch( e ) { Daniel@0: xml = undefined; Daniel@0: } Daniel@0: if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { Daniel@0: jQuery.error( "Invalid XML: " + data ); Daniel@0: } Daniel@0: return xml; Daniel@0: }, Daniel@0: Daniel@0: noop: function() {}, Daniel@0: Daniel@0: // Evaluates a script in a global context Daniel@0: // Workarounds based on findings by Jim Driscoll Daniel@0: // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context Daniel@0: globalEval: function( data ) { Daniel@0: if ( data && jQuery.trim( data ) ) { Daniel@0: // We use execScript on Internet Explorer Daniel@0: // We use an anonymous function so that context is window Daniel@0: // rather than jQuery in Firefox Daniel@0: ( window.execScript || function( data ) { Daniel@0: window[ "eval" ].call( window, data ); Daniel@0: } )( data ); Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: // Convert dashed to camelCase; used by the css and data modules Daniel@0: // Microsoft forgot to hump their vendor prefix (#9572) Daniel@0: camelCase: function( string ) { Daniel@0: return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); Daniel@0: }, Daniel@0: Daniel@0: nodeName: function( elem, name ) { Daniel@0: return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); Daniel@0: }, Daniel@0: Daniel@0: // args is for internal usage only Daniel@0: each: function( obj, callback, args ) { Daniel@0: var value, Daniel@0: i = 0, Daniel@0: length = obj.length, Daniel@0: isArray = isArraylike( obj ); Daniel@0: Daniel@0: if ( args ) { Daniel@0: if ( isArray ) { Daniel@0: for ( ; i < length; i++ ) { Daniel@0: value = callback.apply( obj[ i ], args ); Daniel@0: Daniel@0: if ( value === false ) { Daniel@0: break; Daniel@0: } Daniel@0: } Daniel@0: } else { Daniel@0: for ( i in obj ) { Daniel@0: value = callback.apply( obj[ i ], args ); Daniel@0: Daniel@0: if ( value === false ) { Daniel@0: break; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // A special, fast, case for the most common use of each Daniel@0: } else { Daniel@0: if ( isArray ) { Daniel@0: for ( ; i < length; i++ ) { Daniel@0: value = callback.call( obj[ i ], i, obj[ i ] ); Daniel@0: Daniel@0: if ( value === false ) { Daniel@0: break; Daniel@0: } Daniel@0: } Daniel@0: } else { Daniel@0: for ( i in obj ) { Daniel@0: value = callback.call( obj[ i ], i, obj[ i ] ); Daniel@0: Daniel@0: if ( value === false ) { Daniel@0: break; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return obj; Daniel@0: }, Daniel@0: Daniel@0: // Use native String.trim function wherever possible Daniel@0: trim: core_trim && !core_trim.call("\uFEFF\xA0") ? Daniel@0: function( text ) { Daniel@0: return text == null ? Daniel@0: "" : Daniel@0: core_trim.call( text ); Daniel@0: } : Daniel@0: Daniel@0: // Otherwise use our own trimming functionality Daniel@0: function( text ) { Daniel@0: return text == null ? Daniel@0: "" : Daniel@0: ( text + "" ).replace( rtrim, "" ); Daniel@0: }, Daniel@0: Daniel@0: // results is for internal usage only Daniel@0: makeArray: function( arr, results ) { Daniel@0: var ret = results || []; Daniel@0: Daniel@0: if ( arr != null ) { Daniel@0: if ( isArraylike( Object(arr) ) ) { Daniel@0: jQuery.merge( ret, Daniel@0: typeof arr === "string" ? Daniel@0: [ arr ] : arr Daniel@0: ); Daniel@0: } else { Daniel@0: core_push.call( ret, arr ); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return ret; Daniel@0: }, Daniel@0: Daniel@0: inArray: function( elem, arr, i ) { Daniel@0: var len; Daniel@0: Daniel@0: if ( arr ) { Daniel@0: if ( core_indexOf ) { Daniel@0: return core_indexOf.call( arr, elem, i ); Daniel@0: } Daniel@0: Daniel@0: len = arr.length; Daniel@0: i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; Daniel@0: Daniel@0: for ( ; i < len; i++ ) { Daniel@0: // Skip accessing in sparse arrays Daniel@0: if ( i in arr && arr[ i ] === elem ) { Daniel@0: return i; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return -1; Daniel@0: }, Daniel@0: Daniel@0: merge: function( first, second ) { Daniel@0: var l = second.length, Daniel@0: i = first.length, Daniel@0: j = 0; Daniel@0: Daniel@0: if ( typeof l === "number" ) { Daniel@0: for ( ; j < l; j++ ) { Daniel@0: first[ i++ ] = second[ j ]; Daniel@0: } Daniel@0: } else { Daniel@0: while ( second[j] !== undefined ) { Daniel@0: first[ i++ ] = second[ j++ ]; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: first.length = i; Daniel@0: Daniel@0: return first; Daniel@0: }, Daniel@0: Daniel@0: grep: function( elems, callback, inv ) { Daniel@0: var retVal, Daniel@0: ret = [], Daniel@0: i = 0, Daniel@0: length = elems.length; Daniel@0: inv = !!inv; Daniel@0: Daniel@0: // Go through the array, only saving the items Daniel@0: // that pass the validator function Daniel@0: for ( ; i < length; i++ ) { Daniel@0: retVal = !!callback( elems[ i ], i ); Daniel@0: if ( inv !== retVal ) { Daniel@0: ret.push( elems[ i ] ); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return ret; Daniel@0: }, Daniel@0: Daniel@0: // arg is for internal usage only Daniel@0: map: function( elems, callback, arg ) { Daniel@0: var value, Daniel@0: i = 0, Daniel@0: length = elems.length, Daniel@0: isArray = isArraylike( elems ), Daniel@0: ret = []; Daniel@0: Daniel@0: // Go through the array, translating each of the items to their Daniel@0: if ( isArray ) { Daniel@0: for ( ; i < length; i++ ) { Daniel@0: value = callback( elems[ i ], i, arg ); Daniel@0: Daniel@0: if ( value != null ) { Daniel@0: ret[ ret.length ] = value; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Go through every key on the object, Daniel@0: } else { Daniel@0: for ( i in elems ) { Daniel@0: value = callback( elems[ i ], i, arg ); Daniel@0: Daniel@0: if ( value != null ) { Daniel@0: ret[ ret.length ] = value; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Flatten any nested arrays Daniel@0: return core_concat.apply( [], ret ); Daniel@0: }, Daniel@0: Daniel@0: // A global GUID counter for objects Daniel@0: guid: 1, Daniel@0: Daniel@0: // Bind a function to a context, optionally partially applying any Daniel@0: // arguments. Daniel@0: proxy: function( fn, context ) { Daniel@0: var args, proxy, tmp; Daniel@0: Daniel@0: if ( typeof context === "string" ) { Daniel@0: tmp = fn[ context ]; Daniel@0: context = fn; Daniel@0: fn = tmp; Daniel@0: } Daniel@0: Daniel@0: // Quick check to determine if target is callable, in the spec Daniel@0: // this throws a TypeError, but we will just return undefined. Daniel@0: if ( !jQuery.isFunction( fn ) ) { Daniel@0: return undefined; Daniel@0: } Daniel@0: Daniel@0: // Simulated bind Daniel@0: args = core_slice.call( arguments, 2 ); Daniel@0: proxy = function() { Daniel@0: return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) ); Daniel@0: }; Daniel@0: Daniel@0: // Set the guid of unique handler to the same of original handler, so it can be removed Daniel@0: proxy.guid = fn.guid = fn.guid || jQuery.guid++; Daniel@0: Daniel@0: return proxy; Daniel@0: }, Daniel@0: Daniel@0: // Multifunctional method to get and set values of a collection Daniel@0: // The value/s can optionally be executed if it's a function Daniel@0: access: function( elems, fn, key, value, chainable, emptyGet, raw ) { Daniel@0: var i = 0, Daniel@0: length = elems.length, Daniel@0: bulk = key == null; Daniel@0: Daniel@0: // Sets many values Daniel@0: if ( jQuery.type( key ) === "object" ) { Daniel@0: chainable = true; Daniel@0: for ( i in key ) { Daniel@0: jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); Daniel@0: } Daniel@0: Daniel@0: // Sets one value Daniel@0: } else if ( value !== undefined ) { Daniel@0: chainable = true; Daniel@0: Daniel@0: if ( !jQuery.isFunction( value ) ) { Daniel@0: raw = true; Daniel@0: } Daniel@0: Daniel@0: if ( bulk ) { Daniel@0: // Bulk operations run against the entire set Daniel@0: if ( raw ) { Daniel@0: fn.call( elems, value ); Daniel@0: fn = null; Daniel@0: Daniel@0: // ...except when executing function values Daniel@0: } else { Daniel@0: bulk = fn; Daniel@0: fn = function( elem, key, value ) { Daniel@0: return bulk.call( jQuery( elem ), value ); Daniel@0: }; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: if ( fn ) { Daniel@0: for ( ; i < length; i++ ) { Daniel@0: fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return chainable ? Daniel@0: elems : Daniel@0: Daniel@0: // Gets Daniel@0: bulk ? Daniel@0: fn.call( elems ) : Daniel@0: length ? fn( elems[0], key ) : emptyGet; Daniel@0: }, Daniel@0: Daniel@0: now: function() { Daniel@0: return ( new Date() ).getTime(); Daniel@0: }, Daniel@0: Daniel@0: // A method for quickly swapping in/out CSS properties to get correct calculations. Daniel@0: // Note: this method belongs to the css module but it's needed here for the support module. Daniel@0: // If support gets modularized, this method should be moved back to the css module. Daniel@0: swap: function( elem, options, callback, args ) { Daniel@0: var ret, name, Daniel@0: old = {}; Daniel@0: Daniel@0: // Remember the old values, and insert the new ones Daniel@0: for ( name in options ) { Daniel@0: old[ name ] = elem.style[ name ]; Daniel@0: elem.style[ name ] = options[ name ]; Daniel@0: } Daniel@0: Daniel@0: ret = callback.apply( elem, args || [] ); Daniel@0: Daniel@0: // Revert the old values Daniel@0: for ( name in options ) { Daniel@0: elem.style[ name ] = old[ name ]; Daniel@0: } Daniel@0: Daniel@0: return ret; Daniel@0: } Daniel@0: }); Daniel@0: Daniel@0: jQuery.ready.promise = function( obj ) { Daniel@0: if ( !readyList ) { Daniel@0: Daniel@0: readyList = jQuery.Deferred(); Daniel@0: Daniel@0: // Catch cases where $(document).ready() is called after the browser event has already occurred. Daniel@0: // we once tried to use readyState "interactive" here, but it caused issues like the one Daniel@0: // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 Daniel@0: if ( document.readyState === "complete" ) { Daniel@0: // Handle it asynchronously to allow scripts the opportunity to delay ready Daniel@0: setTimeout( jQuery.ready ); Daniel@0: Daniel@0: // Standards-based browsers support DOMContentLoaded Daniel@0: } else if ( document.addEventListener ) { Daniel@0: // Use the handy event callback Daniel@0: document.addEventListener( "DOMContentLoaded", completed, false ); Daniel@0: Daniel@0: // A fallback to window.onload, that will always work Daniel@0: window.addEventListener( "load", completed, false ); Daniel@0: Daniel@0: // If IE event model is used Daniel@0: } else { Daniel@0: // Ensure firing before onload, maybe late but safe also for iframes Daniel@0: document.attachEvent( "onreadystatechange", completed ); Daniel@0: Daniel@0: // A fallback to window.onload, that will always work Daniel@0: window.attachEvent( "onload", completed ); Daniel@0: Daniel@0: // If IE and not a frame Daniel@0: // continually check to see if the document is ready Daniel@0: var top = false; Daniel@0: Daniel@0: try { Daniel@0: top = window.frameElement == null && document.documentElement; Daniel@0: } catch(e) {} Daniel@0: Daniel@0: if ( top && top.doScroll ) { Daniel@0: (function doScrollCheck() { Daniel@0: if ( !jQuery.isReady ) { Daniel@0: Daniel@0: try { Daniel@0: // Use the trick by Diego Perini Daniel@0: // http://javascript.nwbox.com/IEContentLoaded/ Daniel@0: top.doScroll("left"); Daniel@0: } catch(e) { Daniel@0: return setTimeout( doScrollCheck, 50 ); Daniel@0: } Daniel@0: Daniel@0: // detach all dom ready events Daniel@0: detach(); Daniel@0: Daniel@0: // and execute any waiting functions Daniel@0: jQuery.ready(); Daniel@0: } Daniel@0: })(); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: return readyList.promise( obj ); Daniel@0: }; Daniel@0: Daniel@0: // Populate the class2type map Daniel@0: jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { Daniel@0: class2type[ "[object " + name + "]" ] = name.toLowerCase(); Daniel@0: }); Daniel@0: Daniel@0: function isArraylike( obj ) { Daniel@0: var length = obj.length, Daniel@0: type = jQuery.type( obj ); Daniel@0: Daniel@0: if ( jQuery.isWindow( obj ) ) { Daniel@0: return false; Daniel@0: } Daniel@0: Daniel@0: if ( obj.nodeType === 1 && length ) { Daniel@0: return true; Daniel@0: } Daniel@0: Daniel@0: return type === "array" || type !== "function" && Daniel@0: ( length === 0 || Daniel@0: typeof length === "number" && length > 0 && ( length - 1 ) in obj ); Daniel@0: } Daniel@0: Daniel@0: // All jQuery objects should point back to these Daniel@0: rootjQuery = jQuery(document); Daniel@0: /*! Daniel@0: * Sizzle CSS Selector Engine v1.10.2 Daniel@0: * http://sizzlejs.com/ Daniel@0: * Daniel@0: * Copyright 2013 jQuery Foundation, Inc. and other contributors Daniel@0: * Released under the MIT license Daniel@0: * http://jquery.org/license Daniel@0: * Daniel@0: * Date: 2013-07-03 Daniel@0: */ Daniel@0: (function( window, undefined ) { Daniel@0: Daniel@0: var i, Daniel@0: support, Daniel@0: cachedruns, Daniel@0: Expr, Daniel@0: getText, Daniel@0: isXML, Daniel@0: compile, Daniel@0: outermostContext, Daniel@0: sortInput, Daniel@0: Daniel@0: // Local document vars Daniel@0: setDocument, Daniel@0: document, Daniel@0: docElem, Daniel@0: documentIsHTML, Daniel@0: rbuggyQSA, Daniel@0: rbuggyMatches, Daniel@0: matches, Daniel@0: contains, Daniel@0: Daniel@0: // Instance-specific data Daniel@0: expando = "sizzle" + -(new Date()), Daniel@0: preferredDoc = window.document, Daniel@0: dirruns = 0, Daniel@0: done = 0, Daniel@0: classCache = createCache(), Daniel@0: tokenCache = createCache(), Daniel@0: compilerCache = createCache(), Daniel@0: hasDuplicate = false, Daniel@0: sortOrder = function( a, b ) { Daniel@0: if ( a === b ) { Daniel@0: hasDuplicate = true; Daniel@0: return 0; Daniel@0: } Daniel@0: return 0; Daniel@0: }, Daniel@0: Daniel@0: // General-purpose constants Daniel@0: strundefined = typeof undefined, Daniel@0: MAX_NEGATIVE = 1 << 31, Daniel@0: Daniel@0: // Instance methods Daniel@0: hasOwn = ({}).hasOwnProperty, Daniel@0: arr = [], Daniel@0: pop = arr.pop, Daniel@0: push_native = arr.push, Daniel@0: push = arr.push, Daniel@0: slice = arr.slice, Daniel@0: // Use a stripped-down indexOf if we can't use a native one Daniel@0: indexOf = arr.indexOf || function( elem ) { Daniel@0: var i = 0, Daniel@0: len = this.length; Daniel@0: for ( ; i < len; i++ ) { Daniel@0: if ( this[i] === elem ) { Daniel@0: return i; Daniel@0: } Daniel@0: } Daniel@0: return -1; Daniel@0: }, Daniel@0: Daniel@0: booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", Daniel@0: Daniel@0: // Regular expressions Daniel@0: Daniel@0: // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace Daniel@0: whitespace = "[\\x20\\t\\r\\n\\f]", Daniel@0: // http://www.w3.org/TR/css3-syntax/#characters Daniel@0: characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", Daniel@0: Daniel@0: // Loosely modeled on CSS identifier characters Daniel@0: // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors Daniel@0: // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier Daniel@0: identifier = characterEncoding.replace( "w", "w#" ), Daniel@0: Daniel@0: // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors Daniel@0: attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + Daniel@0: "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", Daniel@0: Daniel@0: // Prefer arguments quoted, Daniel@0: // then not containing pseudos/brackets, Daniel@0: // then attribute selectors/non-parenthetical expressions, Daniel@0: // then anything else Daniel@0: // These preferences are here to reduce the number of selectors Daniel@0: // needing tokenize in the PSEUDO preFilter Daniel@0: pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", Daniel@0: Daniel@0: // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter Daniel@0: rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), Daniel@0: Daniel@0: rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), Daniel@0: rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), Daniel@0: Daniel@0: rsibling = new RegExp( whitespace + "*[+~]" ), Daniel@0: rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*)" + whitespace + "*\\]", "g" ), Daniel@0: Daniel@0: rpseudo = new RegExp( pseudos ), Daniel@0: ridentifier = new RegExp( "^" + identifier + "$" ), Daniel@0: Daniel@0: matchExpr = { Daniel@0: "ID": new RegExp( "^#(" + characterEncoding + ")" ), Daniel@0: "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), Daniel@0: "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), Daniel@0: "ATTR": new RegExp( "^" + attributes ), Daniel@0: "PSEUDO": new RegExp( "^" + pseudos ), Daniel@0: "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + Daniel@0: "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + Daniel@0: "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), Daniel@0: "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), Daniel@0: // For use in libraries implementing .is() Daniel@0: // We use this for POS matching in `select` Daniel@0: "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + Daniel@0: whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) Daniel@0: }, Daniel@0: Daniel@0: rnative = /^[^{]+\{\s*\[native \w/, Daniel@0: Daniel@0: // Easily-parseable/retrievable ID or TAG or CLASS selectors Daniel@0: rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, Daniel@0: Daniel@0: rinputs = /^(?:input|select|textarea|button)$/i, Daniel@0: rheader = /^h\d$/i, Daniel@0: Daniel@0: rescape = /'|\\/g, Daniel@0: Daniel@0: // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters Daniel@0: runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), Daniel@0: funescape = function( _, escaped, escapedWhitespace ) { Daniel@0: var high = "0x" + escaped - 0x10000; Daniel@0: // NaN means non-codepoint Daniel@0: // Support: Firefox Daniel@0: // Workaround erroneous numeric interpretation of +"0x" Daniel@0: return high !== high || escapedWhitespace ? Daniel@0: escaped : Daniel@0: // BMP codepoint Daniel@0: high < 0 ? Daniel@0: String.fromCharCode( high + 0x10000 ) : Daniel@0: // Supplemental Plane codepoint (surrogate pair) Daniel@0: String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); Daniel@0: }; Daniel@0: Daniel@0: // Optimize for push.apply( _, NodeList ) Daniel@0: try { Daniel@0: push.apply( Daniel@0: (arr = slice.call( preferredDoc.childNodes )), Daniel@0: preferredDoc.childNodes Daniel@0: ); Daniel@0: // Support: Android<4.0 Daniel@0: // Detect silently failing push.apply Daniel@0: arr[ preferredDoc.childNodes.length ].nodeType; Daniel@0: } catch ( e ) { Daniel@0: push = { apply: arr.length ? Daniel@0: Daniel@0: // Leverage slice if possible Daniel@0: function( target, els ) { Daniel@0: push_native.apply( target, slice.call(els) ); Daniel@0: } : Daniel@0: Daniel@0: // Support: IE<9 Daniel@0: // Otherwise append directly Daniel@0: function( target, els ) { Daniel@0: var j = target.length, Daniel@0: i = 0; Daniel@0: // Can't trust NodeList.length Daniel@0: while ( (target[j++] = els[i++]) ) {} Daniel@0: target.length = j - 1; Daniel@0: } Daniel@0: }; Daniel@0: } Daniel@0: Daniel@0: function Sizzle( selector, context, results, seed ) { Daniel@0: var match, elem, m, nodeType, Daniel@0: // QSA vars Daniel@0: i, groups, old, nid, newContext, newSelector; Daniel@0: Daniel@0: if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { Daniel@0: setDocument( context ); Daniel@0: } Daniel@0: Daniel@0: context = context || document; Daniel@0: results = results || []; Daniel@0: Daniel@0: if ( !selector || typeof selector !== "string" ) { Daniel@0: return results; Daniel@0: } Daniel@0: Daniel@0: if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { Daniel@0: return []; Daniel@0: } Daniel@0: Daniel@0: if ( documentIsHTML && !seed ) { Daniel@0: Daniel@0: // Shortcuts Daniel@0: if ( (match = rquickExpr.exec( selector )) ) { Daniel@0: // Speed-up: Sizzle("#ID") Daniel@0: if ( (m = match[1]) ) { Daniel@0: if ( nodeType === 9 ) { Daniel@0: elem = context.getElementById( m ); Daniel@0: // Check parentNode to catch when Blackberry 4.6 returns Daniel@0: // nodes that are no longer in the document #6963 Daniel@0: if ( elem && elem.parentNode ) { Daniel@0: // Handle the case where IE, Opera, and Webkit return items Daniel@0: // by name instead of ID Daniel@0: if ( elem.id === m ) { Daniel@0: results.push( elem ); Daniel@0: return results; Daniel@0: } Daniel@0: } else { Daniel@0: return results; Daniel@0: } Daniel@0: } else { Daniel@0: // Context is not a document Daniel@0: if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && Daniel@0: contains( context, elem ) && elem.id === m ) { Daniel@0: results.push( elem ); Daniel@0: return results; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Speed-up: Sizzle("TAG") Daniel@0: } else if ( match[2] ) { Daniel@0: push.apply( results, context.getElementsByTagName( selector ) ); Daniel@0: return results; Daniel@0: Daniel@0: // Speed-up: Sizzle(".CLASS") Daniel@0: } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { Daniel@0: push.apply( results, context.getElementsByClassName( m ) ); Daniel@0: return results; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // QSA path Daniel@0: if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { Daniel@0: nid = old = expando; Daniel@0: newContext = context; Daniel@0: newSelector = nodeType === 9 && selector; Daniel@0: Daniel@0: // qSA works strangely on Element-rooted queries Daniel@0: // We can work around this by specifying an extra ID on the root Daniel@0: // and working up from there (Thanks to Andrew Dupont for the technique) Daniel@0: // IE 8 doesn't work on object elements Daniel@0: if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { Daniel@0: groups = tokenize( selector ); Daniel@0: Daniel@0: if ( (old = context.getAttribute("id")) ) { Daniel@0: nid = old.replace( rescape, "\\$&" ); Daniel@0: } else { Daniel@0: context.setAttribute( "id", nid ); Daniel@0: } Daniel@0: nid = "[id='" + nid + "'] "; Daniel@0: Daniel@0: i = groups.length; Daniel@0: while ( i-- ) { Daniel@0: groups[i] = nid + toSelector( groups[i] ); Daniel@0: } Daniel@0: newContext = rsibling.test( selector ) && context.parentNode || context; Daniel@0: newSelector = groups.join(","); Daniel@0: } Daniel@0: Daniel@0: if ( newSelector ) { Daniel@0: try { Daniel@0: push.apply( results, Daniel@0: newContext.querySelectorAll( newSelector ) Daniel@0: ); Daniel@0: return results; Daniel@0: } catch(qsaError) { Daniel@0: } finally { Daniel@0: if ( !old ) { Daniel@0: context.removeAttribute("id"); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // All others Daniel@0: return select( selector.replace( rtrim, "$1" ), context, results, seed ); Daniel@0: } Daniel@0: Daniel@0: /** Daniel@0: * Create key-value caches of limited size Daniel@0: * @returns {Function(string, Object)} Returns the Object data after storing it on itself with Daniel@0: * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) Daniel@0: * deleting the oldest entry Daniel@0: */ Daniel@0: function createCache() { Daniel@0: var keys = []; Daniel@0: Daniel@0: function cache( key, value ) { Daniel@0: // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) Daniel@0: if ( keys.push( key += " " ) > Expr.cacheLength ) { Daniel@0: // Only keep the most recent entries Daniel@0: delete cache[ keys.shift() ]; Daniel@0: } Daniel@0: return (cache[ key ] = value); Daniel@0: } Daniel@0: return cache; Daniel@0: } Daniel@0: Daniel@0: /** Daniel@0: * Mark a function for special use by Sizzle Daniel@0: * @param {Function} fn The function to mark Daniel@0: */ Daniel@0: function markFunction( fn ) { Daniel@0: fn[ expando ] = true; Daniel@0: return fn; Daniel@0: } Daniel@0: Daniel@0: /** Daniel@0: * Support testing using an element Daniel@0: * @param {Function} fn Passed the created div and expects a boolean result Daniel@0: */ Daniel@0: function assert( fn ) { Daniel@0: var div = document.createElement("div"); Daniel@0: Daniel@0: try { Daniel@0: return !!fn( div ); Daniel@0: } catch (e) { Daniel@0: return false; Daniel@0: } finally { Daniel@0: // Remove from its parent by default Daniel@0: if ( div.parentNode ) { Daniel@0: div.parentNode.removeChild( div ); Daniel@0: } Daniel@0: // release memory in IE Daniel@0: div = null; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: /** Daniel@0: * Adds the same handler for all of the specified attrs Daniel@0: * @param {String} attrs Pipe-separated list of attributes Daniel@0: * @param {Function} handler The method that will be applied Daniel@0: */ Daniel@0: function addHandle( attrs, handler ) { Daniel@0: var arr = attrs.split("|"), Daniel@0: i = attrs.length; Daniel@0: Daniel@0: while ( i-- ) { Daniel@0: Expr.attrHandle[ arr[i] ] = handler; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: /** Daniel@0: * Checks document order of two siblings Daniel@0: * @param {Element} a Daniel@0: * @param {Element} b Daniel@0: * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b Daniel@0: */ Daniel@0: function siblingCheck( a, b ) { Daniel@0: var cur = b && a, Daniel@0: diff = cur && a.nodeType === 1 && b.nodeType === 1 && Daniel@0: ( ~b.sourceIndex || MAX_NEGATIVE ) - Daniel@0: ( ~a.sourceIndex || MAX_NEGATIVE ); Daniel@0: Daniel@0: // Use IE sourceIndex if available on both nodes Daniel@0: if ( diff ) { Daniel@0: return diff; Daniel@0: } Daniel@0: Daniel@0: // Check if b follows a Daniel@0: if ( cur ) { Daniel@0: while ( (cur = cur.nextSibling) ) { Daniel@0: if ( cur === b ) { Daniel@0: return -1; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return a ? 1 : -1; Daniel@0: } Daniel@0: Daniel@0: /** Daniel@0: * Returns a function to use in pseudos for input types Daniel@0: * @param {String} type Daniel@0: */ Daniel@0: function createInputPseudo( type ) { Daniel@0: return function( elem ) { Daniel@0: var name = elem.nodeName.toLowerCase(); Daniel@0: return name === "input" && elem.type === type; Daniel@0: }; Daniel@0: } Daniel@0: Daniel@0: /** Daniel@0: * Returns a function to use in pseudos for buttons Daniel@0: * @param {String} type Daniel@0: */ Daniel@0: function createButtonPseudo( type ) { Daniel@0: return function( elem ) { Daniel@0: var name = elem.nodeName.toLowerCase(); Daniel@0: return (name === "input" || name === "button") && elem.type === type; Daniel@0: }; Daniel@0: } Daniel@0: Daniel@0: /** Daniel@0: * Returns a function to use in pseudos for positionals Daniel@0: * @param {Function} fn Daniel@0: */ Daniel@0: function createPositionalPseudo( fn ) { Daniel@0: return markFunction(function( argument ) { Daniel@0: argument = +argument; Daniel@0: return markFunction(function( seed, matches ) { Daniel@0: var j, Daniel@0: matchIndexes = fn( [], seed.length, argument ), Daniel@0: i = matchIndexes.length; Daniel@0: Daniel@0: // Match elements found at the specified indexes Daniel@0: while ( i-- ) { Daniel@0: if ( seed[ (j = matchIndexes[i]) ] ) { Daniel@0: seed[j] = !(matches[j] = seed[j]); Daniel@0: } Daniel@0: } Daniel@0: }); Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: /** Daniel@0: * Detect xml Daniel@0: * @param {Element|Object} elem An element or a document Daniel@0: */ Daniel@0: isXML = Sizzle.isXML = function( elem ) { Daniel@0: // documentElement is verified for cases where it doesn't yet exist Daniel@0: // (such as loading iframes in IE - #4833) Daniel@0: var documentElement = elem && (elem.ownerDocument || elem).documentElement; Daniel@0: return documentElement ? documentElement.nodeName !== "HTML" : false; Daniel@0: }; Daniel@0: Daniel@0: // Expose support vars for convenience Daniel@0: support = Sizzle.support = {}; Daniel@0: Daniel@0: /** Daniel@0: * Sets document-related variables once based on the current document Daniel@0: * @param {Element|Object} [doc] An element or document object to use to set the document Daniel@0: * @returns {Object} Returns the current document Daniel@0: */ Daniel@0: setDocument = Sizzle.setDocument = function( node ) { Daniel@0: var doc = node ? node.ownerDocument || node : preferredDoc, Daniel@0: parent = doc.defaultView; Daniel@0: Daniel@0: // If no document and documentElement is available, return Daniel@0: if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { Daniel@0: return document; Daniel@0: } Daniel@0: Daniel@0: // Set our document Daniel@0: document = doc; Daniel@0: docElem = doc.documentElement; Daniel@0: Daniel@0: // Support tests Daniel@0: documentIsHTML = !isXML( doc ); Daniel@0: Daniel@0: // Support: IE>8 Daniel@0: // If iframe document is assigned to "document" variable and if iframe has been reloaded, Daniel@0: // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 Daniel@0: // IE6-8 do not support the defaultView property so parent will be undefined Daniel@0: if ( parent && parent.attachEvent && parent !== parent.top ) { Daniel@0: parent.attachEvent( "onbeforeunload", function() { Daniel@0: setDocument(); Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: /* Attributes Daniel@0: ---------------------------------------------------------------------- */ Daniel@0: Daniel@0: // Support: IE<8 Daniel@0: // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) Daniel@0: support.attributes = assert(function( div ) { Daniel@0: div.className = "i"; Daniel@0: return !div.getAttribute("className"); Daniel@0: }); Daniel@0: Daniel@0: /* getElement(s)By* Daniel@0: ---------------------------------------------------------------------- */ Daniel@0: Daniel@0: // Check if getElementsByTagName("*") returns only elements Daniel@0: support.getElementsByTagName = assert(function( div ) { Daniel@0: div.appendChild( doc.createComment("") ); Daniel@0: return !div.getElementsByTagName("*").length; Daniel@0: }); Daniel@0: Daniel@0: // Check if getElementsByClassName can be trusted Daniel@0: support.getElementsByClassName = assert(function( div ) { Daniel@0: div.innerHTML = "
"; Daniel@0: Daniel@0: // Support: Safari<4 Daniel@0: // Catch class over-caching Daniel@0: div.firstChild.className = "i"; Daniel@0: // Support: Opera<10 Daniel@0: // Catch gEBCN failure to find non-leading classes Daniel@0: return div.getElementsByClassName("i").length === 2; Daniel@0: }); Daniel@0: Daniel@0: // Support: IE<10 Daniel@0: // Check if getElementById returns elements by name Daniel@0: // The broken getElementById methods don't pick up programatically-set names, Daniel@0: // so use a roundabout getElementsByName test Daniel@0: support.getById = assert(function( div ) { Daniel@0: docElem.appendChild( div ).id = expando; Daniel@0: return !doc.getElementsByName || !doc.getElementsByName( expando ).length; Daniel@0: }); Daniel@0: Daniel@0: // ID find and filter Daniel@0: if ( support.getById ) { Daniel@0: Expr.find["ID"] = function( id, context ) { Daniel@0: if ( typeof context.getElementById !== strundefined && documentIsHTML ) { Daniel@0: var m = context.getElementById( id ); Daniel@0: // Check parentNode to catch when Blackberry 4.6 returns Daniel@0: // nodes that are no longer in the document #6963 Daniel@0: return m && m.parentNode ? [m] : []; Daniel@0: } Daniel@0: }; Daniel@0: Expr.filter["ID"] = function( id ) { Daniel@0: var attrId = id.replace( runescape, funescape ); Daniel@0: return function( elem ) { Daniel@0: return elem.getAttribute("id") === attrId; Daniel@0: }; Daniel@0: }; Daniel@0: } else { Daniel@0: // Support: IE6/7 Daniel@0: // getElementById is not reliable as a find shortcut Daniel@0: delete Expr.find["ID"]; Daniel@0: Daniel@0: Expr.filter["ID"] = function( id ) { Daniel@0: var attrId = id.replace( runescape, funescape ); Daniel@0: return function( elem ) { Daniel@0: var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); Daniel@0: return node && node.value === attrId; Daniel@0: }; Daniel@0: }; Daniel@0: } Daniel@0: Daniel@0: // Tag Daniel@0: Expr.find["TAG"] = support.getElementsByTagName ? Daniel@0: function( tag, context ) { Daniel@0: if ( typeof context.getElementsByTagName !== strundefined ) { Daniel@0: return context.getElementsByTagName( tag ); Daniel@0: } Daniel@0: } : Daniel@0: function( tag, context ) { Daniel@0: var elem, Daniel@0: tmp = [], Daniel@0: i = 0, Daniel@0: results = context.getElementsByTagName( tag ); Daniel@0: Daniel@0: // Filter out possible comments Daniel@0: if ( tag === "*" ) { Daniel@0: while ( (elem = results[i++]) ) { Daniel@0: if ( elem.nodeType === 1 ) { Daniel@0: tmp.push( elem ); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return tmp; Daniel@0: } Daniel@0: return results; Daniel@0: }; Daniel@0: Daniel@0: // Class Daniel@0: Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { Daniel@0: if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { Daniel@0: return context.getElementsByClassName( className ); Daniel@0: } Daniel@0: }; Daniel@0: Daniel@0: /* QSA/matchesSelector Daniel@0: ---------------------------------------------------------------------- */ Daniel@0: Daniel@0: // QSA and matchesSelector support Daniel@0: Daniel@0: // matchesSelector(:active) reports false when true (IE9/Opera 11.5) Daniel@0: rbuggyMatches = []; Daniel@0: Daniel@0: // qSa(:focus) reports false when true (Chrome 21) Daniel@0: // We allow this because of a bug in IE8/9 that throws an error Daniel@0: // whenever `document.activeElement` is accessed on an iframe Daniel@0: // So, we allow :focus to pass through QSA all the time to avoid the IE error Daniel@0: // See http://bugs.jquery.com/ticket/13378 Daniel@0: rbuggyQSA = []; Daniel@0: Daniel@0: if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { Daniel@0: // Build QSA regex Daniel@0: // Regex strategy adopted from Diego Perini Daniel@0: assert(function( div ) { Daniel@0: // Select is set to empty string on purpose Daniel@0: // This is to test IE's treatment of not explicitly Daniel@0: // setting a boolean content attribute, Daniel@0: // since its presence should be enough Daniel@0: // http://bugs.jquery.com/ticket/12359 Daniel@0: div.innerHTML = ""; Daniel@0: Daniel@0: // Support: IE8 Daniel@0: // Boolean attributes and "value" are not treated correctly Daniel@0: if ( !div.querySelectorAll("[selected]").length ) { Daniel@0: rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); Daniel@0: } Daniel@0: Daniel@0: // Webkit/Opera - :checked should return selected option elements Daniel@0: // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked Daniel@0: // IE8 throws error here and will not see later tests Daniel@0: if ( !div.querySelectorAll(":checked").length ) { Daniel@0: rbuggyQSA.push(":checked"); Daniel@0: } Daniel@0: }); Daniel@0: Daniel@0: assert(function( div ) { Daniel@0: Daniel@0: // Support: Opera 10-12/IE8 Daniel@0: // ^= $= *= and empty values Daniel@0: // Should not select anything Daniel@0: // Support: Windows 8 Native Apps Daniel@0: // The type attribute is restricted during .innerHTML assignment Daniel@0: var input = doc.createElement("input"); Daniel@0: input.setAttribute( "type", "hidden" ); Daniel@0: div.appendChild( input ).setAttribute( "t", "" ); Daniel@0: Daniel@0: if ( div.querySelectorAll("[t^='']").length ) { Daniel@0: rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); Daniel@0: } Daniel@0: Daniel@0: // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) Daniel@0: // IE8 throws error here and will not see later tests Daniel@0: if ( !div.querySelectorAll(":enabled").length ) { Daniel@0: rbuggyQSA.push( ":enabled", ":disabled" ); Daniel@0: } Daniel@0: Daniel@0: // Opera 10-11 does not throw on post-comma invalid pseudos Daniel@0: div.querySelectorAll("*,:x"); Daniel@0: rbuggyQSA.push(",.*:"); Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector || Daniel@0: docElem.mozMatchesSelector || Daniel@0: docElem.oMatchesSelector || Daniel@0: docElem.msMatchesSelector) )) ) { Daniel@0: Daniel@0: assert(function( div ) { Daniel@0: // Check to see if it's possible to do matchesSelector Daniel@0: // on a disconnected node (IE 9) Daniel@0: support.disconnectedMatch = matches.call( div, "div" ); Daniel@0: Daniel@0: // This should fail with an exception Daniel@0: // Gecko does not error, returns false instead Daniel@0: matches.call( div, "[s!='']:x" ); Daniel@0: rbuggyMatches.push( "!=", pseudos ); Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); Daniel@0: rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); Daniel@0: Daniel@0: /* Contains Daniel@0: ---------------------------------------------------------------------- */ Daniel@0: Daniel@0: // Element contains another Daniel@0: // Purposefully does not implement inclusive descendent Daniel@0: // As in, an element does not contain itself Daniel@0: contains = rnative.test( docElem.contains ) || docElem.compareDocumentPosition ? Daniel@0: function( a, b ) { Daniel@0: var adown = a.nodeType === 9 ? a.documentElement : a, Daniel@0: bup = b && b.parentNode; Daniel@0: return a === bup || !!( bup && bup.nodeType === 1 && ( Daniel@0: adown.contains ? Daniel@0: adown.contains( bup ) : Daniel@0: a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 Daniel@0: )); Daniel@0: } : Daniel@0: function( a, b ) { Daniel@0: if ( b ) { Daniel@0: while ( (b = b.parentNode) ) { Daniel@0: if ( b === a ) { Daniel@0: return true; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: return false; Daniel@0: }; Daniel@0: Daniel@0: /* Sorting Daniel@0: ---------------------------------------------------------------------- */ Daniel@0: Daniel@0: // Document order sorting Daniel@0: sortOrder = docElem.compareDocumentPosition ? Daniel@0: function( a, b ) { Daniel@0: Daniel@0: // Flag for duplicate removal Daniel@0: if ( a === b ) { Daniel@0: hasDuplicate = true; Daniel@0: return 0; Daniel@0: } Daniel@0: Daniel@0: var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b ); Daniel@0: Daniel@0: if ( compare ) { Daniel@0: // Disconnected nodes Daniel@0: if ( compare & 1 || Daniel@0: (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { Daniel@0: Daniel@0: // Choose the first element that is related to our preferred document Daniel@0: if ( a === doc || contains(preferredDoc, a) ) { Daniel@0: return -1; Daniel@0: } Daniel@0: if ( b === doc || contains(preferredDoc, b) ) { Daniel@0: return 1; Daniel@0: } Daniel@0: Daniel@0: // Maintain original order Daniel@0: return sortInput ? Daniel@0: ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : Daniel@0: 0; Daniel@0: } Daniel@0: Daniel@0: return compare & 4 ? -1 : 1; Daniel@0: } Daniel@0: Daniel@0: // Not directly comparable, sort on existence of method Daniel@0: return a.compareDocumentPosition ? -1 : 1; Daniel@0: } : Daniel@0: function( a, b ) { Daniel@0: var cur, Daniel@0: i = 0, Daniel@0: aup = a.parentNode, Daniel@0: bup = b.parentNode, Daniel@0: ap = [ a ], Daniel@0: bp = [ b ]; Daniel@0: Daniel@0: // Exit early if the nodes are identical Daniel@0: if ( a === b ) { Daniel@0: hasDuplicate = true; Daniel@0: return 0; Daniel@0: Daniel@0: // Parentless nodes are either documents or disconnected Daniel@0: } else if ( !aup || !bup ) { Daniel@0: return a === doc ? -1 : Daniel@0: b === doc ? 1 : Daniel@0: aup ? -1 : Daniel@0: bup ? 1 : Daniel@0: sortInput ? Daniel@0: ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : Daniel@0: 0; Daniel@0: Daniel@0: // If the nodes are siblings, we can do a quick check Daniel@0: } else if ( aup === bup ) { Daniel@0: return siblingCheck( a, b ); Daniel@0: } Daniel@0: Daniel@0: // Otherwise we need full lists of their ancestors for comparison Daniel@0: cur = a; Daniel@0: while ( (cur = cur.parentNode) ) { Daniel@0: ap.unshift( cur ); Daniel@0: } Daniel@0: cur = b; Daniel@0: while ( (cur = cur.parentNode) ) { Daniel@0: bp.unshift( cur ); Daniel@0: } Daniel@0: Daniel@0: // Walk down the tree looking for a discrepancy Daniel@0: while ( ap[i] === bp[i] ) { Daniel@0: i++; Daniel@0: } Daniel@0: Daniel@0: return i ? Daniel@0: // Do a sibling check if the nodes have a common ancestor Daniel@0: siblingCheck( ap[i], bp[i] ) : Daniel@0: Daniel@0: // Otherwise nodes in our document sort first Daniel@0: ap[i] === preferredDoc ? -1 : Daniel@0: bp[i] === preferredDoc ? 1 : Daniel@0: 0; Daniel@0: }; Daniel@0: Daniel@0: return doc; Daniel@0: }; Daniel@0: Daniel@0: Sizzle.matches = function( expr, elements ) { Daniel@0: return Sizzle( expr, null, null, elements ); Daniel@0: }; Daniel@0: Daniel@0: Sizzle.matchesSelector = function( elem, expr ) { Daniel@0: // Set document vars if needed Daniel@0: if ( ( elem.ownerDocument || elem ) !== document ) { Daniel@0: setDocument( elem ); Daniel@0: } Daniel@0: Daniel@0: // Make sure that attribute selectors are quoted Daniel@0: expr = expr.replace( rattributeQuotes, "='$1']" ); Daniel@0: Daniel@0: if ( support.matchesSelector && documentIsHTML && Daniel@0: ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && Daniel@0: ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { Daniel@0: Daniel@0: try { Daniel@0: var ret = matches.call( elem, expr ); Daniel@0: Daniel@0: // IE 9's matchesSelector returns false on disconnected nodes Daniel@0: if ( ret || support.disconnectedMatch || Daniel@0: // As well, disconnected nodes are said to be in a document Daniel@0: // fragment in IE 9 Daniel@0: elem.document && elem.document.nodeType !== 11 ) { Daniel@0: return ret; Daniel@0: } Daniel@0: } catch(e) {} Daniel@0: } Daniel@0: Daniel@0: return Sizzle( expr, document, null, [elem] ).length > 0; Daniel@0: }; Daniel@0: Daniel@0: Sizzle.contains = function( context, elem ) { Daniel@0: // Set document vars if needed Daniel@0: if ( ( context.ownerDocument || context ) !== document ) { Daniel@0: setDocument( context ); Daniel@0: } Daniel@0: return contains( context, elem ); Daniel@0: }; Daniel@0: Daniel@0: Sizzle.attr = function( elem, name ) { Daniel@0: // Set document vars if needed Daniel@0: if ( ( elem.ownerDocument || elem ) !== document ) { Daniel@0: setDocument( elem ); Daniel@0: } Daniel@0: Daniel@0: var fn = Expr.attrHandle[ name.toLowerCase() ], Daniel@0: // Don't get fooled by Object.prototype properties (jQuery #13807) Daniel@0: val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? Daniel@0: fn( elem, name, !documentIsHTML ) : Daniel@0: undefined; Daniel@0: Daniel@0: return val === undefined ? Daniel@0: support.attributes || !documentIsHTML ? Daniel@0: elem.getAttribute( name ) : Daniel@0: (val = elem.getAttributeNode(name)) && val.specified ? Daniel@0: val.value : Daniel@0: null : Daniel@0: val; Daniel@0: }; Daniel@0: Daniel@0: Sizzle.error = function( msg ) { Daniel@0: throw new Error( "Syntax error, unrecognized expression: " + msg ); Daniel@0: }; Daniel@0: Daniel@0: /** Daniel@0: * Document sorting and removing duplicates Daniel@0: * @param {ArrayLike} results Daniel@0: */ Daniel@0: Sizzle.uniqueSort = function( results ) { Daniel@0: var elem, Daniel@0: duplicates = [], Daniel@0: j = 0, Daniel@0: i = 0; Daniel@0: Daniel@0: // Unless we *know* we can detect duplicates, assume their presence Daniel@0: hasDuplicate = !support.detectDuplicates; Daniel@0: sortInput = !support.sortStable && results.slice( 0 ); Daniel@0: results.sort( sortOrder ); Daniel@0: Daniel@0: if ( hasDuplicate ) { Daniel@0: while ( (elem = results[i++]) ) { Daniel@0: if ( elem === results[ i ] ) { Daniel@0: j = duplicates.push( i ); Daniel@0: } Daniel@0: } Daniel@0: while ( j-- ) { Daniel@0: results.splice( duplicates[ j ], 1 ); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return results; Daniel@0: }; Daniel@0: Daniel@0: /** Daniel@0: * Utility function for retrieving the text value of an array of DOM nodes Daniel@0: * @param {Array|Element} elem Daniel@0: */ Daniel@0: getText = Sizzle.getText = function( elem ) { Daniel@0: var node, Daniel@0: ret = "", Daniel@0: i = 0, Daniel@0: nodeType = elem.nodeType; Daniel@0: Daniel@0: if ( !nodeType ) { Daniel@0: // If no nodeType, this is expected to be an array Daniel@0: for ( ; (node = elem[i]); i++ ) { Daniel@0: // Do not traverse comment nodes Daniel@0: ret += getText( node ); Daniel@0: } Daniel@0: } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { Daniel@0: // Use textContent for elements Daniel@0: // innerText usage removed for consistency of new lines (see #11153) Daniel@0: if ( typeof elem.textContent === "string" ) { Daniel@0: return elem.textContent; Daniel@0: } else { Daniel@0: // Traverse its children Daniel@0: for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { Daniel@0: ret += getText( elem ); Daniel@0: } Daniel@0: } Daniel@0: } else if ( nodeType === 3 || nodeType === 4 ) { Daniel@0: return elem.nodeValue; Daniel@0: } Daniel@0: // Do not include comment or processing instruction nodes Daniel@0: Daniel@0: return ret; Daniel@0: }; Daniel@0: Daniel@0: Expr = Sizzle.selectors = { Daniel@0: Daniel@0: // Can be adjusted by the user Daniel@0: cacheLength: 50, Daniel@0: Daniel@0: createPseudo: markFunction, Daniel@0: Daniel@0: match: matchExpr, Daniel@0: Daniel@0: attrHandle: {}, Daniel@0: Daniel@0: find: {}, Daniel@0: Daniel@0: relative: { Daniel@0: ">": { dir: "parentNode", first: true }, Daniel@0: " ": { dir: "parentNode" }, Daniel@0: "+": { dir: "previousSibling", first: true }, Daniel@0: "~": { dir: "previousSibling" } Daniel@0: }, Daniel@0: Daniel@0: preFilter: { Daniel@0: "ATTR": function( match ) { Daniel@0: match[1] = match[1].replace( runescape, funescape ); Daniel@0: Daniel@0: // Move the given value to match[3] whether quoted or unquoted Daniel@0: match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); Daniel@0: Daniel@0: if ( match[2] === "~=" ) { Daniel@0: match[3] = " " + match[3] + " "; Daniel@0: } Daniel@0: Daniel@0: return match.slice( 0, 4 ); Daniel@0: }, Daniel@0: Daniel@0: "CHILD": function( match ) { Daniel@0: /* matches from matchExpr["CHILD"] Daniel@0: 1 type (only|nth|...) Daniel@0: 2 what (child|of-type) Daniel@0: 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) Daniel@0: 4 xn-component of xn+y argument ([+-]?\d*n|) Daniel@0: 5 sign of xn-component Daniel@0: 6 x of xn-component Daniel@0: 7 sign of y-component Daniel@0: 8 y of y-component Daniel@0: */ Daniel@0: match[1] = match[1].toLowerCase(); Daniel@0: Daniel@0: if ( match[1].slice( 0, 3 ) === "nth" ) { Daniel@0: // nth-* requires argument Daniel@0: if ( !match[3] ) { Daniel@0: Sizzle.error( match[0] ); Daniel@0: } Daniel@0: Daniel@0: // numeric x and y parameters for Expr.filter.CHILD Daniel@0: // remember that false/true cast respectively to 0/1 Daniel@0: match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); Daniel@0: match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); Daniel@0: Daniel@0: // other types prohibit arguments Daniel@0: } else if ( match[3] ) { Daniel@0: Sizzle.error( match[0] ); Daniel@0: } Daniel@0: Daniel@0: return match; Daniel@0: }, Daniel@0: Daniel@0: "PSEUDO": function( match ) { Daniel@0: var excess, Daniel@0: unquoted = !match[5] && match[2]; Daniel@0: Daniel@0: if ( matchExpr["CHILD"].test( match[0] ) ) { Daniel@0: return null; Daniel@0: } Daniel@0: Daniel@0: // Accept quoted arguments as-is Daniel@0: if ( match[3] && match[4] !== undefined ) { Daniel@0: match[2] = match[4]; Daniel@0: Daniel@0: // Strip excess characters from unquoted arguments Daniel@0: } else if ( unquoted && rpseudo.test( unquoted ) && Daniel@0: // Get excess from tokenize (recursively) Daniel@0: (excess = tokenize( unquoted, true )) && Daniel@0: // advance to the next closing parenthesis Daniel@0: (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { Daniel@0: Daniel@0: // excess is a negative index Daniel@0: match[0] = match[0].slice( 0, excess ); Daniel@0: match[2] = unquoted.slice( 0, excess ); Daniel@0: } Daniel@0: Daniel@0: // Return only captures needed by the pseudo filter method (type and argument) Daniel@0: return match.slice( 0, 3 ); Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: filter: { Daniel@0: Daniel@0: "TAG": function( nodeNameSelector ) { Daniel@0: var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); Daniel@0: return nodeNameSelector === "*" ? Daniel@0: function() { return true; } : Daniel@0: function( elem ) { Daniel@0: return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; Daniel@0: }; Daniel@0: }, Daniel@0: Daniel@0: "CLASS": function( className ) { Daniel@0: var pattern = classCache[ className + " " ]; Daniel@0: Daniel@0: return pattern || Daniel@0: (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && Daniel@0: classCache( className, function( elem ) { Daniel@0: return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" ); Daniel@0: }); Daniel@0: }, Daniel@0: Daniel@0: "ATTR": function( name, operator, check ) { Daniel@0: return function( elem ) { Daniel@0: var result = Sizzle.attr( elem, name ); Daniel@0: Daniel@0: if ( result == null ) { Daniel@0: return operator === "!="; Daniel@0: } Daniel@0: if ( !operator ) { Daniel@0: return true; Daniel@0: } Daniel@0: Daniel@0: result += ""; Daniel@0: Daniel@0: return operator === "=" ? result === check : Daniel@0: operator === "!=" ? result !== check : Daniel@0: operator === "^=" ? check && result.indexOf( check ) === 0 : Daniel@0: operator === "*=" ? check && result.indexOf( check ) > -1 : Daniel@0: operator === "$=" ? check && result.slice( -check.length ) === check : Daniel@0: operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : Daniel@0: operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : Daniel@0: false; Daniel@0: }; Daniel@0: }, Daniel@0: Daniel@0: "CHILD": function( type, what, argument, first, last ) { Daniel@0: var simple = type.slice( 0, 3 ) !== "nth", Daniel@0: forward = type.slice( -4 ) !== "last", Daniel@0: ofType = what === "of-type"; Daniel@0: Daniel@0: return first === 1 && last === 0 ? Daniel@0: Daniel@0: // Shortcut for :nth-*(n) Daniel@0: function( elem ) { Daniel@0: return !!elem.parentNode; Daniel@0: } : Daniel@0: Daniel@0: function( elem, context, xml ) { Daniel@0: var cache, outerCache, node, diff, nodeIndex, start, Daniel@0: dir = simple !== forward ? "nextSibling" : "previousSibling", Daniel@0: parent = elem.parentNode, Daniel@0: name = ofType && elem.nodeName.toLowerCase(), Daniel@0: useCache = !xml && !ofType; Daniel@0: Daniel@0: if ( parent ) { Daniel@0: Daniel@0: // :(first|last|only)-(child|of-type) Daniel@0: if ( simple ) { Daniel@0: while ( dir ) { Daniel@0: node = elem; Daniel@0: while ( (node = node[ dir ]) ) { Daniel@0: if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { Daniel@0: return false; Daniel@0: } Daniel@0: } Daniel@0: // Reverse direction for :only-* (if we haven't yet done so) Daniel@0: start = dir = type === "only" && !start && "nextSibling"; Daniel@0: } Daniel@0: return true; Daniel@0: } Daniel@0: Daniel@0: start = [ forward ? parent.firstChild : parent.lastChild ]; Daniel@0: Daniel@0: // non-xml :nth-child(...) stores cache data on `parent` Daniel@0: if ( forward && useCache ) { Daniel@0: // Seek `elem` from a previously-cached index Daniel@0: outerCache = parent[ expando ] || (parent[ expando ] = {}); Daniel@0: cache = outerCache[ type ] || []; Daniel@0: nodeIndex = cache[0] === dirruns && cache[1]; Daniel@0: diff = cache[0] === dirruns && cache[2]; Daniel@0: node = nodeIndex && parent.childNodes[ nodeIndex ]; Daniel@0: Daniel@0: while ( (node = ++nodeIndex && node && node[ dir ] || Daniel@0: Daniel@0: // Fallback to seeking `elem` from the start Daniel@0: (diff = nodeIndex = 0) || start.pop()) ) { Daniel@0: Daniel@0: // When found, cache indexes on `parent` and break Daniel@0: if ( node.nodeType === 1 && ++diff && node === elem ) { Daniel@0: outerCache[ type ] = [ dirruns, nodeIndex, diff ]; Daniel@0: break; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Use previously-cached element index if available Daniel@0: } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { Daniel@0: diff = cache[1]; Daniel@0: Daniel@0: // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) Daniel@0: } else { Daniel@0: // Use the same loop as above to seek `elem` from the start Daniel@0: while ( (node = ++nodeIndex && node && node[ dir ] || Daniel@0: (diff = nodeIndex = 0) || start.pop()) ) { Daniel@0: Daniel@0: if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { Daniel@0: // Cache the index of each encountered element Daniel@0: if ( useCache ) { Daniel@0: (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; Daniel@0: } Daniel@0: Daniel@0: if ( node === elem ) { Daniel@0: break; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Incorporate the offset, then check against cycle size Daniel@0: diff -= last; Daniel@0: return diff === first || ( diff % first === 0 && diff / first >= 0 ); Daniel@0: } Daniel@0: }; Daniel@0: }, Daniel@0: Daniel@0: "PSEUDO": function( pseudo, argument ) { Daniel@0: // pseudo-class names are case-insensitive Daniel@0: // http://www.w3.org/TR/selectors/#pseudo-classes Daniel@0: // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters Daniel@0: // Remember that setFilters inherits from pseudos Daniel@0: var args, Daniel@0: fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || Daniel@0: Sizzle.error( "unsupported pseudo: " + pseudo ); Daniel@0: Daniel@0: // The user may use createPseudo to indicate that Daniel@0: // arguments are needed to create the filter function Daniel@0: // just as Sizzle does Daniel@0: if ( fn[ expando ] ) { Daniel@0: return fn( argument ); Daniel@0: } Daniel@0: Daniel@0: // But maintain support for old signatures Daniel@0: if ( fn.length > 1 ) { Daniel@0: args = [ pseudo, pseudo, "", argument ]; Daniel@0: return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? Daniel@0: markFunction(function( seed, matches ) { Daniel@0: var idx, Daniel@0: matched = fn( seed, argument ), Daniel@0: i = matched.length; Daniel@0: while ( i-- ) { Daniel@0: idx = indexOf.call( seed, matched[i] ); Daniel@0: seed[ idx ] = !( matches[ idx ] = matched[i] ); Daniel@0: } Daniel@0: }) : Daniel@0: function( elem ) { Daniel@0: return fn( elem, 0, args ); Daniel@0: }; Daniel@0: } Daniel@0: Daniel@0: return fn; Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: pseudos: { Daniel@0: // Potentially complex pseudos Daniel@0: "not": markFunction(function( selector ) { Daniel@0: // Trim the selector passed to compile Daniel@0: // to avoid treating leading and trailing Daniel@0: // spaces as combinators Daniel@0: var input = [], Daniel@0: results = [], Daniel@0: matcher = compile( selector.replace( rtrim, "$1" ) ); Daniel@0: Daniel@0: return matcher[ expando ] ? Daniel@0: markFunction(function( seed, matches, context, xml ) { Daniel@0: var elem, Daniel@0: unmatched = matcher( seed, null, xml, [] ), Daniel@0: i = seed.length; Daniel@0: Daniel@0: // Match elements unmatched by `matcher` Daniel@0: while ( i-- ) { Daniel@0: if ( (elem = unmatched[i]) ) { Daniel@0: seed[i] = !(matches[i] = elem); Daniel@0: } Daniel@0: } Daniel@0: }) : Daniel@0: function( elem, context, xml ) { Daniel@0: input[0] = elem; Daniel@0: matcher( input, null, xml, results ); Daniel@0: return !results.pop(); Daniel@0: }; Daniel@0: }), Daniel@0: Daniel@0: "has": markFunction(function( selector ) { Daniel@0: return function( elem ) { Daniel@0: return Sizzle( selector, elem ).length > 0; Daniel@0: }; Daniel@0: }), Daniel@0: Daniel@0: "contains": markFunction(function( text ) { Daniel@0: return function( elem ) { Daniel@0: return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; Daniel@0: }; Daniel@0: }), Daniel@0: Daniel@0: // "Whether an element is represented by a :lang() selector Daniel@0: // is based solely on the element's language value Daniel@0: // being equal to the identifier C, Daniel@0: // or beginning with the identifier C immediately followed by "-". Daniel@0: // The matching of C against the element's language value is performed case-insensitively. Daniel@0: // The identifier C does not have to be a valid language name." Daniel@0: // http://www.w3.org/TR/selectors/#lang-pseudo Daniel@0: "lang": markFunction( function( lang ) { Daniel@0: // lang value must be a valid identifier Daniel@0: if ( !ridentifier.test(lang || "") ) { Daniel@0: Sizzle.error( "unsupported lang: " + lang ); Daniel@0: } Daniel@0: lang = lang.replace( runescape, funescape ).toLowerCase(); Daniel@0: return function( elem ) { Daniel@0: var elemLang; Daniel@0: do { Daniel@0: if ( (elemLang = documentIsHTML ? Daniel@0: elem.lang : Daniel@0: elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { Daniel@0: Daniel@0: elemLang = elemLang.toLowerCase(); Daniel@0: return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; Daniel@0: } Daniel@0: } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); Daniel@0: return false; Daniel@0: }; Daniel@0: }), Daniel@0: Daniel@0: // Miscellaneous Daniel@0: "target": function( elem ) { Daniel@0: var hash = window.location && window.location.hash; Daniel@0: return hash && hash.slice( 1 ) === elem.id; Daniel@0: }, Daniel@0: Daniel@0: "root": function( elem ) { Daniel@0: return elem === docElem; Daniel@0: }, Daniel@0: Daniel@0: "focus": function( elem ) { Daniel@0: return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); Daniel@0: }, Daniel@0: Daniel@0: // Boolean properties Daniel@0: "enabled": function( elem ) { Daniel@0: return elem.disabled === false; Daniel@0: }, Daniel@0: Daniel@0: "disabled": function( elem ) { Daniel@0: return elem.disabled === true; Daniel@0: }, Daniel@0: Daniel@0: "checked": function( elem ) { Daniel@0: // In CSS3, :checked should return both checked and selected elements Daniel@0: // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked Daniel@0: var nodeName = elem.nodeName.toLowerCase(); Daniel@0: return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); Daniel@0: }, Daniel@0: Daniel@0: "selected": function( elem ) { Daniel@0: // Accessing this property makes selected-by-default Daniel@0: // options in Safari work properly Daniel@0: if ( elem.parentNode ) { Daniel@0: elem.parentNode.selectedIndex; Daniel@0: } Daniel@0: Daniel@0: return elem.selected === true; Daniel@0: }, Daniel@0: Daniel@0: // Contents Daniel@0: "empty": function( elem ) { Daniel@0: // http://www.w3.org/TR/selectors/#empty-pseudo Daniel@0: // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), Daniel@0: // not comment, processing instructions, or others Daniel@0: // Thanks to Diego Perini for the nodeName shortcut Daniel@0: // Greater than "@" means alpha characters (specifically not starting with "#" or "?") Daniel@0: for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { Daniel@0: if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) { Daniel@0: return false; Daniel@0: } Daniel@0: } Daniel@0: return true; Daniel@0: }, Daniel@0: Daniel@0: "parent": function( elem ) { Daniel@0: return !Expr.pseudos["empty"]( elem ); Daniel@0: }, Daniel@0: Daniel@0: // Element/input types Daniel@0: "header": function( elem ) { Daniel@0: return rheader.test( elem.nodeName ); Daniel@0: }, Daniel@0: Daniel@0: "input": function( elem ) { Daniel@0: return rinputs.test( elem.nodeName ); Daniel@0: }, Daniel@0: Daniel@0: "button": function( elem ) { Daniel@0: var name = elem.nodeName.toLowerCase(); Daniel@0: return name === "input" && elem.type === "button" || name === "button"; Daniel@0: }, Daniel@0: Daniel@0: "text": function( elem ) { Daniel@0: var attr; Daniel@0: // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) Daniel@0: // use getAttribute instead to test this case Daniel@0: return elem.nodeName.toLowerCase() === "input" && Daniel@0: elem.type === "text" && Daniel@0: ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type ); Daniel@0: }, Daniel@0: Daniel@0: // Position-in-collection Daniel@0: "first": createPositionalPseudo(function() { Daniel@0: return [ 0 ]; Daniel@0: }), Daniel@0: Daniel@0: "last": createPositionalPseudo(function( matchIndexes, length ) { Daniel@0: return [ length - 1 ]; Daniel@0: }), Daniel@0: Daniel@0: "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { Daniel@0: return [ argument < 0 ? argument + length : argument ]; Daniel@0: }), Daniel@0: Daniel@0: "even": createPositionalPseudo(function( matchIndexes, length ) { Daniel@0: var i = 0; Daniel@0: for ( ; i < length; i += 2 ) { Daniel@0: matchIndexes.push( i ); Daniel@0: } Daniel@0: return matchIndexes; Daniel@0: }), Daniel@0: Daniel@0: "odd": createPositionalPseudo(function( matchIndexes, length ) { Daniel@0: var i = 1; Daniel@0: for ( ; i < length; i += 2 ) { Daniel@0: matchIndexes.push( i ); Daniel@0: } Daniel@0: return matchIndexes; Daniel@0: }), Daniel@0: Daniel@0: "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { Daniel@0: var i = argument < 0 ? argument + length : argument; Daniel@0: for ( ; --i >= 0; ) { Daniel@0: matchIndexes.push( i ); Daniel@0: } Daniel@0: return matchIndexes; Daniel@0: }), Daniel@0: Daniel@0: "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { Daniel@0: var i = argument < 0 ? argument + length : argument; Daniel@0: for ( ; ++i < length; ) { Daniel@0: matchIndexes.push( i ); Daniel@0: } Daniel@0: return matchIndexes; Daniel@0: }) Daniel@0: } Daniel@0: }; Daniel@0: Daniel@0: Expr.pseudos["nth"] = Expr.pseudos["eq"]; Daniel@0: Daniel@0: // Add button/input type pseudos Daniel@0: for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { Daniel@0: Expr.pseudos[ i ] = createInputPseudo( i ); Daniel@0: } Daniel@0: for ( i in { submit: true, reset: true } ) { Daniel@0: Expr.pseudos[ i ] = createButtonPseudo( i ); Daniel@0: } Daniel@0: Daniel@0: // Easy API for creating new setFilters Daniel@0: function setFilters() {} Daniel@0: setFilters.prototype = Expr.filters = Expr.pseudos; Daniel@0: Expr.setFilters = new setFilters(); Daniel@0: Daniel@0: function tokenize( selector, parseOnly ) { Daniel@0: var matched, match, tokens, type, Daniel@0: soFar, groups, preFilters, Daniel@0: cached = tokenCache[ selector + " " ]; Daniel@0: Daniel@0: if ( cached ) { Daniel@0: return parseOnly ? 0 : cached.slice( 0 ); Daniel@0: } Daniel@0: Daniel@0: soFar = selector; Daniel@0: groups = []; Daniel@0: preFilters = Expr.preFilter; Daniel@0: Daniel@0: while ( soFar ) { Daniel@0: Daniel@0: // Comma and first run Daniel@0: if ( !matched || (match = rcomma.exec( soFar )) ) { Daniel@0: if ( match ) { Daniel@0: // Don't consume trailing commas as valid Daniel@0: soFar = soFar.slice( match[0].length ) || soFar; Daniel@0: } Daniel@0: groups.push( tokens = [] ); Daniel@0: } Daniel@0: Daniel@0: matched = false; Daniel@0: Daniel@0: // Combinators Daniel@0: if ( (match = rcombinators.exec( soFar )) ) { Daniel@0: matched = match.shift(); Daniel@0: tokens.push({ Daniel@0: value: matched, Daniel@0: // Cast descendant combinators to space Daniel@0: type: match[0].replace( rtrim, " " ) Daniel@0: }); Daniel@0: soFar = soFar.slice( matched.length ); Daniel@0: } Daniel@0: Daniel@0: // Filters Daniel@0: for ( type in Expr.filter ) { Daniel@0: if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || Daniel@0: (match = preFilters[ type ]( match ))) ) { Daniel@0: matched = match.shift(); Daniel@0: tokens.push({ Daniel@0: value: matched, Daniel@0: type: type, Daniel@0: matches: match Daniel@0: }); Daniel@0: soFar = soFar.slice( matched.length ); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: if ( !matched ) { Daniel@0: break; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Return the length of the invalid excess Daniel@0: // if we're just parsing Daniel@0: // Otherwise, throw an error or return tokens Daniel@0: return parseOnly ? Daniel@0: soFar.length : Daniel@0: soFar ? Daniel@0: Sizzle.error( selector ) : Daniel@0: // Cache the tokens Daniel@0: tokenCache( selector, groups ).slice( 0 ); Daniel@0: } Daniel@0: Daniel@0: function toSelector( tokens ) { Daniel@0: var i = 0, Daniel@0: len = tokens.length, Daniel@0: selector = ""; Daniel@0: for ( ; i < len; i++ ) { Daniel@0: selector += tokens[i].value; Daniel@0: } Daniel@0: return selector; Daniel@0: } Daniel@0: Daniel@0: function addCombinator( matcher, combinator, base ) { Daniel@0: var dir = combinator.dir, Daniel@0: checkNonElements = base && dir === "parentNode", Daniel@0: doneName = done++; Daniel@0: Daniel@0: return combinator.first ? Daniel@0: // Check against closest ancestor/preceding element Daniel@0: function( elem, context, xml ) { Daniel@0: while ( (elem = elem[ dir ]) ) { Daniel@0: if ( elem.nodeType === 1 || checkNonElements ) { Daniel@0: return matcher( elem, context, xml ); Daniel@0: } Daniel@0: } Daniel@0: } : Daniel@0: Daniel@0: // Check against all ancestor/preceding elements Daniel@0: function( elem, context, xml ) { Daniel@0: var data, cache, outerCache, Daniel@0: dirkey = dirruns + " " + doneName; Daniel@0: Daniel@0: // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching Daniel@0: if ( xml ) { Daniel@0: while ( (elem = elem[ dir ]) ) { Daniel@0: if ( elem.nodeType === 1 || checkNonElements ) { Daniel@0: if ( matcher( elem, context, xml ) ) { Daniel@0: return true; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: } else { Daniel@0: while ( (elem = elem[ dir ]) ) { Daniel@0: if ( elem.nodeType === 1 || checkNonElements ) { Daniel@0: outerCache = elem[ expando ] || (elem[ expando ] = {}); Daniel@0: if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { Daniel@0: if ( (data = cache[1]) === true || data === cachedruns ) { Daniel@0: return data === true; Daniel@0: } Daniel@0: } else { Daniel@0: cache = outerCache[ dir ] = [ dirkey ]; Daniel@0: cache[1] = matcher( elem, context, xml ) || cachedruns; Daniel@0: if ( cache[1] === true ) { Daniel@0: return true; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: }; Daniel@0: } Daniel@0: Daniel@0: function elementMatcher( matchers ) { Daniel@0: return matchers.length > 1 ? Daniel@0: function( elem, context, xml ) { Daniel@0: var i = matchers.length; Daniel@0: while ( i-- ) { Daniel@0: if ( !matchers[i]( elem, context, xml ) ) { Daniel@0: return false; Daniel@0: } Daniel@0: } Daniel@0: return true; Daniel@0: } : Daniel@0: matchers[0]; Daniel@0: } Daniel@0: Daniel@0: function condense( unmatched, map, filter, context, xml ) { Daniel@0: var elem, Daniel@0: newUnmatched = [], Daniel@0: i = 0, Daniel@0: len = unmatched.length, Daniel@0: mapped = map != null; Daniel@0: Daniel@0: for ( ; i < len; i++ ) { Daniel@0: if ( (elem = unmatched[i]) ) { Daniel@0: if ( !filter || filter( elem, context, xml ) ) { Daniel@0: newUnmatched.push( elem ); Daniel@0: if ( mapped ) { Daniel@0: map.push( i ); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return newUnmatched; Daniel@0: } Daniel@0: Daniel@0: function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { Daniel@0: if ( postFilter && !postFilter[ expando ] ) { Daniel@0: postFilter = setMatcher( postFilter ); Daniel@0: } Daniel@0: if ( postFinder && !postFinder[ expando ] ) { Daniel@0: postFinder = setMatcher( postFinder, postSelector ); Daniel@0: } Daniel@0: return markFunction(function( seed, results, context, xml ) { Daniel@0: var temp, i, elem, Daniel@0: preMap = [], Daniel@0: postMap = [], Daniel@0: preexisting = results.length, Daniel@0: Daniel@0: // Get initial elements from seed or context Daniel@0: elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), Daniel@0: Daniel@0: // Prefilter to get matcher input, preserving a map for seed-results synchronization Daniel@0: matcherIn = preFilter && ( seed || !selector ) ? Daniel@0: condense( elems, preMap, preFilter, context, xml ) : Daniel@0: elems, Daniel@0: Daniel@0: matcherOut = matcher ? Daniel@0: // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, Daniel@0: postFinder || ( seed ? preFilter : preexisting || postFilter ) ? Daniel@0: Daniel@0: // ...intermediate processing is necessary Daniel@0: [] : Daniel@0: Daniel@0: // ...otherwise use results directly Daniel@0: results : Daniel@0: matcherIn; Daniel@0: Daniel@0: // Find primary matches Daniel@0: if ( matcher ) { Daniel@0: matcher( matcherIn, matcherOut, context, xml ); Daniel@0: } Daniel@0: Daniel@0: // Apply postFilter Daniel@0: if ( postFilter ) { Daniel@0: temp = condense( matcherOut, postMap ); Daniel@0: postFilter( temp, [], context, xml ); Daniel@0: Daniel@0: // Un-match failing elements by moving them back to matcherIn Daniel@0: i = temp.length; Daniel@0: while ( i-- ) { Daniel@0: if ( (elem = temp[i]) ) { Daniel@0: matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: if ( seed ) { Daniel@0: if ( postFinder || preFilter ) { Daniel@0: if ( postFinder ) { Daniel@0: // Get the final matcherOut by condensing this intermediate into postFinder contexts Daniel@0: temp = []; Daniel@0: i = matcherOut.length; Daniel@0: while ( i-- ) { Daniel@0: if ( (elem = matcherOut[i]) ) { Daniel@0: // Restore matcherIn since elem is not yet a final match Daniel@0: temp.push( (matcherIn[i] = elem) ); Daniel@0: } Daniel@0: } Daniel@0: postFinder( null, (matcherOut = []), temp, xml ); Daniel@0: } Daniel@0: Daniel@0: // Move matched elements from seed to results to keep them synchronized Daniel@0: i = matcherOut.length; Daniel@0: while ( i-- ) { Daniel@0: if ( (elem = matcherOut[i]) && Daniel@0: (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { Daniel@0: Daniel@0: seed[temp] = !(results[temp] = elem); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Add elements to results, through postFinder if defined Daniel@0: } else { Daniel@0: matcherOut = condense( Daniel@0: matcherOut === results ? Daniel@0: matcherOut.splice( preexisting, matcherOut.length ) : Daniel@0: matcherOut Daniel@0: ); Daniel@0: if ( postFinder ) { Daniel@0: postFinder( null, results, matcherOut, xml ); Daniel@0: } else { Daniel@0: push.apply( results, matcherOut ); Daniel@0: } Daniel@0: } Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: function matcherFromTokens( tokens ) { Daniel@0: var checkContext, matcher, j, Daniel@0: len = tokens.length, Daniel@0: leadingRelative = Expr.relative[ tokens[0].type ], Daniel@0: implicitRelative = leadingRelative || Expr.relative[" "], Daniel@0: i = leadingRelative ? 1 : 0, Daniel@0: Daniel@0: // The foundational matcher ensures that elements are reachable from top-level context(s) Daniel@0: matchContext = addCombinator( function( elem ) { Daniel@0: return elem === checkContext; Daniel@0: }, implicitRelative, true ), Daniel@0: matchAnyContext = addCombinator( function( elem ) { Daniel@0: return indexOf.call( checkContext, elem ) > -1; Daniel@0: }, implicitRelative, true ), Daniel@0: matchers = [ function( elem, context, xml ) { Daniel@0: return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( Daniel@0: (checkContext = context).nodeType ? Daniel@0: matchContext( elem, context, xml ) : Daniel@0: matchAnyContext( elem, context, xml ) ); Daniel@0: } ]; Daniel@0: Daniel@0: for ( ; i < len; i++ ) { Daniel@0: if ( (matcher = Expr.relative[ tokens[i].type ]) ) { Daniel@0: matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; Daniel@0: } else { Daniel@0: matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); Daniel@0: Daniel@0: // Return special upon seeing a positional matcher Daniel@0: if ( matcher[ expando ] ) { Daniel@0: // Find the next relative operator (if any) for proper handling Daniel@0: j = ++i; Daniel@0: for ( ; j < len; j++ ) { Daniel@0: if ( Expr.relative[ tokens[j].type ] ) { Daniel@0: break; Daniel@0: } Daniel@0: } Daniel@0: return setMatcher( Daniel@0: i > 1 && elementMatcher( matchers ), Daniel@0: i > 1 && toSelector( Daniel@0: // If the preceding token was a descendant combinator, insert an implicit any-element `*` Daniel@0: tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) Daniel@0: ).replace( rtrim, "$1" ), Daniel@0: matcher, Daniel@0: i < j && matcherFromTokens( tokens.slice( i, j ) ), Daniel@0: j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), Daniel@0: j < len && toSelector( tokens ) Daniel@0: ); Daniel@0: } Daniel@0: matchers.push( matcher ); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return elementMatcher( matchers ); Daniel@0: } Daniel@0: Daniel@0: function matcherFromGroupMatchers( elementMatchers, setMatchers ) { Daniel@0: // A counter to specify which element is currently being matched Daniel@0: var matcherCachedRuns = 0, Daniel@0: bySet = setMatchers.length > 0, Daniel@0: byElement = elementMatchers.length > 0, Daniel@0: superMatcher = function( seed, context, xml, results, expandContext ) { Daniel@0: var elem, j, matcher, Daniel@0: setMatched = [], Daniel@0: matchedCount = 0, Daniel@0: i = "0", Daniel@0: unmatched = seed && [], Daniel@0: outermost = expandContext != null, Daniel@0: contextBackup = outermostContext, Daniel@0: // We must always have either seed elements or context Daniel@0: elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), Daniel@0: // Use integer dirruns iff this is the outermost matcher Daniel@0: dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1); Daniel@0: Daniel@0: if ( outermost ) { Daniel@0: outermostContext = context !== document && context; Daniel@0: cachedruns = matcherCachedRuns; Daniel@0: } Daniel@0: Daniel@0: // Add elements passing elementMatchers directly to results Daniel@0: // Keep `i` a string if there are no elements so `matchedCount` will be "00" below Daniel@0: for ( ; (elem = elems[i]) != null; i++ ) { Daniel@0: if ( byElement && elem ) { Daniel@0: j = 0; Daniel@0: while ( (matcher = elementMatchers[j++]) ) { Daniel@0: if ( matcher( elem, context, xml ) ) { Daniel@0: results.push( elem ); Daniel@0: break; Daniel@0: } Daniel@0: } Daniel@0: if ( outermost ) { Daniel@0: dirruns = dirrunsUnique; Daniel@0: cachedruns = ++matcherCachedRuns; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Track unmatched elements for set filters Daniel@0: if ( bySet ) { Daniel@0: // They will have gone through all possible matchers Daniel@0: if ( (elem = !matcher && elem) ) { Daniel@0: matchedCount--; Daniel@0: } Daniel@0: Daniel@0: // Lengthen the array for every element, matched or not Daniel@0: if ( seed ) { Daniel@0: unmatched.push( elem ); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Apply set filters to unmatched elements Daniel@0: matchedCount += i; Daniel@0: if ( bySet && i !== matchedCount ) { Daniel@0: j = 0; Daniel@0: while ( (matcher = setMatchers[j++]) ) { Daniel@0: matcher( unmatched, setMatched, context, xml ); Daniel@0: } Daniel@0: Daniel@0: if ( seed ) { Daniel@0: // Reintegrate element matches to eliminate the need for sorting Daniel@0: if ( matchedCount > 0 ) { Daniel@0: while ( i-- ) { Daniel@0: if ( !(unmatched[i] || setMatched[i]) ) { Daniel@0: setMatched[i] = pop.call( results ); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Discard index placeholder values to get only actual matches Daniel@0: setMatched = condense( setMatched ); Daniel@0: } Daniel@0: Daniel@0: // Add matches to results Daniel@0: push.apply( results, setMatched ); Daniel@0: Daniel@0: // Seedless set matches succeeding multiple successful matchers stipulate sorting Daniel@0: if ( outermost && !seed && setMatched.length > 0 && Daniel@0: ( matchedCount + setMatchers.length ) > 1 ) { Daniel@0: Daniel@0: Sizzle.uniqueSort( results ); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Override manipulation of globals by nested matchers Daniel@0: if ( outermost ) { Daniel@0: dirruns = dirrunsUnique; Daniel@0: outermostContext = contextBackup; Daniel@0: } Daniel@0: Daniel@0: return unmatched; Daniel@0: }; Daniel@0: Daniel@0: return bySet ? Daniel@0: markFunction( superMatcher ) : Daniel@0: superMatcher; Daniel@0: } Daniel@0: Daniel@0: compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { Daniel@0: var i, Daniel@0: setMatchers = [], Daniel@0: elementMatchers = [], Daniel@0: cached = compilerCache[ selector + " " ]; Daniel@0: Daniel@0: if ( !cached ) { Daniel@0: // Generate a function of recursive functions that can be used to check each element Daniel@0: if ( !group ) { Daniel@0: group = tokenize( selector ); Daniel@0: } Daniel@0: i = group.length; Daniel@0: while ( i-- ) { Daniel@0: cached = matcherFromTokens( group[i] ); Daniel@0: if ( cached[ expando ] ) { Daniel@0: setMatchers.push( cached ); Daniel@0: } else { Daniel@0: elementMatchers.push( cached ); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Cache the compiled function Daniel@0: cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); Daniel@0: } Daniel@0: return cached; Daniel@0: }; Daniel@0: Daniel@0: function multipleContexts( selector, contexts, results ) { Daniel@0: var i = 0, Daniel@0: len = contexts.length; Daniel@0: for ( ; i < len; i++ ) { Daniel@0: Sizzle( selector, contexts[i], results ); Daniel@0: } Daniel@0: return results; Daniel@0: } Daniel@0: Daniel@0: function select( selector, context, results, seed ) { Daniel@0: var i, tokens, token, type, find, Daniel@0: match = tokenize( selector ); Daniel@0: Daniel@0: if ( !seed ) { Daniel@0: // Try to minimize operations if there is only one group Daniel@0: if ( match.length === 1 ) { Daniel@0: Daniel@0: // Take a shortcut and set the context if the root selector is an ID Daniel@0: tokens = match[0] = match[0].slice( 0 ); Daniel@0: if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && Daniel@0: support.getById && context.nodeType === 9 && documentIsHTML && Daniel@0: Expr.relative[ tokens[1].type ] ) { Daniel@0: Daniel@0: context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; Daniel@0: if ( !context ) { Daniel@0: return results; Daniel@0: } Daniel@0: selector = selector.slice( tokens.shift().value.length ); Daniel@0: } Daniel@0: Daniel@0: // Fetch a seed set for right-to-left matching Daniel@0: i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; Daniel@0: while ( i-- ) { Daniel@0: token = tokens[i]; Daniel@0: Daniel@0: // Abort if we hit a combinator Daniel@0: if ( Expr.relative[ (type = token.type) ] ) { Daniel@0: break; Daniel@0: } Daniel@0: if ( (find = Expr.find[ type ]) ) { Daniel@0: // Search, expanding context for leading sibling combinators Daniel@0: if ( (seed = find( Daniel@0: token.matches[0].replace( runescape, funescape ), Daniel@0: rsibling.test( tokens[0].type ) && context.parentNode || context Daniel@0: )) ) { Daniel@0: Daniel@0: // If seed is empty or no tokens remain, we can return early Daniel@0: tokens.splice( i, 1 ); Daniel@0: selector = seed.length && toSelector( tokens ); Daniel@0: if ( !selector ) { Daniel@0: push.apply( results, seed ); Daniel@0: return results; Daniel@0: } Daniel@0: Daniel@0: break; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Compile and execute a filtering function Daniel@0: // Provide `match` to avoid retokenization if we modified the selector above Daniel@0: compile( selector, match )( Daniel@0: seed, Daniel@0: context, Daniel@0: !documentIsHTML, Daniel@0: results, Daniel@0: rsibling.test( selector ) Daniel@0: ); Daniel@0: return results; Daniel@0: } Daniel@0: Daniel@0: // One-time assignments Daniel@0: Daniel@0: // Sort stability Daniel@0: support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; Daniel@0: Daniel@0: // Support: Chrome<14 Daniel@0: // Always assume duplicates if they aren't passed to the comparison function Daniel@0: support.detectDuplicates = hasDuplicate; Daniel@0: Daniel@0: // Initialize against the default document Daniel@0: setDocument(); Daniel@0: Daniel@0: // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) Daniel@0: // Detached nodes confoundingly follow *each other* Daniel@0: support.sortDetached = assert(function( div1 ) { Daniel@0: // Should return 1, but returns 4 (following) Daniel@0: return div1.compareDocumentPosition( document.createElement("div") ) & 1; Daniel@0: }); Daniel@0: Daniel@0: // Support: IE<8 Daniel@0: // Prevent attribute/property "interpolation" Daniel@0: // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx Daniel@0: if ( !assert(function( div ) { Daniel@0: div.innerHTML = ""; Daniel@0: return div.firstChild.getAttribute("href") === "#" ; Daniel@0: }) ) { Daniel@0: addHandle( "type|href|height|width", function( elem, name, isXML ) { Daniel@0: if ( !isXML ) { Daniel@0: return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); Daniel@0: } Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: // Support: IE<9 Daniel@0: // Use defaultValue in place of getAttribute("value") Daniel@0: if ( !support.attributes || !assert(function( div ) { Daniel@0: div.innerHTML = ""; Daniel@0: div.firstChild.setAttribute( "value", "" ); Daniel@0: return div.firstChild.getAttribute( "value" ) === ""; Daniel@0: }) ) { Daniel@0: addHandle( "value", function( elem, name, isXML ) { Daniel@0: if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { Daniel@0: return elem.defaultValue; Daniel@0: } Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: // Support: IE<9 Daniel@0: // Use getAttributeNode to fetch booleans when getAttribute lies Daniel@0: if ( !assert(function( div ) { Daniel@0: return div.getAttribute("disabled") == null; Daniel@0: }) ) { Daniel@0: addHandle( booleans, function( elem, name, isXML ) { Daniel@0: var val; Daniel@0: if ( !isXML ) { Daniel@0: return (val = elem.getAttributeNode( name )) && val.specified ? Daniel@0: val.value : Daniel@0: elem[ name ] === true ? name.toLowerCase() : null; Daniel@0: } Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: jQuery.find = Sizzle; Daniel@0: jQuery.expr = Sizzle.selectors; Daniel@0: jQuery.expr[":"] = jQuery.expr.pseudos; Daniel@0: jQuery.unique = Sizzle.uniqueSort; Daniel@0: jQuery.text = Sizzle.getText; Daniel@0: jQuery.isXMLDoc = Sizzle.isXML; Daniel@0: jQuery.contains = Sizzle.contains; Daniel@0: Daniel@0: Daniel@0: })( window ); Daniel@0: // String to Object options format cache Daniel@0: var optionsCache = {}; Daniel@0: Daniel@0: // Convert String-formatted options into Object-formatted ones and store in cache Daniel@0: function createOptions( options ) { Daniel@0: var object = optionsCache[ options ] = {}; Daniel@0: jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) { Daniel@0: object[ flag ] = true; Daniel@0: }); Daniel@0: return object; Daniel@0: } Daniel@0: Daniel@0: /* Daniel@0: * Create a callback list using the following parameters: Daniel@0: * Daniel@0: * options: an optional list of space-separated options that will change how Daniel@0: * the callback list behaves or a more traditional option object Daniel@0: * Daniel@0: * By default a callback list will act like an event callback list and can be Daniel@0: * "fired" multiple times. Daniel@0: * Daniel@0: * Possible options: Daniel@0: * Daniel@0: * once: will ensure the callback list can only be fired once (like a Deferred) Daniel@0: * Daniel@0: * memory: will keep track of previous values and will call any callback added Daniel@0: * after the list has been fired right away with the latest "memorized" Daniel@0: * values (like a Deferred) Daniel@0: * Daniel@0: * unique: will ensure a callback can only be added once (no duplicate in the list) Daniel@0: * Daniel@0: * stopOnFalse: interrupt callings when a callback returns false Daniel@0: * Daniel@0: */ Daniel@0: jQuery.Callbacks = function( options ) { Daniel@0: Daniel@0: // Convert options from String-formatted to Object-formatted if needed Daniel@0: // (we check in cache first) Daniel@0: options = typeof options === "string" ? Daniel@0: ( optionsCache[ options ] || createOptions( options ) ) : Daniel@0: jQuery.extend( {}, options ); Daniel@0: Daniel@0: var // Flag to know if list is currently firing Daniel@0: firing, Daniel@0: // Last fire value (for non-forgettable lists) Daniel@0: memory, Daniel@0: // Flag to know if list was already fired Daniel@0: fired, Daniel@0: // End of the loop when firing Daniel@0: firingLength, Daniel@0: // Index of currently firing callback (modified by remove if needed) Daniel@0: firingIndex, Daniel@0: // First callback to fire (used internally by add and fireWith) Daniel@0: firingStart, Daniel@0: // Actual callback list Daniel@0: list = [], Daniel@0: // Stack of fire calls for repeatable lists Daniel@0: stack = !options.once && [], Daniel@0: // Fire callbacks Daniel@0: fire = function( data ) { Daniel@0: memory = options.memory && data; Daniel@0: fired = true; Daniel@0: firingIndex = firingStart || 0; Daniel@0: firingStart = 0; Daniel@0: firingLength = list.length; Daniel@0: firing = true; Daniel@0: for ( ; list && firingIndex < firingLength; firingIndex++ ) { Daniel@0: if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { Daniel@0: memory = false; // To prevent further calls using add Daniel@0: break; Daniel@0: } Daniel@0: } Daniel@0: firing = false; Daniel@0: if ( list ) { Daniel@0: if ( stack ) { Daniel@0: if ( stack.length ) { Daniel@0: fire( stack.shift() ); Daniel@0: } Daniel@0: } else if ( memory ) { Daniel@0: list = []; Daniel@0: } else { Daniel@0: self.disable(); Daniel@0: } Daniel@0: } Daniel@0: }, Daniel@0: // Actual Callbacks object Daniel@0: self = { Daniel@0: // Add a callback or a collection of callbacks to the list Daniel@0: add: function() { Daniel@0: if ( list ) { Daniel@0: // First, we save the current length Daniel@0: var start = list.length; Daniel@0: (function add( args ) { Daniel@0: jQuery.each( args, function( _, arg ) { Daniel@0: var type = jQuery.type( arg ); Daniel@0: if ( type === "function" ) { Daniel@0: if ( !options.unique || !self.has( arg ) ) { Daniel@0: list.push( arg ); Daniel@0: } Daniel@0: } else if ( arg && arg.length && type !== "string" ) { Daniel@0: // Inspect recursively Daniel@0: add( arg ); Daniel@0: } Daniel@0: }); Daniel@0: })( arguments ); Daniel@0: // Do we need to add the callbacks to the Daniel@0: // current firing batch? Daniel@0: if ( firing ) { Daniel@0: firingLength = list.length; Daniel@0: // With memory, if we're not firing then Daniel@0: // we should call right away Daniel@0: } else if ( memory ) { Daniel@0: firingStart = start; Daniel@0: fire( memory ); Daniel@0: } Daniel@0: } Daniel@0: return this; Daniel@0: }, Daniel@0: // Remove a callback from the list Daniel@0: remove: function() { Daniel@0: if ( list ) { Daniel@0: jQuery.each( arguments, function( _, arg ) { Daniel@0: var index; Daniel@0: while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { Daniel@0: list.splice( index, 1 ); Daniel@0: // Handle firing indexes Daniel@0: if ( firing ) { Daniel@0: if ( index <= firingLength ) { Daniel@0: firingLength--; Daniel@0: } Daniel@0: if ( index <= firingIndex ) { Daniel@0: firingIndex--; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: }); Daniel@0: } Daniel@0: return this; Daniel@0: }, Daniel@0: // Check if a given callback is in the list. Daniel@0: // If no argument is given, return whether or not list has callbacks attached. Daniel@0: has: function( fn ) { Daniel@0: return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); Daniel@0: }, Daniel@0: // Remove all callbacks from the list Daniel@0: empty: function() { Daniel@0: list = []; Daniel@0: firingLength = 0; Daniel@0: return this; Daniel@0: }, Daniel@0: // Have the list do nothing anymore Daniel@0: disable: function() { Daniel@0: list = stack = memory = undefined; Daniel@0: return this; Daniel@0: }, Daniel@0: // Is it disabled? Daniel@0: disabled: function() { Daniel@0: return !list; Daniel@0: }, Daniel@0: // Lock the list in its current state Daniel@0: lock: function() { Daniel@0: stack = undefined; Daniel@0: if ( !memory ) { Daniel@0: self.disable(); Daniel@0: } Daniel@0: return this; Daniel@0: }, Daniel@0: // Is it locked? Daniel@0: locked: function() { Daniel@0: return !stack; Daniel@0: }, Daniel@0: // Call all callbacks with the given context and arguments Daniel@0: fireWith: function( context, args ) { Daniel@0: if ( list && ( !fired || stack ) ) { Daniel@0: args = args || []; Daniel@0: args = [ context, args.slice ? args.slice() : args ]; Daniel@0: if ( firing ) { Daniel@0: stack.push( args ); Daniel@0: } else { Daniel@0: fire( args ); Daniel@0: } Daniel@0: } Daniel@0: return this; Daniel@0: }, Daniel@0: // Call all the callbacks with the given arguments Daniel@0: fire: function() { Daniel@0: self.fireWith( this, arguments ); Daniel@0: return this; Daniel@0: }, Daniel@0: // To know if the callbacks have already been called at least once Daniel@0: fired: function() { Daniel@0: return !!fired; Daniel@0: } Daniel@0: }; Daniel@0: Daniel@0: return self; Daniel@0: }; Daniel@0: jQuery.extend({ Daniel@0: Daniel@0: Deferred: function( func ) { Daniel@0: var tuples = [ Daniel@0: // action, add listener, listener list, final state Daniel@0: [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], Daniel@0: [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], Daniel@0: [ "notify", "progress", jQuery.Callbacks("memory") ] Daniel@0: ], Daniel@0: state = "pending", Daniel@0: promise = { Daniel@0: state: function() { Daniel@0: return state; Daniel@0: }, Daniel@0: always: function() { Daniel@0: deferred.done( arguments ).fail( arguments ); Daniel@0: return this; Daniel@0: }, Daniel@0: then: function( /* fnDone, fnFail, fnProgress */ ) { Daniel@0: var fns = arguments; Daniel@0: return jQuery.Deferred(function( newDefer ) { Daniel@0: jQuery.each( tuples, function( i, tuple ) { Daniel@0: var action = tuple[ 0 ], Daniel@0: fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; Daniel@0: // deferred[ done | fail | progress ] for forwarding actions to newDefer Daniel@0: deferred[ tuple[1] ](function() { Daniel@0: var returned = fn && fn.apply( this, arguments ); Daniel@0: if ( returned && jQuery.isFunction( returned.promise ) ) { Daniel@0: returned.promise() Daniel@0: .done( newDefer.resolve ) Daniel@0: .fail( newDefer.reject ) Daniel@0: .progress( newDefer.notify ); Daniel@0: } else { Daniel@0: newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); Daniel@0: } Daniel@0: }); Daniel@0: }); Daniel@0: fns = null; Daniel@0: }).promise(); Daniel@0: }, Daniel@0: // Get a promise for this deferred Daniel@0: // If obj is provided, the promise aspect is added to the object Daniel@0: promise: function( obj ) { Daniel@0: return obj != null ? jQuery.extend( obj, promise ) : promise; Daniel@0: } Daniel@0: }, Daniel@0: deferred = {}; Daniel@0: Daniel@0: // Keep pipe for back-compat Daniel@0: promise.pipe = promise.then; Daniel@0: Daniel@0: // Add list-specific methods Daniel@0: jQuery.each( tuples, function( i, tuple ) { Daniel@0: var list = tuple[ 2 ], Daniel@0: stateString = tuple[ 3 ]; Daniel@0: Daniel@0: // promise[ done | fail | progress ] = list.add Daniel@0: promise[ tuple[1] ] = list.add; Daniel@0: Daniel@0: // Handle state Daniel@0: if ( stateString ) { Daniel@0: list.add(function() { Daniel@0: // state = [ resolved | rejected ] Daniel@0: state = stateString; Daniel@0: Daniel@0: // [ reject_list | resolve_list ].disable; progress_list.lock Daniel@0: }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); Daniel@0: } Daniel@0: Daniel@0: // deferred[ resolve | reject | notify ] Daniel@0: deferred[ tuple[0] ] = function() { Daniel@0: deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); Daniel@0: return this; Daniel@0: }; Daniel@0: deferred[ tuple[0] + "With" ] = list.fireWith; Daniel@0: }); Daniel@0: Daniel@0: // Make the deferred a promise Daniel@0: promise.promise( deferred ); Daniel@0: Daniel@0: // Call given func if any Daniel@0: if ( func ) { Daniel@0: func.call( deferred, deferred ); Daniel@0: } Daniel@0: Daniel@0: // All done! Daniel@0: return deferred; Daniel@0: }, Daniel@0: Daniel@0: // Deferred helper Daniel@0: when: function( subordinate /* , ..., subordinateN */ ) { Daniel@0: var i = 0, Daniel@0: resolveValues = core_slice.call( arguments ), Daniel@0: length = resolveValues.length, Daniel@0: Daniel@0: // the count of uncompleted subordinates Daniel@0: remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, Daniel@0: Daniel@0: // the master Deferred. If resolveValues consist of only a single Deferred, just use that. Daniel@0: deferred = remaining === 1 ? subordinate : jQuery.Deferred(), Daniel@0: Daniel@0: // Update function for both resolve and progress values Daniel@0: updateFunc = function( i, contexts, values ) { Daniel@0: return function( value ) { Daniel@0: contexts[ i ] = this; Daniel@0: values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; Daniel@0: if( values === progressValues ) { Daniel@0: deferred.notifyWith( contexts, values ); Daniel@0: } else if ( !( --remaining ) ) { Daniel@0: deferred.resolveWith( contexts, values ); Daniel@0: } Daniel@0: }; Daniel@0: }, Daniel@0: Daniel@0: progressValues, progressContexts, resolveContexts; Daniel@0: Daniel@0: // add listeners to Deferred subordinates; treat others as resolved Daniel@0: if ( length > 1 ) { Daniel@0: progressValues = new Array( length ); Daniel@0: progressContexts = new Array( length ); Daniel@0: resolveContexts = new Array( length ); Daniel@0: for ( ; i < length; i++ ) { Daniel@0: if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { Daniel@0: resolveValues[ i ].promise() Daniel@0: .done( updateFunc( i, resolveContexts, resolveValues ) ) Daniel@0: .fail( deferred.reject ) Daniel@0: .progress( updateFunc( i, progressContexts, progressValues ) ); Daniel@0: } else { Daniel@0: --remaining; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // if we're not waiting on anything, resolve the master Daniel@0: if ( !remaining ) { Daniel@0: deferred.resolveWith( resolveContexts, resolveValues ); Daniel@0: } Daniel@0: Daniel@0: return deferred.promise(); Daniel@0: } Daniel@0: }); Daniel@0: jQuery.support = (function( support ) { Daniel@0: Daniel@0: var all, a, input, select, fragment, opt, eventName, isSupported, i, Daniel@0: div = document.createElement("div"); Daniel@0: Daniel@0: // Setup Daniel@0: div.setAttribute( "className", "t" ); Daniel@0: div.innerHTML = "
a"; Daniel@0: Daniel@0: // Finish early in limited (non-browser) environments Daniel@0: all = div.getElementsByTagName("*") || []; Daniel@0: a = div.getElementsByTagName("a")[ 0 ]; Daniel@0: if ( !a || !a.style || !all.length ) { Daniel@0: return support; Daniel@0: } Daniel@0: Daniel@0: // First batch of tests Daniel@0: select = document.createElement("select"); Daniel@0: opt = select.appendChild( document.createElement("option") ); Daniel@0: input = div.getElementsByTagName("input")[ 0 ]; Daniel@0: Daniel@0: a.style.cssText = "top:1px;float:left;opacity:.5"; Daniel@0: Daniel@0: // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) Daniel@0: support.getSetAttribute = div.className !== "t"; Daniel@0: Daniel@0: // IE strips leading whitespace when .innerHTML is used Daniel@0: support.leadingWhitespace = div.firstChild.nodeType === 3; Daniel@0: Daniel@0: // Make sure that tbody elements aren't automatically inserted Daniel@0: // IE will insert them into empty tables Daniel@0: support.tbody = !div.getElementsByTagName("tbody").length; Daniel@0: Daniel@0: // Make sure that link elements get serialized correctly by innerHTML Daniel@0: // This requires a wrapper element in IE Daniel@0: support.htmlSerialize = !!div.getElementsByTagName("link").length; Daniel@0: Daniel@0: // Get the style information from getAttribute Daniel@0: // (IE uses .cssText instead) Daniel@0: support.style = /top/.test( a.getAttribute("style") ); Daniel@0: Daniel@0: // Make sure that URLs aren't manipulated Daniel@0: // (IE normalizes it by default) Daniel@0: support.hrefNormalized = a.getAttribute("href") === "/a"; Daniel@0: Daniel@0: // Make sure that element opacity exists Daniel@0: // (IE uses filter instead) Daniel@0: // Use a regex to work around a WebKit issue. See #5145 Daniel@0: support.opacity = /^0.5/.test( a.style.opacity ); Daniel@0: Daniel@0: // Verify style float existence Daniel@0: // (IE uses styleFloat instead of cssFloat) Daniel@0: support.cssFloat = !!a.style.cssFloat; Daniel@0: Daniel@0: // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) Daniel@0: support.checkOn = !!input.value; Daniel@0: Daniel@0: // Make sure that a selected-by-default option has a working selected property. Daniel@0: // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) Daniel@0: support.optSelected = opt.selected; Daniel@0: Daniel@0: // Tests for enctype support on a form (#6743) Daniel@0: support.enctype = !!document.createElement("form").enctype; Daniel@0: Daniel@0: // Makes sure cloning an html5 element does not cause problems Daniel@0: // Where outerHTML is undefined, this still works Daniel@0: support.html5Clone = document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>"; Daniel@0: Daniel@0: // Will be defined later Daniel@0: support.inlineBlockNeedsLayout = false; Daniel@0: support.shrinkWrapBlocks = false; Daniel@0: support.pixelPosition = false; Daniel@0: support.deleteExpando = true; Daniel@0: support.noCloneEvent = true; Daniel@0: support.reliableMarginRight = true; Daniel@0: support.boxSizingReliable = true; Daniel@0: Daniel@0: // Make sure checked status is properly cloned Daniel@0: input.checked = true; Daniel@0: support.noCloneChecked = input.cloneNode( true ).checked; Daniel@0: Daniel@0: // Make sure that the options inside disabled selects aren't marked as disabled Daniel@0: // (WebKit marks them as disabled) Daniel@0: select.disabled = true; Daniel@0: support.optDisabled = !opt.disabled; Daniel@0: Daniel@0: // Support: IE<9 Daniel@0: try { Daniel@0: delete div.test; Daniel@0: } catch( e ) { Daniel@0: support.deleteExpando = false; Daniel@0: } Daniel@0: Daniel@0: // Check if we can trust getAttribute("value") Daniel@0: input = document.createElement("input"); Daniel@0: input.setAttribute( "value", "" ); Daniel@0: support.input = input.getAttribute( "value" ) === ""; Daniel@0: Daniel@0: // Check if an input maintains its value after becoming a radio Daniel@0: input.value = "t"; Daniel@0: input.setAttribute( "type", "radio" ); Daniel@0: support.radioValue = input.value === "t"; Daniel@0: Daniel@0: // #11217 - WebKit loses check when the name is after the checked attribute Daniel@0: input.setAttribute( "checked", "t" ); Daniel@0: input.setAttribute( "name", "t" ); Daniel@0: Daniel@0: fragment = document.createDocumentFragment(); Daniel@0: fragment.appendChild( input ); Daniel@0: Daniel@0: // Check if a disconnected checkbox will retain its checked Daniel@0: // value of true after appended to the DOM (IE6/7) Daniel@0: support.appendChecked = input.checked; Daniel@0: Daniel@0: // WebKit doesn't clone checked state correctly in fragments Daniel@0: support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; Daniel@0: Daniel@0: // Support: IE<9 Daniel@0: // Opera does not clone events (and typeof div.attachEvent === undefined). Daniel@0: // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() Daniel@0: if ( div.attachEvent ) { Daniel@0: div.attachEvent( "onclick", function() { Daniel@0: support.noCloneEvent = false; Daniel@0: }); Daniel@0: Daniel@0: div.cloneNode( true ).click(); Daniel@0: } Daniel@0: Daniel@0: // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event) Daniel@0: // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) Daniel@0: for ( i in { submit: true, change: true, focusin: true }) { Daniel@0: div.setAttribute( eventName = "on" + i, "t" ); Daniel@0: Daniel@0: support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false; Daniel@0: } Daniel@0: Daniel@0: div.style.backgroundClip = "content-box"; Daniel@0: div.cloneNode( true ).style.backgroundClip = ""; Daniel@0: support.clearCloneStyle = div.style.backgroundClip === "content-box"; Daniel@0: Daniel@0: // Support: IE<9 Daniel@0: // Iteration over object's inherited properties before its own. Daniel@0: for ( i in jQuery( support ) ) { Daniel@0: break; Daniel@0: } Daniel@0: support.ownLast = i !== "0"; Daniel@0: Daniel@0: // Run tests that need a body at doc ready Daniel@0: jQuery(function() { Daniel@0: var container, marginDiv, tds, Daniel@0: divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", Daniel@0: body = document.getElementsByTagName("body")[0]; Daniel@0: Daniel@0: if ( !body ) { Daniel@0: // Return for frameset docs that don't have a body Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: container = document.createElement("div"); Daniel@0: container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; Daniel@0: Daniel@0: body.appendChild( container ).appendChild( div ); Daniel@0: Daniel@0: // Support: IE8 Daniel@0: // Check if table cells still have offsetWidth/Height when they are set Daniel@0: // to display:none and there are still other visible table cells in a Daniel@0: // table row; if so, offsetWidth/Height are not reliable for use when Daniel@0: // determining if an element has been hidden directly using Daniel@0: // display:none (it is still safe to use offsets if a parent element is Daniel@0: // hidden; don safety goggles and see bug #4512 for more information). Daniel@0: div.innerHTML = "
t
"; Daniel@0: tds = div.getElementsByTagName("td"); Daniel@0: tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; Daniel@0: isSupported = ( tds[ 0 ].offsetHeight === 0 ); Daniel@0: Daniel@0: tds[ 0 ].style.display = ""; Daniel@0: tds[ 1 ].style.display = "none"; Daniel@0: Daniel@0: // Support: IE8 Daniel@0: // Check if empty table cells still have offsetWidth/Height Daniel@0: support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); Daniel@0: Daniel@0: // Check box-sizing and margin behavior. Daniel@0: div.innerHTML = ""; Daniel@0: div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; Daniel@0: Daniel@0: // Workaround failing boxSizing test due to offsetWidth returning wrong value Daniel@0: // with some non-1 values of body zoom, ticket #13543 Daniel@0: jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() { Daniel@0: support.boxSizing = div.offsetWidth === 4; Daniel@0: }); Daniel@0: Daniel@0: // Use window.getComputedStyle because jsdom on node.js will break without it. Daniel@0: if ( window.getComputedStyle ) { Daniel@0: support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; Daniel@0: support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; Daniel@0: Daniel@0: // Check if div with explicit width and no margin-right incorrectly Daniel@0: // gets computed margin-right based on width of container. (#3333) Daniel@0: // Fails in WebKit before Feb 2011 nightlies Daniel@0: // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right Daniel@0: marginDiv = div.appendChild( document.createElement("div") ); Daniel@0: marginDiv.style.cssText = div.style.cssText = divReset; Daniel@0: marginDiv.style.marginRight = marginDiv.style.width = "0"; Daniel@0: div.style.width = "1px"; Daniel@0: Daniel@0: support.reliableMarginRight = Daniel@0: !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); Daniel@0: } Daniel@0: Daniel@0: if ( typeof div.style.zoom !== core_strundefined ) { Daniel@0: // Support: IE<8 Daniel@0: // Check if natively block-level elements act like inline-block Daniel@0: // elements when setting their display to 'inline' and giving Daniel@0: // them layout Daniel@0: div.innerHTML = ""; Daniel@0: div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; Daniel@0: support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); Daniel@0: Daniel@0: // Support: IE6 Daniel@0: // Check if elements with layout shrink-wrap their children Daniel@0: div.style.display = "block"; Daniel@0: div.innerHTML = "
"; Daniel@0: div.firstChild.style.width = "5px"; Daniel@0: support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); Daniel@0: Daniel@0: if ( support.inlineBlockNeedsLayout ) { Daniel@0: // Prevent IE 6 from affecting layout for positioned elements #11048 Daniel@0: // Prevent IE from shrinking the body in IE 7 mode #12869 Daniel@0: // Support: IE<8 Daniel@0: body.style.zoom = 1; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: body.removeChild( container ); Daniel@0: Daniel@0: // Null elements to avoid leaks in IE Daniel@0: container = div = tds = marginDiv = null; Daniel@0: }); Daniel@0: Daniel@0: // Null elements to avoid leaks in IE Daniel@0: all = select = fragment = opt = a = input = null; Daniel@0: Daniel@0: return support; Daniel@0: })({}); Daniel@0: Daniel@0: var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, Daniel@0: rmultiDash = /([A-Z])/g; Daniel@0: Daniel@0: function internalData( elem, name, data, pvt /* Internal Use Only */ ){ Daniel@0: if ( !jQuery.acceptData( elem ) ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: var ret, thisCache, Daniel@0: internalKey = jQuery.expando, Daniel@0: Daniel@0: // We have to handle DOM nodes and JS objects differently because IE6-7 Daniel@0: // can't GC object references properly across the DOM-JS boundary Daniel@0: isNode = elem.nodeType, Daniel@0: Daniel@0: // Only DOM nodes need the global jQuery cache; JS object data is Daniel@0: // attached directly to the object so GC can occur automatically Daniel@0: cache = isNode ? jQuery.cache : elem, Daniel@0: Daniel@0: // Only defining an ID for JS objects if its cache already exists allows Daniel@0: // the code to shortcut on the same path as a DOM node with no cache Daniel@0: id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; Daniel@0: Daniel@0: // Avoid doing any more work than we need to when trying to get data on an Daniel@0: // object that has no data at all Daniel@0: if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: if ( !id ) { Daniel@0: // Only DOM nodes need a new unique ID for each element since their data Daniel@0: // ends up in the global cache Daniel@0: if ( isNode ) { Daniel@0: id = elem[ internalKey ] = core_deletedIds.pop() || jQuery.guid++; Daniel@0: } else { Daniel@0: id = internalKey; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: if ( !cache[ id ] ) { Daniel@0: // Avoid exposing jQuery metadata on plain JS objects when the object Daniel@0: // is serialized using JSON.stringify Daniel@0: cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; Daniel@0: } Daniel@0: Daniel@0: // An object can be passed to jQuery.data instead of a key/value pair; this gets Daniel@0: // shallow copied over onto the existing cache Daniel@0: if ( typeof name === "object" || typeof name === "function" ) { Daniel@0: if ( pvt ) { Daniel@0: cache[ id ] = jQuery.extend( cache[ id ], name ); Daniel@0: } else { Daniel@0: cache[ id ].data = jQuery.extend( cache[ id ].data, name ); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: thisCache = cache[ id ]; Daniel@0: Daniel@0: // jQuery data() is stored in a separate object inside the object's internal data Daniel@0: // cache in order to avoid key collisions between internal data and user-defined Daniel@0: // data. Daniel@0: if ( !pvt ) { Daniel@0: if ( !thisCache.data ) { Daniel@0: thisCache.data = {}; Daniel@0: } Daniel@0: Daniel@0: thisCache = thisCache.data; Daniel@0: } Daniel@0: Daniel@0: if ( data !== undefined ) { Daniel@0: thisCache[ jQuery.camelCase( name ) ] = data; Daniel@0: } Daniel@0: Daniel@0: // Check for both converted-to-camel and non-converted data property names Daniel@0: // If a data property was specified Daniel@0: if ( typeof name === "string" ) { Daniel@0: Daniel@0: // First Try to find as-is property data Daniel@0: ret = thisCache[ name ]; Daniel@0: Daniel@0: // Test for null|undefined property data Daniel@0: if ( ret == null ) { Daniel@0: Daniel@0: // Try to find the camelCased property Daniel@0: ret = thisCache[ jQuery.camelCase( name ) ]; Daniel@0: } Daniel@0: } else { Daniel@0: ret = thisCache; Daniel@0: } Daniel@0: Daniel@0: return ret; Daniel@0: } Daniel@0: Daniel@0: function internalRemoveData( elem, name, pvt ) { Daniel@0: if ( !jQuery.acceptData( elem ) ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: var thisCache, i, Daniel@0: isNode = elem.nodeType, Daniel@0: Daniel@0: // See jQuery.data for more information Daniel@0: cache = isNode ? jQuery.cache : elem, Daniel@0: id = isNode ? elem[ jQuery.expando ] : jQuery.expando; Daniel@0: Daniel@0: // If there is already no cache entry for this object, there is no Daniel@0: // purpose in continuing Daniel@0: if ( !cache[ id ] ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: if ( name ) { Daniel@0: Daniel@0: thisCache = pvt ? cache[ id ] : cache[ id ].data; Daniel@0: Daniel@0: if ( thisCache ) { Daniel@0: Daniel@0: // Support array or space separated string names for data keys Daniel@0: if ( !jQuery.isArray( name ) ) { Daniel@0: Daniel@0: // try the string as a key before any manipulation Daniel@0: if ( name in thisCache ) { Daniel@0: name = [ name ]; Daniel@0: } else { Daniel@0: Daniel@0: // split the camel cased version by spaces unless a key with the spaces exists Daniel@0: name = jQuery.camelCase( name ); Daniel@0: if ( name in thisCache ) { Daniel@0: name = [ name ]; Daniel@0: } else { Daniel@0: name = name.split(" "); Daniel@0: } Daniel@0: } Daniel@0: } else { Daniel@0: // If "name" is an array of keys... Daniel@0: // When data is initially created, via ("key", "val") signature, Daniel@0: // keys will be converted to camelCase. Daniel@0: // Since there is no way to tell _how_ a key was added, remove Daniel@0: // both plain key and camelCase key. #12786 Daniel@0: // This will only penalize the array argument path. Daniel@0: name = name.concat( jQuery.map( name, jQuery.camelCase ) ); Daniel@0: } Daniel@0: Daniel@0: i = name.length; Daniel@0: while ( i-- ) { Daniel@0: delete thisCache[ name[i] ]; Daniel@0: } Daniel@0: Daniel@0: // If there is no data left in the cache, we want to continue Daniel@0: // and let the cache object itself get destroyed Daniel@0: if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) { Daniel@0: return; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // See jQuery.data for more information Daniel@0: if ( !pvt ) { Daniel@0: delete cache[ id ].data; Daniel@0: Daniel@0: // Don't destroy the parent cache unless the internal data object Daniel@0: // had been the only thing left in it Daniel@0: if ( !isEmptyDataObject( cache[ id ] ) ) { Daniel@0: return; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Destroy the cache Daniel@0: if ( isNode ) { Daniel@0: jQuery.cleanData( [ elem ], true ); Daniel@0: Daniel@0: // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) Daniel@0: /* jshint eqeqeq: false */ Daniel@0: } else if ( jQuery.support.deleteExpando || cache != cache.window ) { Daniel@0: /* jshint eqeqeq: true */ Daniel@0: delete cache[ id ]; Daniel@0: Daniel@0: // When all else fails, null Daniel@0: } else { Daniel@0: cache[ id ] = null; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: jQuery.extend({ Daniel@0: cache: {}, Daniel@0: Daniel@0: // The following elements throw uncatchable exceptions if you Daniel@0: // attempt to add expando properties to them. Daniel@0: noData: { Daniel@0: "applet": true, Daniel@0: "embed": true, Daniel@0: // Ban all objects except for Flash (which handle expandos) Daniel@0: "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" Daniel@0: }, Daniel@0: Daniel@0: hasData: function( elem ) { Daniel@0: elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; Daniel@0: return !!elem && !isEmptyDataObject( elem ); Daniel@0: }, Daniel@0: Daniel@0: data: function( elem, name, data ) { Daniel@0: return internalData( elem, name, data ); Daniel@0: }, Daniel@0: Daniel@0: removeData: function( elem, name ) { Daniel@0: return internalRemoveData( elem, name ); Daniel@0: }, Daniel@0: Daniel@0: // For internal use only. Daniel@0: _data: function( elem, name, data ) { Daniel@0: return internalData( elem, name, data, true ); Daniel@0: }, Daniel@0: Daniel@0: _removeData: function( elem, name ) { Daniel@0: return internalRemoveData( elem, name, true ); Daniel@0: }, Daniel@0: Daniel@0: // A method for determining if a DOM node can handle the data expando Daniel@0: acceptData: function( elem ) { Daniel@0: // Do not set data on non-element because it will not be cleared (#8335). Daniel@0: if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) { Daniel@0: return false; Daniel@0: } Daniel@0: Daniel@0: var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; Daniel@0: Daniel@0: // nodes accept data unless otherwise specified; rejection can be conditional Daniel@0: return !noData || noData !== true && elem.getAttribute("classid") === noData; Daniel@0: } Daniel@0: }); Daniel@0: Daniel@0: jQuery.fn.extend({ Daniel@0: data: function( key, value ) { Daniel@0: var attrs, name, Daniel@0: data = null, Daniel@0: i = 0, Daniel@0: elem = this[0]; Daniel@0: Daniel@0: // Special expections of .data basically thwart jQuery.access, Daniel@0: // so implement the relevant behavior ourselves Daniel@0: Daniel@0: // Gets all values Daniel@0: if ( key === undefined ) { Daniel@0: if ( this.length ) { Daniel@0: data = jQuery.data( elem ); Daniel@0: Daniel@0: if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { Daniel@0: attrs = elem.attributes; Daniel@0: for ( ; i < attrs.length; i++ ) { Daniel@0: name = attrs[i].name; Daniel@0: Daniel@0: if ( name.indexOf("data-") === 0 ) { Daniel@0: name = jQuery.camelCase( name.slice(5) ); Daniel@0: Daniel@0: dataAttr( elem, name, data[ name ] ); Daniel@0: } Daniel@0: } Daniel@0: jQuery._data( elem, "parsedAttrs", true ); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return data; Daniel@0: } Daniel@0: Daniel@0: // Sets multiple values Daniel@0: if ( typeof key === "object" ) { Daniel@0: return this.each(function() { Daniel@0: jQuery.data( this, key ); Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: return arguments.length > 1 ? Daniel@0: Daniel@0: // Sets one value Daniel@0: this.each(function() { Daniel@0: jQuery.data( this, key, value ); Daniel@0: }) : Daniel@0: Daniel@0: // Gets one value Daniel@0: // Try to fetch any internally stored data first Daniel@0: elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null; Daniel@0: }, Daniel@0: Daniel@0: removeData: function( key ) { Daniel@0: return this.each(function() { Daniel@0: jQuery.removeData( this, key ); Daniel@0: }); Daniel@0: } Daniel@0: }); Daniel@0: Daniel@0: function dataAttr( elem, key, data ) { Daniel@0: // If nothing was found internally, try to fetch any Daniel@0: // data from the HTML5 data-* attribute Daniel@0: if ( data === undefined && elem.nodeType === 1 ) { Daniel@0: Daniel@0: var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); Daniel@0: Daniel@0: data = elem.getAttribute( name ); Daniel@0: Daniel@0: if ( typeof data === "string" ) { Daniel@0: try { Daniel@0: data = data === "true" ? true : Daniel@0: data === "false" ? false : Daniel@0: data === "null" ? null : Daniel@0: // Only convert to a number if it doesn't change the string Daniel@0: +data + "" === data ? +data : Daniel@0: rbrace.test( data ) ? jQuery.parseJSON( data ) : Daniel@0: data; Daniel@0: } catch( e ) {} Daniel@0: Daniel@0: // Make sure we set the data so it isn't changed later Daniel@0: jQuery.data( elem, key, data ); Daniel@0: Daniel@0: } else { Daniel@0: data = undefined; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return data; Daniel@0: } Daniel@0: Daniel@0: // checks a cache object for emptiness Daniel@0: function isEmptyDataObject( obj ) { Daniel@0: var name; Daniel@0: for ( name in obj ) { Daniel@0: Daniel@0: // if the public data object is empty, the private is still empty Daniel@0: if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { Daniel@0: continue; Daniel@0: } Daniel@0: if ( name !== "toJSON" ) { Daniel@0: return false; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return true; Daniel@0: } Daniel@0: jQuery.extend({ Daniel@0: queue: function( elem, type, data ) { Daniel@0: var queue; Daniel@0: Daniel@0: if ( elem ) { Daniel@0: type = ( type || "fx" ) + "queue"; Daniel@0: queue = jQuery._data( elem, type ); Daniel@0: Daniel@0: // Speed up dequeue by getting out quickly if this is just a lookup Daniel@0: if ( data ) { Daniel@0: if ( !queue || jQuery.isArray(data) ) { Daniel@0: queue = jQuery._data( elem, type, jQuery.makeArray(data) ); Daniel@0: } else { Daniel@0: queue.push( data ); Daniel@0: } Daniel@0: } Daniel@0: return queue || []; Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: dequeue: function( elem, type ) { Daniel@0: type = type || "fx"; Daniel@0: Daniel@0: var queue = jQuery.queue( elem, type ), Daniel@0: startLength = queue.length, Daniel@0: fn = queue.shift(), Daniel@0: hooks = jQuery._queueHooks( elem, type ), Daniel@0: next = function() { Daniel@0: jQuery.dequeue( elem, type ); Daniel@0: }; Daniel@0: Daniel@0: // If the fx queue is dequeued, always remove the progress sentinel Daniel@0: if ( fn === "inprogress" ) { Daniel@0: fn = queue.shift(); Daniel@0: startLength--; Daniel@0: } Daniel@0: Daniel@0: if ( fn ) { Daniel@0: Daniel@0: // Add a progress sentinel to prevent the fx queue from being Daniel@0: // automatically dequeued Daniel@0: if ( type === "fx" ) { Daniel@0: queue.unshift( "inprogress" ); Daniel@0: } Daniel@0: Daniel@0: // clear up the last queue stop function Daniel@0: delete hooks.stop; Daniel@0: fn.call( elem, next, hooks ); Daniel@0: } Daniel@0: Daniel@0: if ( !startLength && hooks ) { Daniel@0: hooks.empty.fire(); Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: // not intended for public consumption - generates a queueHooks object, or returns the current one Daniel@0: _queueHooks: function( elem, type ) { Daniel@0: var key = type + "queueHooks"; Daniel@0: return jQuery._data( elem, key ) || jQuery._data( elem, key, { Daniel@0: empty: jQuery.Callbacks("once memory").add(function() { Daniel@0: jQuery._removeData( elem, type + "queue" ); Daniel@0: jQuery._removeData( elem, key ); Daniel@0: }) Daniel@0: }); Daniel@0: } Daniel@0: }); Daniel@0: Daniel@0: jQuery.fn.extend({ Daniel@0: queue: function( type, data ) { Daniel@0: var setter = 2; Daniel@0: Daniel@0: if ( typeof type !== "string" ) { Daniel@0: data = type; Daniel@0: type = "fx"; Daniel@0: setter--; Daniel@0: } Daniel@0: Daniel@0: if ( arguments.length < setter ) { Daniel@0: return jQuery.queue( this[0], type ); Daniel@0: } Daniel@0: Daniel@0: return data === undefined ? Daniel@0: this : Daniel@0: this.each(function() { Daniel@0: var queue = jQuery.queue( this, type, data ); Daniel@0: Daniel@0: // ensure a hooks for this queue Daniel@0: jQuery._queueHooks( this, type ); Daniel@0: Daniel@0: if ( type === "fx" && queue[0] !== "inprogress" ) { Daniel@0: jQuery.dequeue( this, type ); Daniel@0: } Daniel@0: }); Daniel@0: }, Daniel@0: dequeue: function( type ) { Daniel@0: return this.each(function() { Daniel@0: jQuery.dequeue( this, type ); Daniel@0: }); Daniel@0: }, Daniel@0: // Based off of the plugin by Clint Helfers, with permission. Daniel@0: // http://blindsignals.com/index.php/2009/07/jquery-delay/ Daniel@0: delay: function( time, type ) { Daniel@0: time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; Daniel@0: type = type || "fx"; Daniel@0: Daniel@0: return this.queue( type, function( next, hooks ) { Daniel@0: var timeout = setTimeout( next, time ); Daniel@0: hooks.stop = function() { Daniel@0: clearTimeout( timeout ); Daniel@0: }; Daniel@0: }); Daniel@0: }, Daniel@0: clearQueue: function( type ) { Daniel@0: return this.queue( type || "fx", [] ); Daniel@0: }, Daniel@0: // Get a promise resolved when queues of a certain type Daniel@0: // are emptied (fx is the type by default) Daniel@0: promise: function( type, obj ) { Daniel@0: var tmp, Daniel@0: count = 1, Daniel@0: defer = jQuery.Deferred(), Daniel@0: elements = this, Daniel@0: i = this.length, Daniel@0: resolve = function() { Daniel@0: if ( !( --count ) ) { Daniel@0: defer.resolveWith( elements, [ elements ] ); Daniel@0: } Daniel@0: }; Daniel@0: Daniel@0: if ( typeof type !== "string" ) { Daniel@0: obj = type; Daniel@0: type = undefined; Daniel@0: } Daniel@0: type = type || "fx"; Daniel@0: Daniel@0: while( i-- ) { Daniel@0: tmp = jQuery._data( elements[ i ], type + "queueHooks" ); Daniel@0: if ( tmp && tmp.empty ) { Daniel@0: count++; Daniel@0: tmp.empty.add( resolve ); Daniel@0: } Daniel@0: } Daniel@0: resolve(); Daniel@0: return defer.promise( obj ); Daniel@0: } Daniel@0: }); Daniel@0: var nodeHook, boolHook, Daniel@0: rclass = /[\t\r\n\f]/g, Daniel@0: rreturn = /\r/g, Daniel@0: rfocusable = /^(?:input|select|textarea|button|object)$/i, Daniel@0: rclickable = /^(?:a|area)$/i, Daniel@0: ruseDefault = /^(?:checked|selected)$/i, Daniel@0: getSetAttribute = jQuery.support.getSetAttribute, Daniel@0: getSetInput = jQuery.support.input; Daniel@0: Daniel@0: jQuery.fn.extend({ Daniel@0: attr: function( name, value ) { Daniel@0: return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); Daniel@0: }, Daniel@0: Daniel@0: removeAttr: function( name ) { Daniel@0: return this.each(function() { Daniel@0: jQuery.removeAttr( this, name ); Daniel@0: }); Daniel@0: }, Daniel@0: Daniel@0: prop: function( name, value ) { Daniel@0: return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); Daniel@0: }, Daniel@0: Daniel@0: removeProp: function( name ) { Daniel@0: name = jQuery.propFix[ name ] || name; Daniel@0: return this.each(function() { Daniel@0: // try/catch handles cases where IE balks (such as removing a property on window) Daniel@0: try { Daniel@0: this[ name ] = undefined; Daniel@0: delete this[ name ]; Daniel@0: } catch( e ) {} Daniel@0: }); Daniel@0: }, Daniel@0: Daniel@0: addClass: function( value ) { Daniel@0: var classes, elem, cur, clazz, j, Daniel@0: i = 0, Daniel@0: len = this.length, Daniel@0: proceed = typeof value === "string" && value; Daniel@0: Daniel@0: if ( jQuery.isFunction( value ) ) { Daniel@0: return this.each(function( j ) { Daniel@0: jQuery( this ).addClass( value.call( this, j, this.className ) ); Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: if ( proceed ) { Daniel@0: // The disjunction here is for better compressibility (see removeClass) Daniel@0: classes = ( value || "" ).match( core_rnotwhite ) || []; Daniel@0: Daniel@0: for ( ; i < len; i++ ) { Daniel@0: elem = this[ i ]; Daniel@0: cur = elem.nodeType === 1 && ( elem.className ? Daniel@0: ( " " + elem.className + " " ).replace( rclass, " " ) : Daniel@0: " " Daniel@0: ); Daniel@0: Daniel@0: if ( cur ) { Daniel@0: j = 0; Daniel@0: while ( (clazz = classes[j++]) ) { Daniel@0: if ( cur.indexOf( " " + clazz + " " ) < 0 ) { Daniel@0: cur += clazz + " "; Daniel@0: } Daniel@0: } Daniel@0: elem.className = jQuery.trim( cur ); Daniel@0: Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return this; Daniel@0: }, Daniel@0: Daniel@0: removeClass: function( value ) { Daniel@0: var classes, elem, cur, clazz, j, Daniel@0: i = 0, Daniel@0: len = this.length, Daniel@0: proceed = arguments.length === 0 || typeof value === "string" && value; Daniel@0: Daniel@0: if ( jQuery.isFunction( value ) ) { Daniel@0: return this.each(function( j ) { Daniel@0: jQuery( this ).removeClass( value.call( this, j, this.className ) ); Daniel@0: }); Daniel@0: } Daniel@0: if ( proceed ) { Daniel@0: classes = ( value || "" ).match( core_rnotwhite ) || []; Daniel@0: Daniel@0: for ( ; i < len; i++ ) { Daniel@0: elem = this[ i ]; Daniel@0: // This expression is here for better compressibility (see addClass) Daniel@0: cur = elem.nodeType === 1 && ( elem.className ? Daniel@0: ( " " + elem.className + " " ).replace( rclass, " " ) : Daniel@0: "" Daniel@0: ); Daniel@0: Daniel@0: if ( cur ) { Daniel@0: j = 0; Daniel@0: while ( (clazz = classes[j++]) ) { Daniel@0: // Remove *all* instances Daniel@0: while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { Daniel@0: cur = cur.replace( " " + clazz + " ", " " ); Daniel@0: } Daniel@0: } Daniel@0: elem.className = value ? jQuery.trim( cur ) : ""; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return this; Daniel@0: }, Daniel@0: Daniel@0: toggleClass: function( value, stateVal ) { Daniel@0: var type = typeof value; Daniel@0: Daniel@0: if ( typeof stateVal === "boolean" && type === "string" ) { Daniel@0: return stateVal ? this.addClass( value ) : this.removeClass( value ); Daniel@0: } Daniel@0: Daniel@0: if ( jQuery.isFunction( value ) ) { Daniel@0: return this.each(function( i ) { Daniel@0: jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: return this.each(function() { Daniel@0: if ( type === "string" ) { Daniel@0: // toggle individual class names Daniel@0: var className, Daniel@0: i = 0, Daniel@0: self = jQuery( this ), Daniel@0: classNames = value.match( core_rnotwhite ) || []; Daniel@0: Daniel@0: while ( (className = classNames[ i++ ]) ) { Daniel@0: // check each className given, space separated list Daniel@0: if ( self.hasClass( className ) ) { Daniel@0: self.removeClass( className ); Daniel@0: } else { Daniel@0: self.addClass( className ); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Toggle whole class name Daniel@0: } else if ( type === core_strundefined || type === "boolean" ) { Daniel@0: if ( this.className ) { Daniel@0: // store className if set Daniel@0: jQuery._data( this, "__className__", this.className ); Daniel@0: } Daniel@0: Daniel@0: // If the element has a class name or if we're passed "false", Daniel@0: // then remove the whole classname (if there was one, the above saved it). Daniel@0: // Otherwise bring back whatever was previously saved (if anything), Daniel@0: // falling back to the empty string if nothing was stored. Daniel@0: this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; Daniel@0: } Daniel@0: }); Daniel@0: }, Daniel@0: Daniel@0: hasClass: function( selector ) { Daniel@0: var className = " " + selector + " ", Daniel@0: i = 0, Daniel@0: l = this.length; Daniel@0: for ( ; i < l; i++ ) { Daniel@0: if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { Daniel@0: return true; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return false; Daniel@0: }, Daniel@0: Daniel@0: val: function( value ) { Daniel@0: var ret, hooks, isFunction, Daniel@0: elem = this[0]; Daniel@0: Daniel@0: if ( !arguments.length ) { Daniel@0: if ( elem ) { Daniel@0: hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; Daniel@0: Daniel@0: if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { Daniel@0: return ret; Daniel@0: } Daniel@0: Daniel@0: ret = elem.value; Daniel@0: Daniel@0: return typeof ret === "string" ? Daniel@0: // handle most common string cases Daniel@0: ret.replace(rreturn, "") : Daniel@0: // handle cases where value is null/undef or number Daniel@0: ret == null ? "" : ret; Daniel@0: } Daniel@0: Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: isFunction = jQuery.isFunction( value ); Daniel@0: Daniel@0: return this.each(function( i ) { Daniel@0: var val; Daniel@0: Daniel@0: if ( this.nodeType !== 1 ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: if ( isFunction ) { Daniel@0: val = value.call( this, i, jQuery( this ).val() ); Daniel@0: } else { Daniel@0: val = value; Daniel@0: } Daniel@0: Daniel@0: // Treat null/undefined as ""; convert numbers to string Daniel@0: if ( val == null ) { Daniel@0: val = ""; Daniel@0: } else if ( typeof val === "number" ) { Daniel@0: val += ""; Daniel@0: } else if ( jQuery.isArray( val ) ) { Daniel@0: val = jQuery.map(val, function ( value ) { Daniel@0: return value == null ? "" : value + ""; Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; Daniel@0: Daniel@0: // If set returns undefined, fall back to normal setting Daniel@0: if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { Daniel@0: this.value = val; Daniel@0: } Daniel@0: }); Daniel@0: } Daniel@0: }); Daniel@0: Daniel@0: jQuery.extend({ Daniel@0: valHooks: { Daniel@0: option: { Daniel@0: get: function( elem ) { Daniel@0: // Use proper attribute retrieval(#6932, #12072) Daniel@0: var val = jQuery.find.attr( elem, "value" ); Daniel@0: return val != null ? Daniel@0: val : Daniel@0: elem.text; Daniel@0: } Daniel@0: }, Daniel@0: select: { Daniel@0: get: function( elem ) { Daniel@0: var value, option, Daniel@0: options = elem.options, Daniel@0: index = elem.selectedIndex, Daniel@0: one = elem.type === "select-one" || index < 0, Daniel@0: values = one ? null : [], Daniel@0: max = one ? index + 1 : options.length, Daniel@0: i = index < 0 ? Daniel@0: max : Daniel@0: one ? index : 0; Daniel@0: Daniel@0: // Loop through all the selected options Daniel@0: for ( ; i < max; i++ ) { Daniel@0: option = options[ i ]; Daniel@0: Daniel@0: // oldIE doesn't update selected after form reset (#2551) Daniel@0: if ( ( option.selected || i === index ) && Daniel@0: // Don't return options that are disabled or in a disabled optgroup Daniel@0: ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && Daniel@0: ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { Daniel@0: Daniel@0: // Get the specific value for the option Daniel@0: value = jQuery( option ).val(); Daniel@0: Daniel@0: // We don't need an array for one selects Daniel@0: if ( one ) { Daniel@0: return value; Daniel@0: } Daniel@0: Daniel@0: // Multi-Selects return an array Daniel@0: values.push( value ); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return values; Daniel@0: }, Daniel@0: Daniel@0: set: function( elem, value ) { Daniel@0: var optionSet, option, Daniel@0: options = elem.options, Daniel@0: values = jQuery.makeArray( value ), Daniel@0: i = options.length; Daniel@0: Daniel@0: while ( i-- ) { Daniel@0: option = options[ i ]; Daniel@0: if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) { Daniel@0: optionSet = true; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // force browsers to behave consistently when non-matching value is set Daniel@0: if ( !optionSet ) { Daniel@0: elem.selectedIndex = -1; Daniel@0: } Daniel@0: return values; Daniel@0: } Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: attr: function( elem, name, value ) { Daniel@0: var hooks, ret, Daniel@0: nType = elem.nodeType; Daniel@0: Daniel@0: // don't get/set attributes on text, comment and attribute nodes Daniel@0: if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: // Fallback to prop when attributes are not supported Daniel@0: if ( typeof elem.getAttribute === core_strundefined ) { Daniel@0: return jQuery.prop( elem, name, value ); Daniel@0: } Daniel@0: Daniel@0: // All attributes are lowercase Daniel@0: // Grab necessary hook if one is defined Daniel@0: if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { Daniel@0: name = name.toLowerCase(); Daniel@0: hooks = jQuery.attrHooks[ name ] || Daniel@0: ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); Daniel@0: } Daniel@0: Daniel@0: if ( value !== undefined ) { Daniel@0: Daniel@0: if ( value === null ) { Daniel@0: jQuery.removeAttr( elem, name ); Daniel@0: Daniel@0: } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { Daniel@0: return ret; Daniel@0: Daniel@0: } else { Daniel@0: elem.setAttribute( name, value + "" ); Daniel@0: return value; Daniel@0: } Daniel@0: Daniel@0: } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { Daniel@0: return ret; Daniel@0: Daniel@0: } else { Daniel@0: ret = jQuery.find.attr( elem, name ); Daniel@0: Daniel@0: // Non-existent attributes return null, we normalize to undefined Daniel@0: return ret == null ? Daniel@0: undefined : Daniel@0: ret; Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: removeAttr: function( elem, value ) { Daniel@0: var name, propName, Daniel@0: i = 0, Daniel@0: attrNames = value && value.match( core_rnotwhite ); Daniel@0: Daniel@0: if ( attrNames && elem.nodeType === 1 ) { Daniel@0: while ( (name = attrNames[i++]) ) { Daniel@0: propName = jQuery.propFix[ name ] || name; Daniel@0: Daniel@0: // Boolean attributes get special treatment (#10870) Daniel@0: if ( jQuery.expr.match.bool.test( name ) ) { Daniel@0: // Set corresponding property to false Daniel@0: if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { Daniel@0: elem[ propName ] = false; Daniel@0: // Support: IE<9 Daniel@0: // Also clear defaultChecked/defaultSelected (if appropriate) Daniel@0: } else { Daniel@0: elem[ jQuery.camelCase( "default-" + name ) ] = Daniel@0: elem[ propName ] = false; Daniel@0: } Daniel@0: Daniel@0: // See #9699 for explanation of this approach (setting first, then removal) Daniel@0: } else { Daniel@0: jQuery.attr( elem, name, "" ); Daniel@0: } Daniel@0: Daniel@0: elem.removeAttribute( getSetAttribute ? name : propName ); Daniel@0: } Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: attrHooks: { Daniel@0: type: { Daniel@0: set: function( elem, value ) { Daniel@0: if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { Daniel@0: // Setting the type on a radio button after the value resets the value in IE6-9 Daniel@0: // Reset value to default in case type is set after value during creation Daniel@0: var val = elem.value; Daniel@0: elem.setAttribute( "type", value ); Daniel@0: if ( val ) { Daniel@0: elem.value = val; Daniel@0: } Daniel@0: return value; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: propFix: { Daniel@0: "for": "htmlFor", Daniel@0: "class": "className" Daniel@0: }, Daniel@0: Daniel@0: prop: function( elem, name, value ) { Daniel@0: var ret, hooks, notxml, Daniel@0: nType = elem.nodeType; Daniel@0: Daniel@0: // don't get/set properties on text, comment and attribute nodes Daniel@0: if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); Daniel@0: Daniel@0: if ( notxml ) { Daniel@0: // Fix name and attach hooks Daniel@0: name = jQuery.propFix[ name ] || name; Daniel@0: hooks = jQuery.propHooks[ name ]; Daniel@0: } Daniel@0: Daniel@0: if ( value !== undefined ) { Daniel@0: return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? Daniel@0: ret : Daniel@0: ( elem[ name ] = value ); Daniel@0: Daniel@0: } else { Daniel@0: return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? Daniel@0: ret : Daniel@0: elem[ name ]; Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: propHooks: { Daniel@0: tabIndex: { Daniel@0: get: function( elem ) { Daniel@0: // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set Daniel@0: // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ Daniel@0: // Use proper attribute retrieval(#12072) Daniel@0: var tabindex = jQuery.find.attr( elem, "tabindex" ); Daniel@0: Daniel@0: return tabindex ? Daniel@0: parseInt( tabindex, 10 ) : Daniel@0: rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? Daniel@0: 0 : Daniel@0: -1; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: }); Daniel@0: Daniel@0: // Hooks for boolean attributes Daniel@0: boolHook = { Daniel@0: set: function( elem, value, name ) { Daniel@0: if ( value === false ) { Daniel@0: // Remove boolean attributes when set to false Daniel@0: jQuery.removeAttr( elem, name ); Daniel@0: } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { Daniel@0: // IE<8 needs the *property* name Daniel@0: elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); Daniel@0: Daniel@0: // Use defaultChecked and defaultSelected for oldIE Daniel@0: } else { Daniel@0: elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; Daniel@0: } Daniel@0: Daniel@0: return name; Daniel@0: } Daniel@0: }; Daniel@0: jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { Daniel@0: var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr; Daniel@0: Daniel@0: jQuery.expr.attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ? Daniel@0: function( elem, name, isXML ) { Daniel@0: var fn = jQuery.expr.attrHandle[ name ], Daniel@0: ret = isXML ? Daniel@0: undefined : Daniel@0: /* jshint eqeqeq: false */ Daniel@0: (jQuery.expr.attrHandle[ name ] = undefined) != Daniel@0: getter( elem, name, isXML ) ? Daniel@0: Daniel@0: name.toLowerCase() : Daniel@0: null; Daniel@0: jQuery.expr.attrHandle[ name ] = fn; Daniel@0: return ret; Daniel@0: } : Daniel@0: function( elem, name, isXML ) { Daniel@0: return isXML ? Daniel@0: undefined : Daniel@0: elem[ jQuery.camelCase( "default-" + name ) ] ? Daniel@0: name.toLowerCase() : Daniel@0: null; Daniel@0: }; Daniel@0: }); Daniel@0: Daniel@0: // fix oldIE attroperties Daniel@0: if ( !getSetInput || !getSetAttribute ) { Daniel@0: jQuery.attrHooks.value = { Daniel@0: set: function( elem, value, name ) { Daniel@0: if ( jQuery.nodeName( elem, "input" ) ) { Daniel@0: // Does not return so that setAttribute is also used Daniel@0: elem.defaultValue = value; Daniel@0: } else { Daniel@0: // Use nodeHook if defined (#1954); otherwise setAttribute is fine Daniel@0: return nodeHook && nodeHook.set( elem, value, name ); Daniel@0: } Daniel@0: } Daniel@0: }; Daniel@0: } Daniel@0: Daniel@0: // IE6/7 do not support getting/setting some attributes with get/setAttribute Daniel@0: if ( !getSetAttribute ) { Daniel@0: Daniel@0: // Use this for any attribute in IE6/7 Daniel@0: // This fixes almost every IE6/7 issue Daniel@0: nodeHook = { Daniel@0: set: function( elem, value, name ) { Daniel@0: // Set the existing or create a new attribute node Daniel@0: var ret = elem.getAttributeNode( name ); Daniel@0: if ( !ret ) { Daniel@0: elem.setAttributeNode( Daniel@0: (ret = elem.ownerDocument.createAttribute( name )) Daniel@0: ); Daniel@0: } Daniel@0: Daniel@0: ret.value = value += ""; Daniel@0: Daniel@0: // Break association with cloned elements by also using setAttribute (#9646) Daniel@0: return name === "value" || value === elem.getAttribute( name ) ? Daniel@0: value : Daniel@0: undefined; Daniel@0: } Daniel@0: }; Daniel@0: jQuery.expr.attrHandle.id = jQuery.expr.attrHandle.name = jQuery.expr.attrHandle.coords = Daniel@0: // Some attributes are constructed with empty-string values when not defined Daniel@0: function( elem, name, isXML ) { Daniel@0: var ret; Daniel@0: return isXML ? Daniel@0: undefined : Daniel@0: (ret = elem.getAttributeNode( name )) && ret.value !== "" ? Daniel@0: ret.value : Daniel@0: null; Daniel@0: }; Daniel@0: jQuery.valHooks.button = { Daniel@0: get: function( elem, name ) { Daniel@0: var ret = elem.getAttributeNode( name ); Daniel@0: return ret && ret.specified ? Daniel@0: ret.value : Daniel@0: undefined; Daniel@0: }, Daniel@0: set: nodeHook.set Daniel@0: }; Daniel@0: Daniel@0: // Set contenteditable to false on removals(#10429) Daniel@0: // Setting to empty string throws an error as an invalid value Daniel@0: jQuery.attrHooks.contenteditable = { Daniel@0: set: function( elem, value, name ) { Daniel@0: nodeHook.set( elem, value === "" ? false : value, name ); Daniel@0: } Daniel@0: }; Daniel@0: Daniel@0: // Set width and height to auto instead of 0 on empty string( Bug #8150 ) Daniel@0: // This is for removals Daniel@0: jQuery.each([ "width", "height" ], function( i, name ) { Daniel@0: jQuery.attrHooks[ name ] = { Daniel@0: set: function( elem, value ) { Daniel@0: if ( value === "" ) { Daniel@0: elem.setAttribute( name, "auto" ); Daniel@0: return value; Daniel@0: } Daniel@0: } Daniel@0: }; Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: Daniel@0: // Some attributes require a special call on IE Daniel@0: // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx Daniel@0: if ( !jQuery.support.hrefNormalized ) { Daniel@0: // href/src property should get the full normalized URL (#10299/#12915) Daniel@0: jQuery.each([ "href", "src" ], function( i, name ) { Daniel@0: jQuery.propHooks[ name ] = { Daniel@0: get: function( elem ) { Daniel@0: return elem.getAttribute( name, 4 ); Daniel@0: } Daniel@0: }; Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: if ( !jQuery.support.style ) { Daniel@0: jQuery.attrHooks.style = { Daniel@0: get: function( elem ) { Daniel@0: // Return undefined in the case of empty string Daniel@0: // Note: IE uppercases css property names, but if we were to .toLowerCase() Daniel@0: // .cssText, that would destroy case senstitivity in URL's, like in "background" Daniel@0: return elem.style.cssText || undefined; Daniel@0: }, Daniel@0: set: function( elem, value ) { Daniel@0: return ( elem.style.cssText = value + "" ); Daniel@0: } Daniel@0: }; Daniel@0: } Daniel@0: Daniel@0: // Safari mis-reports the default selected property of an option Daniel@0: // Accessing the parent's selectedIndex property fixes it Daniel@0: if ( !jQuery.support.optSelected ) { Daniel@0: jQuery.propHooks.selected = { Daniel@0: get: function( elem ) { Daniel@0: var parent = elem.parentNode; Daniel@0: Daniel@0: if ( parent ) { Daniel@0: parent.selectedIndex; Daniel@0: Daniel@0: // Make sure that it also works with optgroups, see #5701 Daniel@0: if ( parent.parentNode ) { Daniel@0: parent.parentNode.selectedIndex; Daniel@0: } Daniel@0: } Daniel@0: return null; Daniel@0: } Daniel@0: }; Daniel@0: } Daniel@0: Daniel@0: jQuery.each([ Daniel@0: "tabIndex", Daniel@0: "readOnly", Daniel@0: "maxLength", Daniel@0: "cellSpacing", Daniel@0: "cellPadding", Daniel@0: "rowSpan", Daniel@0: "colSpan", Daniel@0: "useMap", Daniel@0: "frameBorder", Daniel@0: "contentEditable" Daniel@0: ], function() { Daniel@0: jQuery.propFix[ this.toLowerCase() ] = this; Daniel@0: }); Daniel@0: Daniel@0: // IE6/7 call enctype encoding Daniel@0: if ( !jQuery.support.enctype ) { Daniel@0: jQuery.propFix.enctype = "encoding"; Daniel@0: } Daniel@0: Daniel@0: // Radios and checkboxes getter/setter Daniel@0: jQuery.each([ "radio", "checkbox" ], function() { Daniel@0: jQuery.valHooks[ this ] = { Daniel@0: set: function( elem, value ) { Daniel@0: if ( jQuery.isArray( value ) ) { Daniel@0: return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); Daniel@0: } Daniel@0: } Daniel@0: }; Daniel@0: if ( !jQuery.support.checkOn ) { Daniel@0: jQuery.valHooks[ this ].get = function( elem ) { Daniel@0: // Support: Webkit Daniel@0: // "" is returned instead of "on" if a value isn't specified Daniel@0: return elem.getAttribute("value") === null ? "on" : elem.value; Daniel@0: }; Daniel@0: } Daniel@0: }); Daniel@0: var rformElems = /^(?:input|select|textarea)$/i, Daniel@0: rkeyEvent = /^key/, Daniel@0: rmouseEvent = /^(?:mouse|contextmenu)|click/, Daniel@0: rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, Daniel@0: rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; Daniel@0: Daniel@0: function returnTrue() { Daniel@0: return true; Daniel@0: } Daniel@0: Daniel@0: function returnFalse() { Daniel@0: return false; Daniel@0: } Daniel@0: Daniel@0: function safeActiveElement() { Daniel@0: try { Daniel@0: return document.activeElement; Daniel@0: } catch ( err ) { } Daniel@0: } Daniel@0: Daniel@0: /* Daniel@0: * Helper functions for managing events -- not part of the public interface. Daniel@0: * Props to Dean Edwards' addEvent library for many of the ideas. Daniel@0: */ Daniel@0: jQuery.event = { Daniel@0: Daniel@0: global: {}, Daniel@0: Daniel@0: add: function( elem, types, handler, data, selector ) { Daniel@0: var tmp, events, t, handleObjIn, Daniel@0: special, eventHandle, handleObj, Daniel@0: handlers, type, namespaces, origType, Daniel@0: elemData = jQuery._data( elem ); Daniel@0: Daniel@0: // Don't attach events to noData or text/comment nodes (but allow plain objects) Daniel@0: if ( !elemData ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: // Caller can pass in an object of custom data in lieu of the handler Daniel@0: if ( handler.handler ) { Daniel@0: handleObjIn = handler; Daniel@0: handler = handleObjIn.handler; Daniel@0: selector = handleObjIn.selector; Daniel@0: } Daniel@0: Daniel@0: // Make sure that the handler has a unique ID, used to find/remove it later Daniel@0: if ( !handler.guid ) { Daniel@0: handler.guid = jQuery.guid++; Daniel@0: } Daniel@0: Daniel@0: // Init the element's event structure and main handler, if this is the first Daniel@0: if ( !(events = elemData.events) ) { Daniel@0: events = elemData.events = {}; Daniel@0: } Daniel@0: if ( !(eventHandle = elemData.handle) ) { Daniel@0: eventHandle = elemData.handle = function( e ) { Daniel@0: // Discard the second event of a jQuery.event.trigger() and Daniel@0: // when an event is called after a page has unloaded Daniel@0: return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ? Daniel@0: jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : Daniel@0: undefined; Daniel@0: }; Daniel@0: // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events Daniel@0: eventHandle.elem = elem; Daniel@0: } Daniel@0: Daniel@0: // Handle multiple events separated by a space Daniel@0: types = ( types || "" ).match( core_rnotwhite ) || [""]; Daniel@0: t = types.length; Daniel@0: while ( t-- ) { Daniel@0: tmp = rtypenamespace.exec( types[t] ) || []; Daniel@0: type = origType = tmp[1]; Daniel@0: namespaces = ( tmp[2] || "" ).split( "." ).sort(); Daniel@0: Daniel@0: // There *must* be a type, no attaching namespace-only handlers Daniel@0: if ( !type ) { Daniel@0: continue; Daniel@0: } Daniel@0: Daniel@0: // If event changes its type, use the special event handlers for the changed type Daniel@0: special = jQuery.event.special[ type ] || {}; Daniel@0: Daniel@0: // If selector defined, determine special event api type, otherwise given type Daniel@0: type = ( selector ? special.delegateType : special.bindType ) || type; Daniel@0: Daniel@0: // Update special based on newly reset type Daniel@0: special = jQuery.event.special[ type ] || {}; Daniel@0: Daniel@0: // handleObj is passed to all event handlers Daniel@0: handleObj = jQuery.extend({ Daniel@0: type: type, Daniel@0: origType: origType, Daniel@0: data: data, Daniel@0: handler: handler, Daniel@0: guid: handler.guid, Daniel@0: selector: selector, Daniel@0: needsContext: selector && jQuery.expr.match.needsContext.test( selector ), Daniel@0: namespace: namespaces.join(".") Daniel@0: }, handleObjIn ); Daniel@0: Daniel@0: // Init the event handler queue if we're the first Daniel@0: if ( !(handlers = events[ type ]) ) { Daniel@0: handlers = events[ type ] = []; Daniel@0: handlers.delegateCount = 0; Daniel@0: Daniel@0: // Only use addEventListener/attachEvent if the special events handler returns false Daniel@0: if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { Daniel@0: // Bind the global event handler to the element Daniel@0: if ( elem.addEventListener ) { Daniel@0: elem.addEventListener( type, eventHandle, false ); Daniel@0: Daniel@0: } else if ( elem.attachEvent ) { Daniel@0: elem.attachEvent( "on" + type, eventHandle ); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: if ( special.add ) { Daniel@0: special.add.call( elem, handleObj ); Daniel@0: Daniel@0: if ( !handleObj.handler.guid ) { Daniel@0: handleObj.handler.guid = handler.guid; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Add to the element's handler list, delegates in front Daniel@0: if ( selector ) { Daniel@0: handlers.splice( handlers.delegateCount++, 0, handleObj ); Daniel@0: } else { Daniel@0: handlers.push( handleObj ); Daniel@0: } Daniel@0: Daniel@0: // Keep track of which events have ever been used, for event optimization Daniel@0: jQuery.event.global[ type ] = true; Daniel@0: } Daniel@0: Daniel@0: // Nullify elem to prevent memory leaks in IE Daniel@0: elem = null; Daniel@0: }, Daniel@0: Daniel@0: // Detach an event or set of events from an element Daniel@0: remove: function( elem, types, handler, selector, mappedTypes ) { Daniel@0: var j, handleObj, tmp, Daniel@0: origCount, t, events, Daniel@0: special, handlers, type, Daniel@0: namespaces, origType, Daniel@0: elemData = jQuery.hasData( elem ) && jQuery._data( elem ); Daniel@0: Daniel@0: if ( !elemData || !(events = elemData.events) ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: // Once for each type.namespace in types; type may be omitted Daniel@0: types = ( types || "" ).match( core_rnotwhite ) || [""]; Daniel@0: t = types.length; Daniel@0: while ( t-- ) { Daniel@0: tmp = rtypenamespace.exec( types[t] ) || []; Daniel@0: type = origType = tmp[1]; Daniel@0: namespaces = ( tmp[2] || "" ).split( "." ).sort(); Daniel@0: Daniel@0: // Unbind all events (on this namespace, if provided) for the element Daniel@0: if ( !type ) { Daniel@0: for ( type in events ) { Daniel@0: jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); Daniel@0: } Daniel@0: continue; Daniel@0: } Daniel@0: Daniel@0: special = jQuery.event.special[ type ] || {}; Daniel@0: type = ( selector ? special.delegateType : special.bindType ) || type; Daniel@0: handlers = events[ type ] || []; Daniel@0: tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); Daniel@0: Daniel@0: // Remove matching events Daniel@0: origCount = j = handlers.length; Daniel@0: while ( j-- ) { Daniel@0: handleObj = handlers[ j ]; Daniel@0: Daniel@0: if ( ( mappedTypes || origType === handleObj.origType ) && Daniel@0: ( !handler || handler.guid === handleObj.guid ) && Daniel@0: ( !tmp || tmp.test( handleObj.namespace ) ) && Daniel@0: ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { Daniel@0: handlers.splice( j, 1 ); Daniel@0: Daniel@0: if ( handleObj.selector ) { Daniel@0: handlers.delegateCount--; Daniel@0: } Daniel@0: if ( special.remove ) { Daniel@0: special.remove.call( elem, handleObj ); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Remove generic event handler if we removed something and no more handlers exist Daniel@0: // (avoids potential for endless recursion during removal of special event handlers) Daniel@0: if ( origCount && !handlers.length ) { Daniel@0: if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { Daniel@0: jQuery.removeEvent( elem, type, elemData.handle ); Daniel@0: } Daniel@0: Daniel@0: delete events[ type ]; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Remove the expando if it's no longer used Daniel@0: if ( jQuery.isEmptyObject( events ) ) { Daniel@0: delete elemData.handle; Daniel@0: Daniel@0: // removeData also checks for emptiness and clears the expando if empty Daniel@0: // so use it instead of delete Daniel@0: jQuery._removeData( elem, "events" ); Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: trigger: function( event, data, elem, onlyHandlers ) { Daniel@0: var handle, ontype, cur, Daniel@0: bubbleType, special, tmp, i, Daniel@0: eventPath = [ elem || document ], Daniel@0: type = core_hasOwn.call( event, "type" ) ? event.type : event, Daniel@0: namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; Daniel@0: Daniel@0: cur = tmp = elem = elem || document; Daniel@0: Daniel@0: // Don't do events on text and comment nodes Daniel@0: if ( elem.nodeType === 3 || elem.nodeType === 8 ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: // focus/blur morphs to focusin/out; ensure we're not firing them right now Daniel@0: if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: if ( type.indexOf(".") >= 0 ) { Daniel@0: // Namespaced trigger; create a regexp to match event type in handle() Daniel@0: namespaces = type.split("."); Daniel@0: type = namespaces.shift(); Daniel@0: namespaces.sort(); Daniel@0: } Daniel@0: ontype = type.indexOf(":") < 0 && "on" + type; Daniel@0: Daniel@0: // Caller can pass in a jQuery.Event object, Object, or just an event type string Daniel@0: event = event[ jQuery.expando ] ? Daniel@0: event : Daniel@0: new jQuery.Event( type, typeof event === "object" && event ); Daniel@0: Daniel@0: // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) Daniel@0: event.isTrigger = onlyHandlers ? 2 : 3; Daniel@0: event.namespace = namespaces.join("."); Daniel@0: event.namespace_re = event.namespace ? Daniel@0: new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : Daniel@0: null; Daniel@0: Daniel@0: // Clean up the event in case it is being reused Daniel@0: event.result = undefined; Daniel@0: if ( !event.target ) { Daniel@0: event.target = elem; Daniel@0: } Daniel@0: Daniel@0: // Clone any incoming data and prepend the event, creating the handler arg list Daniel@0: data = data == null ? Daniel@0: [ event ] : Daniel@0: jQuery.makeArray( data, [ event ] ); Daniel@0: Daniel@0: // Allow special events to draw outside the lines Daniel@0: special = jQuery.event.special[ type ] || {}; Daniel@0: if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: // Determine event propagation path in advance, per W3C events spec (#9951) Daniel@0: // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) Daniel@0: if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { Daniel@0: Daniel@0: bubbleType = special.delegateType || type; Daniel@0: if ( !rfocusMorph.test( bubbleType + type ) ) { Daniel@0: cur = cur.parentNode; Daniel@0: } Daniel@0: for ( ; cur; cur = cur.parentNode ) { Daniel@0: eventPath.push( cur ); Daniel@0: tmp = cur; Daniel@0: } Daniel@0: Daniel@0: // Only add window if we got to document (e.g., not plain obj or detached DOM) Daniel@0: if ( tmp === (elem.ownerDocument || document) ) { Daniel@0: eventPath.push( tmp.defaultView || tmp.parentWindow || window ); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Fire handlers on the event path Daniel@0: i = 0; Daniel@0: while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { Daniel@0: Daniel@0: event.type = i > 1 ? Daniel@0: bubbleType : Daniel@0: special.bindType || type; Daniel@0: Daniel@0: // jQuery handler Daniel@0: handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); Daniel@0: if ( handle ) { Daniel@0: handle.apply( cur, data ); Daniel@0: } Daniel@0: Daniel@0: // Native handler Daniel@0: handle = ontype && cur[ ontype ]; Daniel@0: if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { Daniel@0: event.preventDefault(); Daniel@0: } Daniel@0: } Daniel@0: event.type = type; Daniel@0: Daniel@0: // If nobody prevented the default action, do it now Daniel@0: if ( !onlyHandlers && !event.isDefaultPrevented() ) { Daniel@0: Daniel@0: if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && Daniel@0: jQuery.acceptData( elem ) ) { Daniel@0: Daniel@0: // Call a native DOM method on the target with the same name name as the event. Daniel@0: // Can't use an .isFunction() check here because IE6/7 fails that test. Daniel@0: // Don't do default actions on window, that's where global variables be (#6170) Daniel@0: if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { Daniel@0: Daniel@0: // Don't re-trigger an onFOO event when we call its FOO() method Daniel@0: tmp = elem[ ontype ]; Daniel@0: Daniel@0: if ( tmp ) { Daniel@0: elem[ ontype ] = null; Daniel@0: } Daniel@0: Daniel@0: // Prevent re-triggering of the same event, since we already bubbled it above Daniel@0: jQuery.event.triggered = type; Daniel@0: try { Daniel@0: elem[ type ](); Daniel@0: } catch ( e ) { Daniel@0: // IE<9 dies on focus/blur to hidden element (#1486,#12518) Daniel@0: // only reproducible on winXP IE8 native, not IE9 in IE8 mode Daniel@0: } Daniel@0: jQuery.event.triggered = undefined; Daniel@0: Daniel@0: if ( tmp ) { Daniel@0: elem[ ontype ] = tmp; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return event.result; Daniel@0: }, Daniel@0: Daniel@0: dispatch: function( event ) { Daniel@0: Daniel@0: // Make a writable jQuery.Event from the native event object Daniel@0: event = jQuery.event.fix( event ); Daniel@0: Daniel@0: var i, ret, handleObj, matched, j, Daniel@0: handlerQueue = [], Daniel@0: args = core_slice.call( arguments ), Daniel@0: handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], Daniel@0: special = jQuery.event.special[ event.type ] || {}; Daniel@0: Daniel@0: // Use the fix-ed jQuery.Event rather than the (read-only) native event Daniel@0: args[0] = event; Daniel@0: event.delegateTarget = this; Daniel@0: Daniel@0: // Call the preDispatch hook for the mapped type, and let it bail if desired Daniel@0: if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: // Determine handlers Daniel@0: handlerQueue = jQuery.event.handlers.call( this, event, handlers ); Daniel@0: Daniel@0: // Run delegates first; they may want to stop propagation beneath us Daniel@0: i = 0; Daniel@0: while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { Daniel@0: event.currentTarget = matched.elem; Daniel@0: Daniel@0: j = 0; Daniel@0: while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { Daniel@0: Daniel@0: // Triggered event must either 1) have no namespace, or Daniel@0: // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). Daniel@0: if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { Daniel@0: Daniel@0: event.handleObj = handleObj; Daniel@0: event.data = handleObj.data; Daniel@0: Daniel@0: ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) Daniel@0: .apply( matched.elem, args ); Daniel@0: Daniel@0: if ( ret !== undefined ) { Daniel@0: if ( (event.result = ret) === false ) { Daniel@0: event.preventDefault(); Daniel@0: event.stopPropagation(); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Call the postDispatch hook for the mapped type Daniel@0: if ( special.postDispatch ) { Daniel@0: special.postDispatch.call( this, event ); Daniel@0: } Daniel@0: Daniel@0: return event.result; Daniel@0: }, Daniel@0: Daniel@0: handlers: function( event, handlers ) { Daniel@0: var sel, handleObj, matches, i, Daniel@0: handlerQueue = [], Daniel@0: delegateCount = handlers.delegateCount, Daniel@0: cur = event.target; Daniel@0: Daniel@0: // Find delegate handlers Daniel@0: // Black-hole SVG instance trees (#13180) Daniel@0: // Avoid non-left-click bubbling in Firefox (#3861) Daniel@0: if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { Daniel@0: Daniel@0: /* jshint eqeqeq: false */ Daniel@0: for ( ; cur != this; cur = cur.parentNode || this ) { Daniel@0: /* jshint eqeqeq: true */ Daniel@0: Daniel@0: // Don't check non-elements (#13208) Daniel@0: // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) Daniel@0: if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { Daniel@0: matches = []; Daniel@0: for ( i = 0; i < delegateCount; i++ ) { Daniel@0: handleObj = handlers[ i ]; Daniel@0: Daniel@0: // Don't conflict with Object.prototype properties (#13203) Daniel@0: sel = handleObj.selector + " "; Daniel@0: Daniel@0: if ( matches[ sel ] === undefined ) { Daniel@0: matches[ sel ] = handleObj.needsContext ? Daniel@0: jQuery( sel, this ).index( cur ) >= 0 : Daniel@0: jQuery.find( sel, this, null, [ cur ] ).length; Daniel@0: } Daniel@0: if ( matches[ sel ] ) { Daniel@0: matches.push( handleObj ); Daniel@0: } Daniel@0: } Daniel@0: if ( matches.length ) { Daniel@0: handlerQueue.push({ elem: cur, handlers: matches }); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Add the remaining (directly-bound) handlers Daniel@0: if ( delegateCount < handlers.length ) { Daniel@0: handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); Daniel@0: } Daniel@0: Daniel@0: return handlerQueue; Daniel@0: }, Daniel@0: Daniel@0: fix: function( event ) { Daniel@0: if ( event[ jQuery.expando ] ) { Daniel@0: return event; Daniel@0: } Daniel@0: Daniel@0: // Create a writable copy of the event object and normalize some properties Daniel@0: var i, prop, copy, Daniel@0: type = event.type, Daniel@0: originalEvent = event, Daniel@0: fixHook = this.fixHooks[ type ]; Daniel@0: Daniel@0: if ( !fixHook ) { Daniel@0: this.fixHooks[ type ] = fixHook = Daniel@0: rmouseEvent.test( type ) ? this.mouseHooks : Daniel@0: rkeyEvent.test( type ) ? this.keyHooks : Daniel@0: {}; Daniel@0: } Daniel@0: copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; Daniel@0: Daniel@0: event = new jQuery.Event( originalEvent ); Daniel@0: Daniel@0: i = copy.length; Daniel@0: while ( i-- ) { Daniel@0: prop = copy[ i ]; Daniel@0: event[ prop ] = originalEvent[ prop ]; Daniel@0: } Daniel@0: Daniel@0: // Support: IE<9 Daniel@0: // Fix target property (#1925) Daniel@0: if ( !event.target ) { Daniel@0: event.target = originalEvent.srcElement || document; Daniel@0: } Daniel@0: Daniel@0: // Support: Chrome 23+, Safari? Daniel@0: // Target should not be a text node (#504, #13143) Daniel@0: if ( event.target.nodeType === 3 ) { Daniel@0: event.target = event.target.parentNode; Daniel@0: } Daniel@0: Daniel@0: // Support: IE<9 Daniel@0: // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) Daniel@0: event.metaKey = !!event.metaKey; Daniel@0: Daniel@0: return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; Daniel@0: }, Daniel@0: Daniel@0: // Includes some event props shared by KeyEvent and MouseEvent Daniel@0: props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), Daniel@0: Daniel@0: fixHooks: {}, Daniel@0: Daniel@0: keyHooks: { Daniel@0: props: "char charCode key keyCode".split(" "), Daniel@0: filter: function( event, original ) { Daniel@0: Daniel@0: // Add which for key events Daniel@0: if ( event.which == null ) { Daniel@0: event.which = original.charCode != null ? original.charCode : original.keyCode; Daniel@0: } Daniel@0: Daniel@0: return event; Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: mouseHooks: { Daniel@0: props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), Daniel@0: filter: function( event, original ) { Daniel@0: var body, eventDoc, doc, Daniel@0: button = original.button, Daniel@0: fromElement = original.fromElement; Daniel@0: Daniel@0: // Calculate pageX/Y if missing and clientX/Y available Daniel@0: if ( event.pageX == null && original.clientX != null ) { Daniel@0: eventDoc = event.target.ownerDocument || document; Daniel@0: doc = eventDoc.documentElement; Daniel@0: body = eventDoc.body; Daniel@0: Daniel@0: event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); Daniel@0: event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); Daniel@0: } Daniel@0: Daniel@0: // Add relatedTarget, if necessary Daniel@0: if ( !event.relatedTarget && fromElement ) { Daniel@0: event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; Daniel@0: } Daniel@0: Daniel@0: // Add which for click: 1 === left; 2 === middle; 3 === right Daniel@0: // Note: button is not normalized, so don't use it Daniel@0: if ( !event.which && button !== undefined ) { Daniel@0: event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); Daniel@0: } Daniel@0: Daniel@0: return event; Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: special: { Daniel@0: load: { Daniel@0: // Prevent triggered image.load events from bubbling to window.load Daniel@0: noBubble: true Daniel@0: }, Daniel@0: focus: { Daniel@0: // Fire native event if possible so blur/focus sequence is correct Daniel@0: trigger: function() { Daniel@0: if ( this !== safeActiveElement() && this.focus ) { Daniel@0: try { Daniel@0: this.focus(); Daniel@0: return false; Daniel@0: } catch ( e ) { Daniel@0: // Support: IE<9 Daniel@0: // If we error on focus to hidden element (#1486, #12518), Daniel@0: // let .trigger() run the handlers Daniel@0: } Daniel@0: } Daniel@0: }, Daniel@0: delegateType: "focusin" Daniel@0: }, Daniel@0: blur: { Daniel@0: trigger: function() { Daniel@0: if ( this === safeActiveElement() && this.blur ) { Daniel@0: this.blur(); Daniel@0: return false; Daniel@0: } Daniel@0: }, Daniel@0: delegateType: "focusout" Daniel@0: }, Daniel@0: click: { Daniel@0: // For checkbox, fire native event so checked state will be right Daniel@0: trigger: function() { Daniel@0: if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { Daniel@0: this.click(); Daniel@0: return false; Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: // For cross-browser consistency, don't fire native .click() on links Daniel@0: _default: function( event ) { Daniel@0: return jQuery.nodeName( event.target, "a" ); Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: beforeunload: { Daniel@0: postDispatch: function( event ) { Daniel@0: Daniel@0: // Even when returnValue equals to undefined Firefox will still show alert Daniel@0: if ( event.result !== undefined ) { Daniel@0: event.originalEvent.returnValue = event.result; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: simulate: function( type, elem, event, bubble ) { Daniel@0: // Piggyback on a donor event to simulate a different one. Daniel@0: // Fake originalEvent to avoid donor's stopPropagation, but if the Daniel@0: // simulated event prevents default then we do the same on the donor. Daniel@0: var e = jQuery.extend( Daniel@0: new jQuery.Event(), Daniel@0: event, Daniel@0: { Daniel@0: type: type, Daniel@0: isSimulated: true, Daniel@0: originalEvent: {} Daniel@0: } Daniel@0: ); Daniel@0: if ( bubble ) { Daniel@0: jQuery.event.trigger( e, null, elem ); Daniel@0: } else { Daniel@0: jQuery.event.dispatch.call( elem, e ); Daniel@0: } Daniel@0: if ( e.isDefaultPrevented() ) { Daniel@0: event.preventDefault(); Daniel@0: } Daniel@0: } Daniel@0: }; Daniel@0: Daniel@0: jQuery.removeEvent = document.removeEventListener ? Daniel@0: function( elem, type, handle ) { Daniel@0: if ( elem.removeEventListener ) { Daniel@0: elem.removeEventListener( type, handle, false ); Daniel@0: } Daniel@0: } : Daniel@0: function( elem, type, handle ) { Daniel@0: var name = "on" + type; Daniel@0: Daniel@0: if ( elem.detachEvent ) { Daniel@0: Daniel@0: // #8545, #7054, preventing memory leaks for custom events in IE6-8 Daniel@0: // detachEvent needed property on element, by name of that event, to properly expose it to GC Daniel@0: if ( typeof elem[ name ] === core_strundefined ) { Daniel@0: elem[ name ] = null; Daniel@0: } Daniel@0: Daniel@0: elem.detachEvent( name, handle ); Daniel@0: } Daniel@0: }; Daniel@0: Daniel@0: jQuery.Event = function( src, props ) { Daniel@0: // Allow instantiation without the 'new' keyword Daniel@0: if ( !(this instanceof jQuery.Event) ) { Daniel@0: return new jQuery.Event( src, props ); Daniel@0: } Daniel@0: Daniel@0: // Event object Daniel@0: if ( src && src.type ) { Daniel@0: this.originalEvent = src; Daniel@0: this.type = src.type; Daniel@0: Daniel@0: // Events bubbling up the document may have been marked as prevented Daniel@0: // by a handler lower down the tree; reflect the correct value. Daniel@0: this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || Daniel@0: src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; Daniel@0: Daniel@0: // Event type Daniel@0: } else { Daniel@0: this.type = src; Daniel@0: } Daniel@0: Daniel@0: // Put explicitly provided properties onto the event object Daniel@0: if ( props ) { Daniel@0: jQuery.extend( this, props ); Daniel@0: } Daniel@0: Daniel@0: // Create a timestamp if incoming event doesn't have one Daniel@0: this.timeStamp = src && src.timeStamp || jQuery.now(); Daniel@0: Daniel@0: // Mark it as fixed Daniel@0: this[ jQuery.expando ] = true; Daniel@0: }; Daniel@0: Daniel@0: // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding Daniel@0: // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html Daniel@0: jQuery.Event.prototype = { Daniel@0: isDefaultPrevented: returnFalse, Daniel@0: isPropagationStopped: returnFalse, Daniel@0: isImmediatePropagationStopped: returnFalse, Daniel@0: Daniel@0: preventDefault: function() { Daniel@0: var e = this.originalEvent; Daniel@0: Daniel@0: this.isDefaultPrevented = returnTrue; Daniel@0: if ( !e ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: // If preventDefault exists, run it on the original event Daniel@0: if ( e.preventDefault ) { Daniel@0: e.preventDefault(); Daniel@0: Daniel@0: // Support: IE Daniel@0: // Otherwise set the returnValue property of the original event to false Daniel@0: } else { Daniel@0: e.returnValue = false; Daniel@0: } Daniel@0: }, Daniel@0: stopPropagation: function() { Daniel@0: var e = this.originalEvent; Daniel@0: Daniel@0: this.isPropagationStopped = returnTrue; Daniel@0: if ( !e ) { Daniel@0: return; Daniel@0: } Daniel@0: // If stopPropagation exists, run it on the original event Daniel@0: if ( e.stopPropagation ) { Daniel@0: e.stopPropagation(); Daniel@0: } Daniel@0: Daniel@0: // Support: IE Daniel@0: // Set the cancelBubble property of the original event to true Daniel@0: e.cancelBubble = true; Daniel@0: }, Daniel@0: stopImmediatePropagation: function() { Daniel@0: this.isImmediatePropagationStopped = returnTrue; Daniel@0: this.stopPropagation(); Daniel@0: } Daniel@0: }; Daniel@0: Daniel@0: // Create mouseenter/leave events using mouseover/out and event-time checks Daniel@0: jQuery.each({ Daniel@0: mouseenter: "mouseover", Daniel@0: mouseleave: "mouseout" Daniel@0: }, function( orig, fix ) { Daniel@0: jQuery.event.special[ orig ] = { Daniel@0: delegateType: fix, Daniel@0: bindType: fix, Daniel@0: Daniel@0: handle: function( event ) { Daniel@0: var ret, Daniel@0: target = this, Daniel@0: related = event.relatedTarget, Daniel@0: handleObj = event.handleObj; Daniel@0: Daniel@0: // For mousenter/leave call the handler if related is outside the target. Daniel@0: // NB: No relatedTarget if the mouse left/entered the browser window Daniel@0: if ( !related || (related !== target && !jQuery.contains( target, related )) ) { Daniel@0: event.type = handleObj.origType; Daniel@0: ret = handleObj.handler.apply( this, arguments ); Daniel@0: event.type = fix; Daniel@0: } Daniel@0: return ret; Daniel@0: } Daniel@0: }; Daniel@0: }); Daniel@0: Daniel@0: // IE submit delegation Daniel@0: if ( !jQuery.support.submitBubbles ) { Daniel@0: Daniel@0: jQuery.event.special.submit = { Daniel@0: setup: function() { Daniel@0: // Only need this for delegated form submit events Daniel@0: if ( jQuery.nodeName( this, "form" ) ) { Daniel@0: return false; Daniel@0: } Daniel@0: Daniel@0: // Lazy-add a submit handler when a descendant form may potentially be submitted Daniel@0: jQuery.event.add( this, "click._submit keypress._submit", function( e ) { Daniel@0: // Node name check avoids a VML-related crash in IE (#9807) Daniel@0: var elem = e.target, Daniel@0: form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; Daniel@0: if ( form && !jQuery._data( form, "submitBubbles" ) ) { Daniel@0: jQuery.event.add( form, "submit._submit", function( event ) { Daniel@0: event._submit_bubble = true; Daniel@0: }); Daniel@0: jQuery._data( form, "submitBubbles", true ); Daniel@0: } Daniel@0: }); Daniel@0: // return undefined since we don't need an event listener Daniel@0: }, Daniel@0: Daniel@0: postDispatch: function( event ) { Daniel@0: // If form was submitted by the user, bubble the event up the tree Daniel@0: if ( event._submit_bubble ) { Daniel@0: delete event._submit_bubble; Daniel@0: if ( this.parentNode && !event.isTrigger ) { Daniel@0: jQuery.event.simulate( "submit", this.parentNode, event, true ); Daniel@0: } Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: teardown: function() { Daniel@0: // Only need this for delegated form submit events Daniel@0: if ( jQuery.nodeName( this, "form" ) ) { Daniel@0: return false; Daniel@0: } Daniel@0: Daniel@0: // Remove delegated handlers; cleanData eventually reaps submit handlers attached above Daniel@0: jQuery.event.remove( this, "._submit" ); Daniel@0: } Daniel@0: }; Daniel@0: } Daniel@0: Daniel@0: // IE change delegation and checkbox/radio fix Daniel@0: if ( !jQuery.support.changeBubbles ) { Daniel@0: Daniel@0: jQuery.event.special.change = { Daniel@0: Daniel@0: setup: function() { Daniel@0: Daniel@0: if ( rformElems.test( this.nodeName ) ) { Daniel@0: // IE doesn't fire change on a check/radio until blur; trigger it on click Daniel@0: // after a propertychange. Eat the blur-change in special.change.handle. Daniel@0: // This still fires onchange a second time for check/radio after blur. Daniel@0: if ( this.type === "checkbox" || this.type === "radio" ) { Daniel@0: jQuery.event.add( this, "propertychange._change", function( event ) { Daniel@0: if ( event.originalEvent.propertyName === "checked" ) { Daniel@0: this._just_changed = true; Daniel@0: } Daniel@0: }); Daniel@0: jQuery.event.add( this, "click._change", function( event ) { Daniel@0: if ( this._just_changed && !event.isTrigger ) { Daniel@0: this._just_changed = false; Daniel@0: } Daniel@0: // Allow triggered, simulated change events (#11500) Daniel@0: jQuery.event.simulate( "change", this, event, true ); Daniel@0: }); Daniel@0: } Daniel@0: return false; Daniel@0: } Daniel@0: // Delegated event; lazy-add a change handler on descendant inputs Daniel@0: jQuery.event.add( this, "beforeactivate._change", function( e ) { Daniel@0: var elem = e.target; Daniel@0: Daniel@0: if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { Daniel@0: jQuery.event.add( elem, "change._change", function( event ) { Daniel@0: if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { Daniel@0: jQuery.event.simulate( "change", this.parentNode, event, true ); Daniel@0: } Daniel@0: }); Daniel@0: jQuery._data( elem, "changeBubbles", true ); Daniel@0: } Daniel@0: }); Daniel@0: }, Daniel@0: Daniel@0: handle: function( event ) { Daniel@0: var elem = event.target; Daniel@0: Daniel@0: // Swallow native change events from checkbox/radio, we already triggered them above Daniel@0: if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { Daniel@0: return event.handleObj.handler.apply( this, arguments ); Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: teardown: function() { Daniel@0: jQuery.event.remove( this, "._change" ); Daniel@0: Daniel@0: return !rformElems.test( this.nodeName ); Daniel@0: } Daniel@0: }; Daniel@0: } Daniel@0: Daniel@0: // Create "bubbling" focus and blur events Daniel@0: if ( !jQuery.support.focusinBubbles ) { Daniel@0: jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { Daniel@0: Daniel@0: // Attach a single capturing handler while someone wants focusin/focusout Daniel@0: var attaches = 0, Daniel@0: handler = function( event ) { Daniel@0: jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); Daniel@0: }; Daniel@0: Daniel@0: jQuery.event.special[ fix ] = { Daniel@0: setup: function() { Daniel@0: if ( attaches++ === 0 ) { Daniel@0: document.addEventListener( orig, handler, true ); Daniel@0: } Daniel@0: }, Daniel@0: teardown: function() { Daniel@0: if ( --attaches === 0 ) { Daniel@0: document.removeEventListener( orig, handler, true ); Daniel@0: } Daniel@0: } Daniel@0: }; Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: jQuery.fn.extend({ Daniel@0: Daniel@0: on: function( types, selector, data, fn, /*INTERNAL*/ one ) { Daniel@0: var type, origFn; Daniel@0: Daniel@0: // Types can be a map of types/handlers Daniel@0: if ( typeof types === "object" ) { Daniel@0: // ( types-Object, selector, data ) Daniel@0: if ( typeof selector !== "string" ) { Daniel@0: // ( types-Object, data ) Daniel@0: data = data || selector; Daniel@0: selector = undefined; Daniel@0: } Daniel@0: for ( type in types ) { Daniel@0: this.on( type, selector, data, types[ type ], one ); Daniel@0: } Daniel@0: return this; Daniel@0: } Daniel@0: Daniel@0: if ( data == null && fn == null ) { Daniel@0: // ( types, fn ) Daniel@0: fn = selector; Daniel@0: data = selector = undefined; Daniel@0: } else if ( fn == null ) { Daniel@0: if ( typeof selector === "string" ) { Daniel@0: // ( types, selector, fn ) Daniel@0: fn = data; Daniel@0: data = undefined; Daniel@0: } else { Daniel@0: // ( types, data, fn ) Daniel@0: fn = data; Daniel@0: data = selector; Daniel@0: selector = undefined; Daniel@0: } Daniel@0: } Daniel@0: if ( fn === false ) { Daniel@0: fn = returnFalse; Daniel@0: } else if ( !fn ) { Daniel@0: return this; Daniel@0: } Daniel@0: Daniel@0: if ( one === 1 ) { Daniel@0: origFn = fn; Daniel@0: fn = function( event ) { Daniel@0: // Can use an empty set, since event contains the info Daniel@0: jQuery().off( event ); Daniel@0: return origFn.apply( this, arguments ); Daniel@0: }; Daniel@0: // Use same guid so caller can remove using origFn Daniel@0: fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); Daniel@0: } Daniel@0: return this.each( function() { Daniel@0: jQuery.event.add( this, types, fn, data, selector ); Daniel@0: }); Daniel@0: }, Daniel@0: one: function( types, selector, data, fn ) { Daniel@0: return this.on( types, selector, data, fn, 1 ); Daniel@0: }, Daniel@0: off: function( types, selector, fn ) { Daniel@0: var handleObj, type; Daniel@0: if ( types && types.preventDefault && types.handleObj ) { Daniel@0: // ( event ) dispatched jQuery.Event Daniel@0: handleObj = types.handleObj; Daniel@0: jQuery( types.delegateTarget ).off( Daniel@0: handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, Daniel@0: handleObj.selector, Daniel@0: handleObj.handler Daniel@0: ); Daniel@0: return this; Daniel@0: } Daniel@0: if ( typeof types === "object" ) { Daniel@0: // ( types-object [, selector] ) Daniel@0: for ( type in types ) { Daniel@0: this.off( type, selector, types[ type ] ); Daniel@0: } Daniel@0: return this; Daniel@0: } Daniel@0: if ( selector === false || typeof selector === "function" ) { Daniel@0: // ( types [, fn] ) Daniel@0: fn = selector; Daniel@0: selector = undefined; Daniel@0: } Daniel@0: if ( fn === false ) { Daniel@0: fn = returnFalse; Daniel@0: } Daniel@0: return this.each(function() { Daniel@0: jQuery.event.remove( this, types, fn, selector ); Daniel@0: }); Daniel@0: }, Daniel@0: Daniel@0: trigger: function( type, data ) { Daniel@0: return this.each(function() { Daniel@0: jQuery.event.trigger( type, data, this ); Daniel@0: }); Daniel@0: }, Daniel@0: triggerHandler: function( type, data ) { Daniel@0: var elem = this[0]; Daniel@0: if ( elem ) { Daniel@0: return jQuery.event.trigger( type, data, elem, true ); Daniel@0: } Daniel@0: } Daniel@0: }); Daniel@0: var isSimple = /^.[^:#\[\.,]*$/, Daniel@0: rparentsprev = /^(?:parents|prev(?:Until|All))/, Daniel@0: rneedsContext = jQuery.expr.match.needsContext, Daniel@0: // methods guaranteed to produce a unique set when starting from a unique set Daniel@0: guaranteedUnique = { Daniel@0: children: true, Daniel@0: contents: true, Daniel@0: next: true, Daniel@0: prev: true Daniel@0: }; Daniel@0: Daniel@0: jQuery.fn.extend({ Daniel@0: find: function( selector ) { Daniel@0: var i, Daniel@0: ret = [], Daniel@0: self = this, Daniel@0: len = self.length; Daniel@0: Daniel@0: if ( typeof selector !== "string" ) { Daniel@0: return this.pushStack( jQuery( selector ).filter(function() { Daniel@0: for ( i = 0; i < len; i++ ) { Daniel@0: if ( jQuery.contains( self[ i ], this ) ) { Daniel@0: return true; Daniel@0: } Daniel@0: } Daniel@0: }) ); Daniel@0: } Daniel@0: Daniel@0: for ( i = 0; i < len; i++ ) { Daniel@0: jQuery.find( selector, self[ i ], ret ); Daniel@0: } Daniel@0: Daniel@0: // Needed because $( selector, context ) becomes $( context ).find( selector ) Daniel@0: ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); Daniel@0: ret.selector = this.selector ? this.selector + " " + selector : selector; Daniel@0: return ret; Daniel@0: }, Daniel@0: Daniel@0: has: function( target ) { Daniel@0: var i, Daniel@0: targets = jQuery( target, this ), Daniel@0: len = targets.length; Daniel@0: Daniel@0: return this.filter(function() { Daniel@0: for ( i = 0; i < len; i++ ) { Daniel@0: if ( jQuery.contains( this, targets[i] ) ) { Daniel@0: return true; Daniel@0: } Daniel@0: } Daniel@0: }); Daniel@0: }, Daniel@0: Daniel@0: not: function( selector ) { Daniel@0: return this.pushStack( winnow(this, selector || [], true) ); Daniel@0: }, Daniel@0: Daniel@0: filter: function( selector ) { Daniel@0: return this.pushStack( winnow(this, selector || [], false) ); Daniel@0: }, Daniel@0: Daniel@0: is: function( selector ) { Daniel@0: return !!winnow( Daniel@0: this, Daniel@0: Daniel@0: // If this is a positional/relative selector, check membership in the returned set Daniel@0: // so $("p:first").is("p:last") won't return true for a doc with two "p". Daniel@0: typeof selector === "string" && rneedsContext.test( selector ) ? Daniel@0: jQuery( selector ) : Daniel@0: selector || [], Daniel@0: false Daniel@0: ).length; Daniel@0: }, Daniel@0: Daniel@0: closest: function( selectors, context ) { Daniel@0: var cur, Daniel@0: i = 0, Daniel@0: l = this.length, Daniel@0: ret = [], Daniel@0: pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? Daniel@0: jQuery( selectors, context || this.context ) : Daniel@0: 0; Daniel@0: Daniel@0: for ( ; i < l; i++ ) { Daniel@0: for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { Daniel@0: // Always skip document fragments Daniel@0: if ( cur.nodeType < 11 && (pos ? Daniel@0: pos.index(cur) > -1 : Daniel@0: Daniel@0: // Don't pass non-elements to Sizzle Daniel@0: cur.nodeType === 1 && Daniel@0: jQuery.find.matchesSelector(cur, selectors)) ) { Daniel@0: Daniel@0: cur = ret.push( cur ); Daniel@0: break; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret ); Daniel@0: }, Daniel@0: Daniel@0: // Determine the position of an element within Daniel@0: // the matched set of elements Daniel@0: index: function( elem ) { Daniel@0: Daniel@0: // No argument, return index in parent Daniel@0: if ( !elem ) { Daniel@0: return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; Daniel@0: } Daniel@0: Daniel@0: // index in selector Daniel@0: if ( typeof elem === "string" ) { Daniel@0: return jQuery.inArray( this[0], jQuery( elem ) ); Daniel@0: } Daniel@0: Daniel@0: // Locate the position of the desired element Daniel@0: return jQuery.inArray( Daniel@0: // If it receives a jQuery object, the first element is used Daniel@0: elem.jquery ? elem[0] : elem, this ); Daniel@0: }, Daniel@0: Daniel@0: add: function( selector, context ) { Daniel@0: var set = typeof selector === "string" ? Daniel@0: jQuery( selector, context ) : Daniel@0: jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), Daniel@0: all = jQuery.merge( this.get(), set ); Daniel@0: Daniel@0: return this.pushStack( jQuery.unique(all) ); Daniel@0: }, Daniel@0: Daniel@0: addBack: function( selector ) { Daniel@0: return this.add( selector == null ? Daniel@0: this.prevObject : this.prevObject.filter(selector) Daniel@0: ); Daniel@0: } Daniel@0: }); Daniel@0: Daniel@0: function sibling( cur, dir ) { Daniel@0: do { Daniel@0: cur = cur[ dir ]; Daniel@0: } while ( cur && cur.nodeType !== 1 ); Daniel@0: Daniel@0: return cur; Daniel@0: } Daniel@0: Daniel@0: jQuery.each({ Daniel@0: parent: function( elem ) { Daniel@0: var parent = elem.parentNode; Daniel@0: return parent && parent.nodeType !== 11 ? parent : null; Daniel@0: }, Daniel@0: parents: function( elem ) { Daniel@0: return jQuery.dir( elem, "parentNode" ); Daniel@0: }, Daniel@0: parentsUntil: function( elem, i, until ) { Daniel@0: return jQuery.dir( elem, "parentNode", until ); Daniel@0: }, Daniel@0: next: function( elem ) { Daniel@0: return sibling( elem, "nextSibling" ); Daniel@0: }, Daniel@0: prev: function( elem ) { Daniel@0: return sibling( elem, "previousSibling" ); Daniel@0: }, Daniel@0: nextAll: function( elem ) { Daniel@0: return jQuery.dir( elem, "nextSibling" ); Daniel@0: }, Daniel@0: prevAll: function( elem ) { Daniel@0: return jQuery.dir( elem, "previousSibling" ); Daniel@0: }, Daniel@0: nextUntil: function( elem, i, until ) { Daniel@0: return jQuery.dir( elem, "nextSibling", until ); Daniel@0: }, Daniel@0: prevUntil: function( elem, i, until ) { Daniel@0: return jQuery.dir( elem, "previousSibling", until ); Daniel@0: }, Daniel@0: siblings: function( elem ) { Daniel@0: return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); Daniel@0: }, Daniel@0: children: function( elem ) { Daniel@0: return jQuery.sibling( elem.firstChild ); Daniel@0: }, Daniel@0: contents: function( elem ) { Daniel@0: return jQuery.nodeName( elem, "iframe" ) ? Daniel@0: elem.contentDocument || elem.contentWindow.document : Daniel@0: jQuery.merge( [], elem.childNodes ); Daniel@0: } Daniel@0: }, function( name, fn ) { Daniel@0: jQuery.fn[ name ] = function( until, selector ) { Daniel@0: var ret = jQuery.map( this, fn, until ); Daniel@0: Daniel@0: if ( name.slice( -5 ) !== "Until" ) { Daniel@0: selector = until; Daniel@0: } Daniel@0: Daniel@0: if ( selector && typeof selector === "string" ) { Daniel@0: ret = jQuery.filter( selector, ret ); Daniel@0: } Daniel@0: Daniel@0: if ( this.length > 1 ) { Daniel@0: // Remove duplicates Daniel@0: if ( !guaranteedUnique[ name ] ) { Daniel@0: ret = jQuery.unique( ret ); Daniel@0: } Daniel@0: Daniel@0: // Reverse order for parents* and prev-derivatives Daniel@0: if ( rparentsprev.test( name ) ) { Daniel@0: ret = ret.reverse(); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return this.pushStack( ret ); Daniel@0: }; Daniel@0: }); Daniel@0: Daniel@0: jQuery.extend({ Daniel@0: filter: function( expr, elems, not ) { Daniel@0: var elem = elems[ 0 ]; Daniel@0: Daniel@0: if ( not ) { Daniel@0: expr = ":not(" + expr + ")"; Daniel@0: } Daniel@0: Daniel@0: return elems.length === 1 && elem.nodeType === 1 ? Daniel@0: jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : Daniel@0: jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { Daniel@0: return elem.nodeType === 1; Daniel@0: })); Daniel@0: }, Daniel@0: Daniel@0: dir: function( elem, dir, until ) { Daniel@0: var matched = [], Daniel@0: cur = elem[ dir ]; Daniel@0: Daniel@0: while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { Daniel@0: if ( cur.nodeType === 1 ) { Daniel@0: matched.push( cur ); Daniel@0: } Daniel@0: cur = cur[dir]; Daniel@0: } Daniel@0: return matched; Daniel@0: }, Daniel@0: Daniel@0: sibling: function( n, elem ) { Daniel@0: var r = []; Daniel@0: Daniel@0: for ( ; n; n = n.nextSibling ) { Daniel@0: if ( n.nodeType === 1 && n !== elem ) { Daniel@0: r.push( n ); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return r; Daniel@0: } Daniel@0: }); Daniel@0: Daniel@0: // Implement the identical functionality for filter and not Daniel@0: function winnow( elements, qualifier, not ) { Daniel@0: if ( jQuery.isFunction( qualifier ) ) { Daniel@0: return jQuery.grep( elements, function( elem, i ) { Daniel@0: /* jshint -W018 */ Daniel@0: return !!qualifier.call( elem, i, elem ) !== not; Daniel@0: }); Daniel@0: Daniel@0: } Daniel@0: Daniel@0: if ( qualifier.nodeType ) { Daniel@0: return jQuery.grep( elements, function( elem ) { Daniel@0: return ( elem === qualifier ) !== not; Daniel@0: }); Daniel@0: Daniel@0: } Daniel@0: Daniel@0: if ( typeof qualifier === "string" ) { Daniel@0: if ( isSimple.test( qualifier ) ) { Daniel@0: return jQuery.filter( qualifier, elements, not ); Daniel@0: } Daniel@0: Daniel@0: qualifier = jQuery.filter( qualifier, elements ); Daniel@0: } Daniel@0: Daniel@0: return jQuery.grep( elements, function( elem ) { Daniel@0: return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; Daniel@0: }); Daniel@0: } Daniel@0: function createSafeFragment( document ) { Daniel@0: var list = nodeNames.split( "|" ), Daniel@0: safeFrag = document.createDocumentFragment(); Daniel@0: Daniel@0: if ( safeFrag.createElement ) { Daniel@0: while ( list.length ) { Daniel@0: safeFrag.createElement( Daniel@0: list.pop() Daniel@0: ); Daniel@0: } Daniel@0: } Daniel@0: return safeFrag; Daniel@0: } Daniel@0: Daniel@0: var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + Daniel@0: "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", Daniel@0: rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, Daniel@0: rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), Daniel@0: rleadingWhitespace = /^\s+/, Daniel@0: rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, Daniel@0: rtagName = /<([\w:]+)/, Daniel@0: rtbody = /\s*$/g, Daniel@0: Daniel@0: // We have to close these tags to support XHTML (#13200) Daniel@0: wrapMap = { Daniel@0: option: [ 1, "" ], Daniel@0: legend: [ 1, "
", "
" ], Daniel@0: area: [ 1, "", "" ], Daniel@0: param: [ 1, "", "" ], Daniel@0: thead: [ 1, "", "
" ], Daniel@0: tr: [ 2, "", "
" ], Daniel@0: col: [ 2, "", "
" ], Daniel@0: td: [ 3, "", "
" ], Daniel@0: Daniel@0: // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, Daniel@0: // unless wrapped in a div with non-breaking characters in front of it. Daniel@0: _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X
", "
" ] Daniel@0: }, Daniel@0: safeFragment = createSafeFragment( document ), Daniel@0: fragmentDiv = safeFragment.appendChild( document.createElement("div") ); Daniel@0: Daniel@0: wrapMap.optgroup = wrapMap.option; Daniel@0: wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; Daniel@0: wrapMap.th = wrapMap.td; Daniel@0: Daniel@0: jQuery.fn.extend({ Daniel@0: text: function( value ) { Daniel@0: return jQuery.access( this, function( value ) { Daniel@0: return value === undefined ? Daniel@0: jQuery.text( this ) : Daniel@0: this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); Daniel@0: }, null, value, arguments.length ); Daniel@0: }, Daniel@0: Daniel@0: append: function() { Daniel@0: return this.domManip( arguments, function( elem ) { Daniel@0: if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { Daniel@0: var target = manipulationTarget( this, elem ); Daniel@0: target.appendChild( elem ); Daniel@0: } Daniel@0: }); Daniel@0: }, Daniel@0: Daniel@0: prepend: function() { Daniel@0: return this.domManip( arguments, function( elem ) { Daniel@0: if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { Daniel@0: var target = manipulationTarget( this, elem ); Daniel@0: target.insertBefore( elem, target.firstChild ); Daniel@0: } Daniel@0: }); Daniel@0: }, Daniel@0: Daniel@0: before: function() { Daniel@0: return this.domManip( arguments, function( elem ) { Daniel@0: if ( this.parentNode ) { Daniel@0: this.parentNode.insertBefore( elem, this ); Daniel@0: } Daniel@0: }); Daniel@0: }, Daniel@0: Daniel@0: after: function() { Daniel@0: return this.domManip( arguments, function( elem ) { Daniel@0: if ( this.parentNode ) { Daniel@0: this.parentNode.insertBefore( elem, this.nextSibling ); Daniel@0: } Daniel@0: }); Daniel@0: }, Daniel@0: Daniel@0: // keepData is for internal use only--do not document Daniel@0: remove: function( selector, keepData ) { Daniel@0: var elem, Daniel@0: elems = selector ? jQuery.filter( selector, this ) : this, Daniel@0: i = 0; Daniel@0: Daniel@0: for ( ; (elem = elems[i]) != null; i++ ) { Daniel@0: Daniel@0: if ( !keepData && elem.nodeType === 1 ) { Daniel@0: jQuery.cleanData( getAll( elem ) ); Daniel@0: } Daniel@0: Daniel@0: if ( elem.parentNode ) { Daniel@0: if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { Daniel@0: setGlobalEval( getAll( elem, "script" ) ); Daniel@0: } Daniel@0: elem.parentNode.removeChild( elem ); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return this; Daniel@0: }, Daniel@0: Daniel@0: empty: function() { Daniel@0: var elem, Daniel@0: i = 0; Daniel@0: Daniel@0: for ( ; (elem = this[i]) != null; i++ ) { Daniel@0: // Remove element nodes and prevent memory leaks Daniel@0: if ( elem.nodeType === 1 ) { Daniel@0: jQuery.cleanData( getAll( elem, false ) ); Daniel@0: } Daniel@0: Daniel@0: // Remove any remaining nodes Daniel@0: while ( elem.firstChild ) { Daniel@0: elem.removeChild( elem.firstChild ); Daniel@0: } Daniel@0: Daniel@0: // If this is a select, ensure that it displays empty (#12336) Daniel@0: // Support: IE<9 Daniel@0: if ( elem.options && jQuery.nodeName( elem, "select" ) ) { Daniel@0: elem.options.length = 0; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return this; Daniel@0: }, Daniel@0: Daniel@0: clone: function( dataAndEvents, deepDataAndEvents ) { Daniel@0: dataAndEvents = dataAndEvents == null ? false : dataAndEvents; Daniel@0: deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; Daniel@0: Daniel@0: return this.map( function () { Daniel@0: return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); Daniel@0: }); Daniel@0: }, Daniel@0: Daniel@0: html: function( value ) { Daniel@0: return jQuery.access( this, function( value ) { Daniel@0: var elem = this[0] || {}, Daniel@0: i = 0, Daniel@0: l = this.length; Daniel@0: Daniel@0: if ( value === undefined ) { Daniel@0: return elem.nodeType === 1 ? Daniel@0: elem.innerHTML.replace( rinlinejQuery, "" ) : Daniel@0: undefined; Daniel@0: } Daniel@0: Daniel@0: // See if we can take a shortcut and just use innerHTML Daniel@0: if ( typeof value === "string" && !rnoInnerhtml.test( value ) && Daniel@0: ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && Daniel@0: ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && Daniel@0: !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { Daniel@0: Daniel@0: value = value.replace( rxhtmlTag, "<$1>" ); Daniel@0: Daniel@0: try { Daniel@0: for (; i < l; i++ ) { Daniel@0: // Remove element nodes and prevent memory leaks Daniel@0: elem = this[i] || {}; Daniel@0: if ( elem.nodeType === 1 ) { Daniel@0: jQuery.cleanData( getAll( elem, false ) ); Daniel@0: elem.innerHTML = value; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: elem = 0; Daniel@0: Daniel@0: // If using innerHTML throws an exception, use the fallback method Daniel@0: } catch(e) {} Daniel@0: } Daniel@0: Daniel@0: if ( elem ) { Daniel@0: this.empty().append( value ); Daniel@0: } Daniel@0: }, null, value, arguments.length ); Daniel@0: }, Daniel@0: Daniel@0: replaceWith: function() { Daniel@0: var Daniel@0: // Snapshot the DOM in case .domManip sweeps something relevant into its fragment Daniel@0: args = jQuery.map( this, function( elem ) { Daniel@0: return [ elem.nextSibling, elem.parentNode ]; Daniel@0: }), Daniel@0: i = 0; Daniel@0: Daniel@0: // Make the changes, replacing each context element with the new content Daniel@0: this.domManip( arguments, function( elem ) { Daniel@0: var next = args[ i++ ], Daniel@0: parent = args[ i++ ]; Daniel@0: Daniel@0: if ( parent ) { Daniel@0: // Don't use the snapshot next if it has moved (#13810) Daniel@0: if ( next && next.parentNode !== parent ) { Daniel@0: next = this.nextSibling; Daniel@0: } Daniel@0: jQuery( this ).remove(); Daniel@0: parent.insertBefore( elem, next ); Daniel@0: } Daniel@0: // Allow new content to include elements from the context set Daniel@0: }, true ); Daniel@0: Daniel@0: // Force removal if there was no new content (e.g., from empty arguments) Daniel@0: return i ? this : this.remove(); Daniel@0: }, Daniel@0: Daniel@0: detach: function( selector ) { Daniel@0: return this.remove( selector, true ); Daniel@0: }, Daniel@0: Daniel@0: domManip: function( args, callback, allowIntersection ) { Daniel@0: Daniel@0: // Flatten any nested arrays Daniel@0: args = core_concat.apply( [], args ); Daniel@0: Daniel@0: var first, node, hasScripts, Daniel@0: scripts, doc, fragment, Daniel@0: i = 0, Daniel@0: l = this.length, Daniel@0: set = this, Daniel@0: iNoClone = l - 1, Daniel@0: value = args[0], Daniel@0: isFunction = jQuery.isFunction( value ); Daniel@0: Daniel@0: // We can't cloneNode fragments that contain checked, in WebKit Daniel@0: if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) { Daniel@0: return this.each(function( index ) { Daniel@0: var self = set.eq( index ); Daniel@0: if ( isFunction ) { Daniel@0: args[0] = value.call( this, index, self.html() ); Daniel@0: } Daniel@0: self.domManip( args, callback, allowIntersection ); Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: if ( l ) { Daniel@0: fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, !allowIntersection && this ); Daniel@0: first = fragment.firstChild; Daniel@0: Daniel@0: if ( fragment.childNodes.length === 1 ) { Daniel@0: fragment = first; Daniel@0: } Daniel@0: Daniel@0: if ( first ) { Daniel@0: scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); Daniel@0: hasScripts = scripts.length; Daniel@0: Daniel@0: // Use the original fragment for the last item instead of the first because it can end up Daniel@0: // being emptied incorrectly in certain situations (#8070). Daniel@0: for ( ; i < l; i++ ) { Daniel@0: node = fragment; Daniel@0: Daniel@0: if ( i !== iNoClone ) { Daniel@0: node = jQuery.clone( node, true, true ); Daniel@0: Daniel@0: // Keep references to cloned scripts for later restoration Daniel@0: if ( hasScripts ) { Daniel@0: jQuery.merge( scripts, getAll( node, "script" ) ); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: callback.call( this[i], node, i ); Daniel@0: } Daniel@0: Daniel@0: if ( hasScripts ) { Daniel@0: doc = scripts[ scripts.length - 1 ].ownerDocument; Daniel@0: Daniel@0: // Reenable scripts Daniel@0: jQuery.map( scripts, restoreScript ); Daniel@0: Daniel@0: // Evaluate executable scripts on first document insertion Daniel@0: for ( i = 0; i < hasScripts; i++ ) { Daniel@0: node = scripts[ i ]; Daniel@0: if ( rscriptType.test( node.type || "" ) && Daniel@0: !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { Daniel@0: Daniel@0: if ( node.src ) { Daniel@0: // Hope ajax is available... Daniel@0: jQuery._evalUrl( node.src ); Daniel@0: } else { Daniel@0: jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Fix #11809: Avoid leaking memory Daniel@0: fragment = first = null; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return this; Daniel@0: } Daniel@0: }); Daniel@0: Daniel@0: // Support: IE<8 Daniel@0: // Manipulating tables requires a tbody Daniel@0: function manipulationTarget( elem, content ) { Daniel@0: return jQuery.nodeName( elem, "table" ) && Daniel@0: jQuery.nodeName( content.nodeType === 1 ? content : content.firstChild, "tr" ) ? Daniel@0: Daniel@0: elem.getElementsByTagName("tbody")[0] || Daniel@0: elem.appendChild( elem.ownerDocument.createElement("tbody") ) : Daniel@0: elem; Daniel@0: } Daniel@0: Daniel@0: // Replace/restore the type attribute of script elements for safe DOM manipulation Daniel@0: function disableScript( elem ) { Daniel@0: elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type; Daniel@0: return elem; Daniel@0: } Daniel@0: function restoreScript( elem ) { Daniel@0: var match = rscriptTypeMasked.exec( elem.type ); Daniel@0: if ( match ) { Daniel@0: elem.type = match[1]; Daniel@0: } else { Daniel@0: elem.removeAttribute("type"); Daniel@0: } Daniel@0: return elem; Daniel@0: } Daniel@0: Daniel@0: // Mark scripts as having already been evaluated Daniel@0: function setGlobalEval( elems, refElements ) { Daniel@0: var elem, Daniel@0: i = 0; Daniel@0: for ( ; (elem = elems[i]) != null; i++ ) { Daniel@0: jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: function cloneCopyEvent( src, dest ) { Daniel@0: Daniel@0: if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: var type, i, l, Daniel@0: oldData = jQuery._data( src ), Daniel@0: curData = jQuery._data( dest, oldData ), Daniel@0: events = oldData.events; Daniel@0: Daniel@0: if ( events ) { Daniel@0: delete curData.handle; Daniel@0: curData.events = {}; Daniel@0: Daniel@0: for ( type in events ) { Daniel@0: for ( i = 0, l = events[ type ].length; i < l; i++ ) { Daniel@0: jQuery.event.add( dest, type, events[ type ][ i ] ); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // make the cloned public data object a copy from the original Daniel@0: if ( curData.data ) { Daniel@0: curData.data = jQuery.extend( {}, curData.data ); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: function fixCloneNodeIssues( src, dest ) { Daniel@0: var nodeName, e, data; Daniel@0: Daniel@0: // We do not need to do anything for non-Elements Daniel@0: if ( dest.nodeType !== 1 ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: nodeName = dest.nodeName.toLowerCase(); Daniel@0: Daniel@0: // IE6-8 copies events bound via attachEvent when using cloneNode. Daniel@0: if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) { Daniel@0: data = jQuery._data( dest ); Daniel@0: Daniel@0: for ( e in data.events ) { Daniel@0: jQuery.removeEvent( dest, e, data.handle ); Daniel@0: } Daniel@0: Daniel@0: // Event data gets referenced instead of copied if the expando gets copied too Daniel@0: dest.removeAttribute( jQuery.expando ); Daniel@0: } Daniel@0: Daniel@0: // IE blanks contents when cloning scripts, and tries to evaluate newly-set text Daniel@0: if ( nodeName === "script" && dest.text !== src.text ) { Daniel@0: disableScript( dest ).text = src.text; Daniel@0: restoreScript( dest ); Daniel@0: Daniel@0: // IE6-10 improperly clones children of object elements using classid. Daniel@0: // IE10 throws NoModificationAllowedError if parent is null, #12132. Daniel@0: } else if ( nodeName === "object" ) { Daniel@0: if ( dest.parentNode ) { Daniel@0: dest.outerHTML = src.outerHTML; Daniel@0: } Daniel@0: Daniel@0: // This path appears unavoidable for IE9. When cloning an object Daniel@0: // element in IE9, the outerHTML strategy above is not sufficient. Daniel@0: // If the src has innerHTML and the destination does not, Daniel@0: // copy the src.innerHTML into the dest.innerHTML. #10324 Daniel@0: if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { Daniel@0: dest.innerHTML = src.innerHTML; Daniel@0: } Daniel@0: Daniel@0: } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) { Daniel@0: // IE6-8 fails to persist the checked state of a cloned checkbox Daniel@0: // or radio button. Worse, IE6-7 fail to give the cloned element Daniel@0: // a checked appearance if the defaultChecked value isn't also set Daniel@0: Daniel@0: dest.defaultChecked = dest.checked = src.checked; Daniel@0: Daniel@0: // IE6-7 get confused and end up setting the value of a cloned Daniel@0: // checkbox/radio button to an empty string instead of "on" Daniel@0: if ( dest.value !== src.value ) { Daniel@0: dest.value = src.value; Daniel@0: } Daniel@0: Daniel@0: // IE6-8 fails to return the selected option to the default selected Daniel@0: // state when cloning options Daniel@0: } else if ( nodeName === "option" ) { Daniel@0: dest.defaultSelected = dest.selected = src.defaultSelected; Daniel@0: Daniel@0: // IE6-8 fails to set the defaultValue to the correct value when Daniel@0: // cloning other types of input fields Daniel@0: } else if ( nodeName === "input" || nodeName === "textarea" ) { Daniel@0: dest.defaultValue = src.defaultValue; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: jQuery.each({ Daniel@0: appendTo: "append", Daniel@0: prependTo: "prepend", Daniel@0: insertBefore: "before", Daniel@0: insertAfter: "after", Daniel@0: replaceAll: "replaceWith" Daniel@0: }, function( name, original ) { Daniel@0: jQuery.fn[ name ] = function( selector ) { Daniel@0: var elems, Daniel@0: i = 0, Daniel@0: ret = [], Daniel@0: insert = jQuery( selector ), Daniel@0: last = insert.length - 1; Daniel@0: Daniel@0: for ( ; i <= last; i++ ) { Daniel@0: elems = i === last ? this : this.clone(true); Daniel@0: jQuery( insert[i] )[ original ]( elems ); Daniel@0: Daniel@0: // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() Daniel@0: core_push.apply( ret, elems.get() ); Daniel@0: } Daniel@0: Daniel@0: return this.pushStack( ret ); Daniel@0: }; Daniel@0: }); Daniel@0: Daniel@0: function getAll( context, tag ) { Daniel@0: var elems, elem, Daniel@0: i = 0, Daniel@0: found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) : Daniel@0: typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) : Daniel@0: undefined; Daniel@0: Daniel@0: if ( !found ) { Daniel@0: for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { Daniel@0: if ( !tag || jQuery.nodeName( elem, tag ) ) { Daniel@0: found.push( elem ); Daniel@0: } else { Daniel@0: jQuery.merge( found, getAll( elem, tag ) ); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return tag === undefined || tag && jQuery.nodeName( context, tag ) ? Daniel@0: jQuery.merge( [ context ], found ) : Daniel@0: found; Daniel@0: } Daniel@0: Daniel@0: // Used in buildFragment, fixes the defaultChecked property Daniel@0: function fixDefaultChecked( elem ) { Daniel@0: if ( manipulation_rcheckableType.test( elem.type ) ) { Daniel@0: elem.defaultChecked = elem.checked; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: jQuery.extend({ Daniel@0: clone: function( elem, dataAndEvents, deepDataAndEvents ) { Daniel@0: var destElements, node, clone, i, srcElements, Daniel@0: inPage = jQuery.contains( elem.ownerDocument, elem ); Daniel@0: Daniel@0: if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { Daniel@0: clone = elem.cloneNode( true ); Daniel@0: Daniel@0: // IE<=8 does not properly clone detached, unknown element nodes Daniel@0: } else { Daniel@0: fragmentDiv.innerHTML = elem.outerHTML; Daniel@0: fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); Daniel@0: } Daniel@0: Daniel@0: if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && Daniel@0: (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { Daniel@0: Daniel@0: // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 Daniel@0: destElements = getAll( clone ); Daniel@0: srcElements = getAll( elem ); Daniel@0: Daniel@0: // Fix all IE cloning issues Daniel@0: for ( i = 0; (node = srcElements[i]) != null; ++i ) { Daniel@0: // Ensure that the destination node is not null; Fixes #9587 Daniel@0: if ( destElements[i] ) { Daniel@0: fixCloneNodeIssues( node, destElements[i] ); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Copy the events from the original to the clone Daniel@0: if ( dataAndEvents ) { Daniel@0: if ( deepDataAndEvents ) { Daniel@0: srcElements = srcElements || getAll( elem ); Daniel@0: destElements = destElements || getAll( clone ); Daniel@0: Daniel@0: for ( i = 0; (node = srcElements[i]) != null; i++ ) { Daniel@0: cloneCopyEvent( node, destElements[i] ); Daniel@0: } Daniel@0: } else { Daniel@0: cloneCopyEvent( elem, clone ); Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Preserve script evaluation history Daniel@0: destElements = getAll( clone, "script" ); Daniel@0: if ( destElements.length > 0 ) { Daniel@0: setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); Daniel@0: } Daniel@0: Daniel@0: destElements = srcElements = node = null; Daniel@0: Daniel@0: // Return the cloned set Daniel@0: return clone; Daniel@0: }, Daniel@0: Daniel@0: buildFragment: function( elems, context, scripts, selection ) { Daniel@0: var j, elem, contains, Daniel@0: tmp, tag, tbody, wrap, Daniel@0: l = elems.length, Daniel@0: Daniel@0: // Ensure a safe fragment Daniel@0: safe = createSafeFragment( context ), Daniel@0: Daniel@0: nodes = [], Daniel@0: i = 0; Daniel@0: Daniel@0: for ( ; i < l; i++ ) { Daniel@0: elem = elems[ i ]; Daniel@0: Daniel@0: if ( elem || elem === 0 ) { Daniel@0: Daniel@0: // Add nodes directly Daniel@0: if ( jQuery.type( elem ) === "object" ) { Daniel@0: jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); Daniel@0: Daniel@0: // Convert non-html into a text node Daniel@0: } else if ( !rhtml.test( elem ) ) { Daniel@0: nodes.push( context.createTextNode( elem ) ); Daniel@0: Daniel@0: // Convert html into DOM nodes Daniel@0: } else { Daniel@0: tmp = tmp || safe.appendChild( context.createElement("div") ); Daniel@0: Daniel@0: // Deserialize a standard representation Daniel@0: tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); Daniel@0: wrap = wrapMap[ tag ] || wrapMap._default; Daniel@0: Daniel@0: tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[2]; Daniel@0: Daniel@0: // Descend through wrappers to the right content Daniel@0: j = wrap[0]; Daniel@0: while ( j-- ) { Daniel@0: tmp = tmp.lastChild; Daniel@0: } Daniel@0: Daniel@0: // Manually add leading whitespace removed by IE Daniel@0: if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { Daniel@0: nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); Daniel@0: } Daniel@0: Daniel@0: // Remove IE's autoinserted from table fragments Daniel@0: if ( !jQuery.support.tbody ) { Daniel@0: Daniel@0: // String was a , *may* have spurious Daniel@0: elem = tag === "table" && !rtbody.test( elem ) ? Daniel@0: tmp.firstChild : Daniel@0: Daniel@0: // String was a bare or Daniel@0: wrap[1] === "
" && !rtbody.test( elem ) ? Daniel@0: tmp : Daniel@0: 0; Daniel@0: Daniel@0: j = elem && elem.childNodes.length; Daniel@0: while ( j-- ) { Daniel@0: if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { Daniel@0: elem.removeChild( tbody ); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: jQuery.merge( nodes, tmp.childNodes ); Daniel@0: Daniel@0: // Fix #12392 for WebKit and IE > 9 Daniel@0: tmp.textContent = ""; Daniel@0: Daniel@0: // Fix #12392 for oldIE Daniel@0: while ( tmp.firstChild ) { Daniel@0: tmp.removeChild( tmp.firstChild ); Daniel@0: } Daniel@0: Daniel@0: // Remember the top-level container for proper cleanup Daniel@0: tmp = safe.lastChild; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Fix #11356: Clear elements from fragment Daniel@0: if ( tmp ) { Daniel@0: safe.removeChild( tmp ); Daniel@0: } Daniel@0: Daniel@0: // Reset defaultChecked for any radios and checkboxes Daniel@0: // about to be appended to the DOM in IE 6/7 (#8060) Daniel@0: if ( !jQuery.support.appendChecked ) { Daniel@0: jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); Daniel@0: } Daniel@0: Daniel@0: i = 0; Daniel@0: while ( (elem = nodes[ i++ ]) ) { Daniel@0: Daniel@0: // #4087 - If origin and destination elements are the same, and this is Daniel@0: // that element, do not do anything Daniel@0: if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { Daniel@0: continue; Daniel@0: } Daniel@0: Daniel@0: contains = jQuery.contains( elem.ownerDocument, elem ); Daniel@0: Daniel@0: // Append to fragment Daniel@0: tmp = getAll( safe.appendChild( elem ), "script" ); Daniel@0: Daniel@0: // Preserve script evaluation history Daniel@0: if ( contains ) { Daniel@0: setGlobalEval( tmp ); Daniel@0: } Daniel@0: Daniel@0: // Capture executables Daniel@0: if ( scripts ) { Daniel@0: j = 0; Daniel@0: while ( (elem = tmp[ j++ ]) ) { Daniel@0: if ( rscriptType.test( elem.type || "" ) ) { Daniel@0: scripts.push( elem ); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: tmp = null; Daniel@0: Daniel@0: return safe; Daniel@0: }, Daniel@0: Daniel@0: cleanData: function( elems, /* internal */ acceptData ) { Daniel@0: var elem, type, id, data, Daniel@0: i = 0, Daniel@0: internalKey = jQuery.expando, Daniel@0: cache = jQuery.cache, Daniel@0: deleteExpando = jQuery.support.deleteExpando, Daniel@0: special = jQuery.event.special; Daniel@0: Daniel@0: for ( ; (elem = elems[i]) != null; i++ ) { Daniel@0: Daniel@0: if ( acceptData || jQuery.acceptData( elem ) ) { Daniel@0: Daniel@0: id = elem[ internalKey ]; Daniel@0: data = id && cache[ id ]; Daniel@0: Daniel@0: if ( data ) { Daniel@0: if ( data.events ) { Daniel@0: for ( type in data.events ) { Daniel@0: if ( special[ type ] ) { Daniel@0: jQuery.event.remove( elem, type ); Daniel@0: Daniel@0: // This is a shortcut to avoid jQuery.event.remove's overhead Daniel@0: } else { Daniel@0: jQuery.removeEvent( elem, type, data.handle ); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Remove cache only if it was not already removed by jQuery.event.remove Daniel@0: if ( cache[ id ] ) { Daniel@0: Daniel@0: delete cache[ id ]; Daniel@0: Daniel@0: // IE does not allow us to delete expando properties from nodes, Daniel@0: // nor does it have a removeAttribute function on Document nodes; Daniel@0: // we must handle all of these cases Daniel@0: if ( deleteExpando ) { Daniel@0: delete elem[ internalKey ]; Daniel@0: Daniel@0: } else if ( typeof elem.removeAttribute !== core_strundefined ) { Daniel@0: elem.removeAttribute( internalKey ); Daniel@0: Daniel@0: } else { Daniel@0: elem[ internalKey ] = null; Daniel@0: } Daniel@0: Daniel@0: core_deletedIds.push( id ); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: _evalUrl: function( url ) { Daniel@0: return jQuery.ajax({ Daniel@0: url: url, Daniel@0: type: "GET", Daniel@0: dataType: "script", Daniel@0: async: false, Daniel@0: global: false, Daniel@0: "throws": true Daniel@0: }); Daniel@0: } Daniel@0: }); Daniel@0: jQuery.fn.extend({ Daniel@0: wrapAll: function( html ) { Daniel@0: if ( jQuery.isFunction( html ) ) { Daniel@0: return this.each(function(i) { Daniel@0: jQuery(this).wrapAll( html.call(this, i) ); Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: if ( this[0] ) { Daniel@0: // The elements to wrap the target around Daniel@0: var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); Daniel@0: Daniel@0: if ( this[0].parentNode ) { Daniel@0: wrap.insertBefore( this[0] ); Daniel@0: } Daniel@0: Daniel@0: wrap.map(function() { Daniel@0: var elem = this; Daniel@0: Daniel@0: while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { Daniel@0: elem = elem.firstChild; Daniel@0: } Daniel@0: Daniel@0: return elem; Daniel@0: }).append( this ); Daniel@0: } Daniel@0: Daniel@0: return this; Daniel@0: }, Daniel@0: Daniel@0: wrapInner: function( html ) { Daniel@0: if ( jQuery.isFunction( html ) ) { Daniel@0: return this.each(function(i) { Daniel@0: jQuery(this).wrapInner( html.call(this, i) ); Daniel@0: }); Daniel@0: } Daniel@0: Daniel@0: return this.each(function() { Daniel@0: var self = jQuery( this ), Daniel@0: contents = self.contents(); Daniel@0: Daniel@0: if ( contents.length ) { Daniel@0: contents.wrapAll( html ); Daniel@0: Daniel@0: } else { Daniel@0: self.append( html ); Daniel@0: } Daniel@0: }); Daniel@0: }, Daniel@0: Daniel@0: wrap: function( html ) { Daniel@0: var isFunction = jQuery.isFunction( html ); Daniel@0: Daniel@0: return this.each(function(i) { Daniel@0: jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); Daniel@0: }); Daniel@0: }, Daniel@0: Daniel@0: unwrap: function() { Daniel@0: return this.parent().each(function() { Daniel@0: if ( !jQuery.nodeName( this, "body" ) ) { Daniel@0: jQuery( this ).replaceWith( this.childNodes ); Daniel@0: } Daniel@0: }).end(); Daniel@0: } Daniel@0: }); Daniel@0: var iframe, getStyles, curCSS, Daniel@0: ralpha = /alpha\([^)]*\)/i, Daniel@0: ropacity = /opacity\s*=\s*([^)]*)/, Daniel@0: rposition = /^(top|right|bottom|left)$/, Daniel@0: // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" Daniel@0: // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display Daniel@0: rdisplayswap = /^(none|table(?!-c[ea]).+)/, Daniel@0: rmargin = /^margin/, Daniel@0: rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), Daniel@0: rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), Daniel@0: rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ), Daniel@0: elemdisplay = { BODY: "block" }, Daniel@0: Daniel@0: cssShow = { position: "absolute", visibility: "hidden", display: "block" }, Daniel@0: cssNormalTransform = { Daniel@0: letterSpacing: 0, Daniel@0: fontWeight: 400 Daniel@0: }, Daniel@0: Daniel@0: cssExpand = [ "Top", "Right", "Bottom", "Left" ], Daniel@0: cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; Daniel@0: Daniel@0: // return a css property mapped to a potentially vendor prefixed property Daniel@0: function vendorPropName( style, name ) { Daniel@0: Daniel@0: // shortcut for names that are not vendor prefixed Daniel@0: if ( name in style ) { Daniel@0: return name; Daniel@0: } Daniel@0: Daniel@0: // check for vendor prefixed names Daniel@0: var capName = name.charAt(0).toUpperCase() + name.slice(1), Daniel@0: origName = name, Daniel@0: i = cssPrefixes.length; Daniel@0: Daniel@0: while ( i-- ) { Daniel@0: name = cssPrefixes[ i ] + capName; Daniel@0: if ( name in style ) { Daniel@0: return name; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return origName; Daniel@0: } Daniel@0: Daniel@0: function isHidden( elem, el ) { Daniel@0: // isHidden might be called from jQuery#filter function; Daniel@0: // in that case, element will be second argument Daniel@0: elem = el || elem; Daniel@0: return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); Daniel@0: } Daniel@0: Daniel@0: function showHide( elements, show ) { Daniel@0: var display, elem, hidden, Daniel@0: values = [], Daniel@0: index = 0, Daniel@0: length = elements.length; Daniel@0: Daniel@0: for ( ; index < length; index++ ) { Daniel@0: elem = elements[ index ]; Daniel@0: if ( !elem.style ) { Daniel@0: continue; Daniel@0: } Daniel@0: Daniel@0: values[ index ] = jQuery._data( elem, "olddisplay" ); Daniel@0: display = elem.style.display; Daniel@0: if ( show ) { Daniel@0: // Reset the inline display of this element to learn if it is Daniel@0: // being hidden by cascaded rules or not Daniel@0: if ( !values[ index ] && display === "none" ) { Daniel@0: elem.style.display = ""; Daniel@0: } Daniel@0: Daniel@0: // Set elements which have been overridden with display: none Daniel@0: // in a stylesheet to whatever the default browser style is Daniel@0: // for such an element Daniel@0: if ( elem.style.display === "" && isHidden( elem ) ) { Daniel@0: values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); Daniel@0: } Daniel@0: } else { Daniel@0: Daniel@0: if ( !values[ index ] ) { Daniel@0: hidden = isHidden( elem ); Daniel@0: Daniel@0: if ( display && display !== "none" || !hidden ) { Daniel@0: jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: // Set the display of most of the elements in a second loop Daniel@0: // to avoid the constant reflow Daniel@0: for ( index = 0; index < length; index++ ) { Daniel@0: elem = elements[ index ]; Daniel@0: if ( !elem.style ) { Daniel@0: continue; Daniel@0: } Daniel@0: if ( !show || elem.style.display === "none" || elem.style.display === "" ) { Daniel@0: elem.style.display = show ? values[ index ] || "" : "none"; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return elements; Daniel@0: } Daniel@0: Daniel@0: jQuery.fn.extend({ Daniel@0: css: function( name, value ) { Daniel@0: return jQuery.access( this, function( elem, name, value ) { Daniel@0: var len, styles, Daniel@0: map = {}, Daniel@0: i = 0; Daniel@0: Daniel@0: if ( jQuery.isArray( name ) ) { Daniel@0: styles = getStyles( elem ); Daniel@0: len = name.length; Daniel@0: Daniel@0: for ( ; i < len; i++ ) { Daniel@0: map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); Daniel@0: } Daniel@0: Daniel@0: return map; Daniel@0: } Daniel@0: Daniel@0: return value !== undefined ? Daniel@0: jQuery.style( elem, name, value ) : Daniel@0: jQuery.css( elem, name ); Daniel@0: }, name, value, arguments.length > 1 ); Daniel@0: }, Daniel@0: show: function() { Daniel@0: return showHide( this, true ); Daniel@0: }, Daniel@0: hide: function() { Daniel@0: return showHide( this ); Daniel@0: }, Daniel@0: toggle: function( state ) { Daniel@0: if ( typeof state === "boolean" ) { Daniel@0: return state ? this.show() : this.hide(); Daniel@0: } Daniel@0: Daniel@0: return this.each(function() { Daniel@0: if ( isHidden( this ) ) { Daniel@0: jQuery( this ).show(); Daniel@0: } else { Daniel@0: jQuery( this ).hide(); Daniel@0: } Daniel@0: }); Daniel@0: } Daniel@0: }); Daniel@0: Daniel@0: jQuery.extend({ Daniel@0: // Add in style property hooks for overriding the default Daniel@0: // behavior of getting and setting a style property Daniel@0: cssHooks: { Daniel@0: opacity: { Daniel@0: get: function( elem, computed ) { Daniel@0: if ( computed ) { Daniel@0: // We should always get a number back from opacity Daniel@0: var ret = curCSS( elem, "opacity" ); Daniel@0: return ret === "" ? "1" : ret; Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: // Don't automatically add "px" to these possibly-unitless properties Daniel@0: cssNumber: { Daniel@0: "columnCount": true, Daniel@0: "fillOpacity": true, Daniel@0: "fontWeight": true, Daniel@0: "lineHeight": true, Daniel@0: "opacity": true, Daniel@0: "order": true, Daniel@0: "orphans": true, Daniel@0: "widows": true, Daniel@0: "zIndex": true, Daniel@0: "zoom": true Daniel@0: }, Daniel@0: Daniel@0: // Add in properties whose names you wish to fix before Daniel@0: // setting or getting the value Daniel@0: cssProps: { Daniel@0: // normalize float css property Daniel@0: "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" Daniel@0: }, Daniel@0: Daniel@0: // Get and set the style property on a DOM Node Daniel@0: style: function( elem, name, value, extra ) { Daniel@0: // Don't set styles on text and comment nodes Daniel@0: if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: // Make sure that we're working with the right name Daniel@0: var ret, type, hooks, Daniel@0: origName = jQuery.camelCase( name ), Daniel@0: style = elem.style; Daniel@0: Daniel@0: name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); Daniel@0: Daniel@0: // gets hook for the prefixed version Daniel@0: // followed by the unprefixed version Daniel@0: hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; Daniel@0: Daniel@0: // Check if we're setting a value Daniel@0: if ( value !== undefined ) { Daniel@0: type = typeof value; Daniel@0: Daniel@0: // convert relative number strings (+= or -=) to relative numbers. #7345 Daniel@0: if ( type === "string" && (ret = rrelNum.exec( value )) ) { Daniel@0: value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); Daniel@0: // Fixes bug #9237 Daniel@0: type = "number"; Daniel@0: } Daniel@0: Daniel@0: // Make sure that NaN and null values aren't set. See: #7116 Daniel@0: if ( value == null || type === "number" && isNaN( value ) ) { Daniel@0: return; Daniel@0: } Daniel@0: Daniel@0: // If a number was passed in, add 'px' to the (except for certain CSS properties) Daniel@0: if ( type === "number" && !jQuery.cssNumber[ origName ] ) { Daniel@0: value += "px"; Daniel@0: } Daniel@0: Daniel@0: // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, Daniel@0: // but it would mean to define eight (for every problematic property) identical functions Daniel@0: if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { Daniel@0: style[ name ] = "inherit"; Daniel@0: } Daniel@0: Daniel@0: // If a hook was provided, use that value, otherwise just set the specified value Daniel@0: if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { Daniel@0: Daniel@0: // Wrapped to prevent IE from throwing errors when 'invalid' values are provided Daniel@0: // Fixes bug #5509 Daniel@0: try { Daniel@0: style[ name ] = value; Daniel@0: } catch(e) {} Daniel@0: } Daniel@0: Daniel@0: } else { Daniel@0: // If a hook was provided get the non-computed value from there Daniel@0: if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { Daniel@0: return ret; Daniel@0: } Daniel@0: Daniel@0: // Otherwise just get the value from the style object Daniel@0: return style[ name ]; Daniel@0: } Daniel@0: }, Daniel@0: Daniel@0: css: function( elem, name, extra, styles ) { Daniel@0: var num, val, hooks, Daniel@0: origName = jQuery.camelCase( name ); Daniel@0: Daniel@0: // Make sure that we're working with the right name Daniel@0: name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); Daniel@0: Daniel@0: // gets hook for the prefixed version Daniel@0: // followed by the unprefixed version Daniel@0: hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; Daniel@0: Daniel@0: // If a hook was provided get the computed value from there Daniel@0: if ( hooks && "get" in hooks ) { Daniel@0: val = hooks.get( elem, true, extra ); Daniel@0: } Daniel@0: Daniel@0: // Otherwise, if a way to get the computed value exists, use that Daniel@0: if ( val === undefined ) { Daniel@0: val = curCSS( elem, name, styles ); Daniel@0: } Daniel@0: Daniel@0: //convert "normal" to computed value Daniel@0: if ( val === "normal" && name in cssNormalTransform ) { Daniel@0: val = cssNormalTransform[ name ]; Daniel@0: } Daniel@0: Daniel@0: // Return, converting to number if forced or a qualifier was provided and val looks numeric Daniel@0: if ( extra === "" || extra ) { Daniel@0: num = parseFloat( val ); Daniel@0: return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; Daniel@0: } Daniel@0: return val; Daniel@0: } Daniel@0: }); Daniel@0: Daniel@0: // NOTE: we've included the "window" in window.getComputedStyle Daniel@0: // because jsdom on node.js will break without it. Daniel@0: if ( window.getComputedStyle ) { Daniel@0: getStyles = function( elem ) { Daniel@0: return window.getComputedStyle( elem, null ); Daniel@0: }; Daniel@0: Daniel@0: curCSS = function( elem, name, _computed ) { Daniel@0: var width, minWidth, maxWidth, Daniel@0: computed = _computed || getStyles( elem ), Daniel@0: Daniel@0: // getPropertyValue is only needed for .css('filter') in IE9, see #12537 Daniel@0: ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined, Daniel@0: style = elem.style; Daniel@0: Daniel@0: if ( computed ) { Daniel@0: Daniel@0: if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { Daniel@0: ret = jQuery.style( elem, name ); Daniel@0: } Daniel@0: Daniel@0: // A tribute to the "awesome hack by Dean Edwards" Daniel@0: // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right Daniel@0: // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels Daniel@0: // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values Daniel@0: if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { Daniel@0: Daniel@0: // Remember the original values Daniel@0: width = style.width; Daniel@0: minWidth = style.minWidth; Daniel@0: maxWidth = style.maxWidth; Daniel@0: Daniel@0: // Put in the new values to get a computed value out Daniel@0: style.minWidth = style.maxWidth = style.width = ret; Daniel@0: ret = computed.width; Daniel@0: Daniel@0: // Revert the changed values Daniel@0: style.width = width; Daniel@0: style.minWidth = minWidth; Daniel@0: style.maxWidth = maxWidth; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return ret; Daniel@0: }; Daniel@0: } else if ( document.documentElement.currentStyle ) { Daniel@0: getStyles = function( elem ) { Daniel@0: return elem.currentStyle; Daniel@0: }; Daniel@0: Daniel@0: curCSS = function( elem, name, _computed ) { Daniel@0: var left, rs, rsLeft, Daniel@0: computed = _computed || getStyles( elem ), Daniel@0: ret = computed ? computed[ name ] : undefined, Daniel@0: style = elem.style; Daniel@0: Daniel@0: // Avoid setting ret to empty string here Daniel@0: // so we don't default to auto Daniel@0: if ( ret == null && style && style[ name ] ) { Daniel@0: ret = style[ name ]; Daniel@0: } Daniel@0: Daniel@0: // From the awesome hack by Dean Edwards Daniel@0: // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 Daniel@0: Daniel@0: // If we're not dealing with a regular pixel number Daniel@0: // but a number that has a weird ending, we need to convert it to pixels Daniel@0: // but not position css attributes, as those are proportional to the parent element instead Daniel@0: // and we can't measure the parent instead because it might trigger a "stacking dolls" problem Daniel@0: if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { Daniel@0: Daniel@0: // Remember the original values Daniel@0: left = style.left; Daniel@0: rs = elem.runtimeStyle; Daniel@0: rsLeft = rs && rs.left; Daniel@0: Daniel@0: // Put in the new values to get a computed value out Daniel@0: if ( rsLeft ) { Daniel@0: rs.left = elem.currentStyle.left; Daniel@0: } Daniel@0: style.left = name === "fontSize" ? "1em" : ret; Daniel@0: ret = style.pixelLeft + "px"; Daniel@0: Daniel@0: // Revert the changed values Daniel@0: style.left = left; Daniel@0: if ( rsLeft ) { Daniel@0: rs.left = rsLeft; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return ret === "" ? "auto" : ret; Daniel@0: }; Daniel@0: } Daniel@0: Daniel@0: function setPositiveNumber( elem, value, subtract ) { Daniel@0: var matches = rnumsplit.exec( value ); Daniel@0: return matches ? Daniel@0: // Guard against undefined "subtract", e.g., when used as in cssHooks Daniel@0: Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : Daniel@0: value; Daniel@0: } Daniel@0: Daniel@0: function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { Daniel@0: var i = extra === ( isBorderBox ? "border" : "content" ) ? Daniel@0: // If we already have the right measurement, avoid augmentation Daniel@0: 4 : Daniel@0: // Otherwise initialize for horizontal or vertical properties Daniel@0: name === "width" ? 1 : 0, Daniel@0: Daniel@0: val = 0; Daniel@0: Daniel@0: for ( ; i < 4; i += 2 ) { Daniel@0: // both box models exclude margin, so add it if we want it Daniel@0: if ( extra === "margin" ) { Daniel@0: val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); Daniel@0: } Daniel@0: Daniel@0: if ( isBorderBox ) { Daniel@0: // border-box includes padding, so remove it if we want content Daniel@0: if ( extra === "content" ) { Daniel@0: val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); Daniel@0: } Daniel@0: Daniel@0: // at this point, extra isn't border nor margin, so remove border Daniel@0: if ( extra !== "margin" ) { Daniel@0: val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); Daniel@0: } Daniel@0: } else { Daniel@0: // at this point, extra isn't content, so add padding Daniel@0: val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); Daniel@0: Daniel@0: // at this point, extra isn't content nor padding, so add border Daniel@0: if ( extra !== "padding" ) { Daniel@0: val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); Daniel@0: } Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: return val; Daniel@0: } Daniel@0: Daniel@0: function getWidthOrHeight( elem, name, extra ) { Daniel@0: Daniel@0: // Start with offset property, which is equivalent to the border-box value Daniel@0: var valueIsBorderBox = true, Daniel@0: val = name === "width" ? elem.offsetWidth : elem.offsetHeight, Daniel@0: styles = getStyles( elem ), Daniel@0: isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; Daniel@0: Daniel@0: // some non-html elements return undefined for offsetWidth, so check for null/undefined Daniel@0: // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 Daniel@0: // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 Daniel@0: if ( val <= 0 || val == null ) { Daniel@0: // Fall back to computed then uncomputed css if necessary Daniel@0: val = curCSS( elem, name, styles ); Daniel@0: if ( val < 0 || val == null ) { Daniel@0: val = elem.style[ name ]; Daniel@0: } Daniel@0: Daniel@0: // Computed unit is not pixels. Stop here and return. Daniel@0: if ( rnumnonpx.test(val) ) { Daniel@0: return val; Daniel@0: } Daniel@0: Daniel@0: // we need the check for style in case a browser which returns unreliable values Daniel@0: // for getComputedStyle silently falls back to the reliable elem.style Daniel@0: valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); Daniel@0: Daniel@0: // Normalize "", auto, and prepare for extra Daniel@0: val = parseFloat( val ) || 0; Daniel@0: } Daniel@0: Daniel@0: // use the active box-sizing model to add/subtract irrelevant styles Daniel@0: return ( val + Daniel@0: augmentWidthOrHeight( Daniel@0: elem, Daniel@0: name, Daniel@0: extra || ( isBorderBox ? "border" : "content" ), Daniel@0: valueIsBorderBox, Daniel@0: styles Daniel@0: ) Daniel@0: ) + "px"; Daniel@0: } Daniel@0: Daniel@0: // Try to determine the default display value of an element Daniel@0: function css_defaultDisplay( nodeName ) { Daniel@0: var doc = document, Daniel@0: display = elemdisplay[ nodeName ]; Daniel@0: Daniel@0: if ( !display ) { Daniel@0: display = actualDisplay( nodeName, doc ); Daniel@0: Daniel@0: // If the simple way fails, read from inside an iframe Daniel@0: if ( display === "none" || !display ) { Daniel@0: // Use the already-created iframe if possible Daniel@0: iframe = ( iframe || Daniel@0: jQuery("