/*! * jquery javascript library v1.9.0 * http://jquery.com/ * * includes sizzle.js * http://sizzlejs.com/ * * copyright 2005, 2012 jquery foundation, inc. and other contributors * released under the mit license * http://jquery.org/license * * date: 2013-1-14 */ (function( window, undefined ) { "use strict"; var // a central reference to the root jquery(document) rootjquery, // the deferred used on dom ready readylist, // use the correct document accordingly with window argument (sandbox) document = window.document, location = window.location, // map over jquery in case of overwrite _jquery = window.jquery, // map over the $ in case of overwrite _$ = window.$, // [[class]] -> type pairs class2type = {}, // list of deleted data cache ids, so we can reuse them core_deletedids = [], core_version = "1.9.0", // save a reference to some core methods core_concat = core_deletedids.concat, core_push = core_deletedids.push, core_slice = core_deletedids.slice, core_indexof = core_deletedids.indexof, core_tostring = class2type.tostring, core_hasown = class2type.hasownproperty, core_trim = core_version.trim, // define a local copy of jquery jquery = function( selector, context ) { // the jquery object is actually just the init constructor 'enhanced' return new jquery.fn.init( selector, context, rootjquery ); }, // used for matching numbers core_pnum = /[+-]?(?:\d*\.|)\d+(?:[ee][+-]?\d+|)/.source, // used for splitting on whitespace core_rnotwhite = /\s+/g, // make sure we trim bom and nbsp (here's looking at you, safari 5.0 and ie) rtrim = /^[\s\ufeff\xa0]+|[\s\ufeff\xa0]+$/g, // a simple way to check for html strings // prioritize #id over to avoid xss via location.hash (#9521) // strict html recognition (#11290: must start with <) rquickexpr = /^(?:(<[\w\w]+>)[^>]*|#([\w-]*))$/, // match a standalone tag rsingletag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, // json regexp rvalidchars = /^[\],:{}\s]*$/, rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fa-f]{4})/g, rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[ee][+-]?\d+|)/g, // matches dashed string for camelizing rmsprefix = /^-ms-/, rdashalpha = /-([\da-z])/gi, // used by jquery.camelcase as callback to replace() fcamelcase = function( all, letter ) { return letter.touppercase(); }, // the ready event handler and self cleanup method domcontentloaded = function() { if ( document.addeventlistener ) { document.removeeventlistener( "domcontentloaded", domcontentloaded, false ); jquery.ready(); } else if ( document.readystate === "complete" ) { // we're here because readystate === "complete" in oldie // which is good enough for us to call the dom ready! document.detachevent( "onreadystatechange", domcontentloaded ); jquery.ready(); } }; jquery.fn = jquery.prototype = { // the current version of jquery being used jquery: core_version, constructor: jquery, init: function( selector, context, rootjquery ) { var match, elem; // handle: $(""), $(null), $(undefined), $(false) if ( !selector ) { return this; } // handle html strings if ( typeof selector === "string" ) { if ( selector.charat(0) === "<" && selector.charat( selector.length - 1 ) === ">" && selector.length >= 3 ) { // assume that strings that start and end with <> are html and skip the regex check match = [ null, selector, null ]; } else { match = rquickexpr.exec( selector ); } // match html or make sure no context is specified for #id if ( match && (match[1] || !context) ) { // handle: $(html) -> $(array) if ( match[1] ) { context = context instanceof jquery ? context[0] : context; // scripts is true for back-compat jquery.merge( this, jquery.parsehtml( match[1], context && context.nodetype ? context.ownerdocument || context : document, true ) ); // handle: $(html, props) if ( rsingletag.test( match[1] ) && jquery.isplainobject( context ) ) { for ( match in context ) { // properties of context are called as methods if possible if ( jquery.isfunction( this[ match ] ) ) { this[ match ]( context[ match ] ); // ...and otherwise set as attributes } else { this.attr( match, context[ match ] ); } } } return this; // handle: $(#id) } else { elem = document.getelementbyid( match[2] ); // check parentnode to catch when blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentnode ) { // handle the case where ie and opera return items // by name instead of id if ( elem.id !== match[2] ) { return rootjquery.find( selector ); } // otherwise, we inject the element directly into the jquery object this.length = 1; this[0] = elem; } this.context = document; this.selector = selector; return this; } // handle: $(expr, $(...)) } else if ( !context || context.jquery ) { return ( context || rootjquery ).find( selector ); // handle: $(expr, context) // (which is just equivalent to: $(context).find(expr) } else { return this.constructor( context ).find( selector ); } // handle: $(domelement) } else if ( selector.nodetype ) { this.context = this[0] = selector; this.length = 1; return this; // handle: $(function) // shortcut for document ready } else if ( jquery.isfunction( selector ) ) { return rootjquery.ready( selector ); } if ( selector.selector !== undefined ) { this.selector = selector.selector; this.context = selector.context; } return jquery.makearray( selector, this ); }, // start with an empty selector selector: "", // the default length of a jquery object is 0 length: 0, // the number of elements contained in the matched element set size: function() { return this.length; }, toarray: function() { return core_slice.call( this ); }, // get the nth element in the matched element set or // get the whole matched element set as a clean array get: function( num ) { return num == null ? // return a 'clean' array this.toarray() : // return just the object ( num < 0 ? this[ this.length + num ] : this[ num ] ); }, // take an array of elements and push it onto the stack // (returning the new matched element set) pushstack: function( elems ) { // build a new jquery matched element set var ret = jquery.merge( this.constructor(), elems ); // add the old object onto the stack (as a reference) ret.prevobject = this; ret.context = this.context; // return the newly-formed element set return ret; }, // execute a callback for every element in the matched set. // (you can seed the arguments with an array of args, but this is // only used internally.) each: function( callback, args ) { return jquery.each( this, callback, args ); }, ready: function( fn ) { // add the callback jquery.ready.promise().done( fn ); return this; }, slice: function() { return this.pushstack( core_slice.apply( this, arguments ) ); }, first: function() { return this.eq( 0 ); }, last: function() { return this.eq( -1 ); }, eq: function( i ) { var len = this.length, j = +i + ( i < 0 ? len : 0 ); return this.pushstack( j >= 0 && j < len ? [ this[j] ] : [] ); }, map: function( callback ) { return this.pushstack( jquery.map(this, function( elem, i ) { return callback.call( elem, i, elem ); })); }, end: function() { return this.prevobject || this.constructor(null); }, // for internal use only. // behaves like an array's method, not like a jquery method. push: core_push, sort: [].sort, splice: [].splice }; // give the init function the jquery prototype for later instantiation jquery.fn.init.prototype = jquery.fn; jquery.extend = jquery.fn.extend = function() { var options, name, src, copy, copyisarray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; // handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; target = arguments[1] || {}; // skip the boolean and the target i = 2; } // handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jquery.isfunction(target) ) { target = {}; } // extend jquery itself if only one argument is passed if ( length === i ) { target = this; --i; } for ( ; i < length; i++ ) { // only deal with non-null/undefined values if ( (options = arguments[ i ]) != null ) { // extend the base object for ( name in options ) { src = target[ name ]; copy = options[ name ]; // prevent never-ending loop if ( target === copy ) { continue; } // recurse if we're merging plain objects or arrays if ( deep && copy && ( jquery.isplainobject(copy) || (copyisarray = jquery.isarray(copy)) ) ) { if ( copyisarray ) { copyisarray = false; clone = src && jquery.isarray(src) ? src : []; } else { clone = src && jquery.isplainobject(src) ? src : {}; } // never move original objects, clone them target[ name ] = jquery.extend( deep, clone, copy ); // don't bring in undefined values } else if ( copy !== undefined ) { target[ name ] = copy; } } } } // return the modified object return target; }; jquery.extend({ noconflict: function( deep ) { if ( window.$ === jquery ) { window.$ = _$; } if ( deep && window.jquery === jquery ) { window.jquery = _jquery; } return jquery; }, // is the dom ready to be used? set to true once it occurs. isready: false, // a counter to track how many items to wait for before // the ready event fires. see #6781 readywait: 1, // hold (or release) the ready event holdready: function( hold ) { if ( hold ) { jquery.readywait++; } else { jquery.ready( true ); } }, // handle when the dom is ready ready: function( wait ) { // abort if there are pending holds or we're already ready if ( wait === true ? --jquery.readywait : jquery.isready ) { return; } // make sure body exists, at least, in case ie gets a little overzealous (ticket #5443). if ( !document.body ) { return settimeout( jquery.ready ); } // remember that the dom is ready jquery.isready = true; // if a normal dom ready event fired, decrement, and wait if need be if ( wait !== true && --jquery.readywait > 0 ) { return; } // if there are functions bound, to execute readylist.resolvewith( document, [ jquery ] ); // trigger any bound ready events if ( jquery.fn.trigger ) { jquery( document ).trigger("ready").off("ready"); } }, // see test/unit/core.js for details concerning isfunction. // since version 1.3, dom methods and functions like alert // aren't supported. they return false on ie (#2968). isfunction: function( obj ) { return jquery.type(obj) === "function"; }, isarray: array.isarray || function( obj ) { return jquery.type(obj) === "array"; }, iswindow: function( obj ) { return obj != null && obj == obj.window; }, isnumeric: function( obj ) { return !isnan( parsefloat(obj) ) && isfinite( obj ); }, type: function( obj ) { if ( obj == null ) { return string( obj ); } return typeof obj === "object" || typeof obj === "function" ? class2type[ core_tostring.call(obj) ] || "object" : typeof obj; }, isplainobject: function( obj ) { // must be an object. // because of ie, we also have to check the presence of the constructor property. // make sure that dom nodes and window objects don't pass through, as well if ( !obj || jquery.type(obj) !== "object" || obj.nodetype || jquery.iswindow( obj ) ) { return false; } try { // not own constructor property must be object if ( obj.constructor && !core_hasown.call(obj, "constructor") && !core_hasown.call(obj.constructor.prototype, "isprototypeof") ) { return false; } } catch ( e ) { // ie8,9 will throw exceptions on certain host objects #9897 return false; } // own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. var key; for ( key in obj ) {} return key === undefined || core_hasown.call( obj, key ); }, isemptyobject: function( obj ) { var name; for ( name in obj ) { return false; } return true; }, error: function( msg ) { throw new error( msg ); }, // data: string of html // context (optional): if specified, the fragment will be created in this context, defaults to document // keepscripts (optional): if true, will include scripts passed in the html string parsehtml: function( data, context, keepscripts ) { if ( !data || typeof data !== "string" ) { return null; } if ( typeof context === "boolean" ) { keepscripts = context; context = false; } context = context || document; var parsed = rsingletag.exec( data ), scripts = !keepscripts && []; // single tag if ( parsed ) { return [ context.createelement( parsed[1] ) ]; } parsed = jquery.buildfragment( [ data ], context, scripts ); if ( scripts ) { jquery( scripts ).remove(); } return jquery.merge( [], parsed.childnodes ); }, parsejson: function( data ) { // attempt to parse using the native json parser first if ( window.json && window.json.parse ) { return window.json.parse( data ); } if ( data === null ) { return data; } if ( typeof data === "string" ) { // make sure leading/trailing whitespace is removed (ie can't handle it) data = jquery.trim( data ); if ( data ) { // make sure the incoming data is actual json // logic borrowed from http://json.org/json2.js if ( rvalidchars.test( data.replace( rvalidescape, "@" ) .replace( rvalidtokens, "]" ) .replace( rvalidbraces, "")) ) { return ( new function( "return " + data ) )(); } } } jquery.error( "invalid json: " + data ); }, // cross-browser xml parsing parsexml: function( data ) { var xml, tmp; if ( !data || typeof data !== "string" ) { return null; } try { if ( window.domparser ) { // standard tmp = new domparser(); xml = tmp.parsefromstring( data , "text/xml" ); } else { // ie xml = new activexobject( "microsoft.xmldom" ); xml.async = "false"; xml.loadxml( data ); } } catch( e ) { xml = undefined; } if ( !xml || !xml.documentelement || xml.getelementsbytagname( "parsererror" ).length ) { jquery.error( "invalid xml: " + data ); } return xml; }, noop: function() {}, // evaluates a script in a global context // workarounds based on findings by jim driscoll // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context globaleval: function( data ) { if ( data && jquery.trim( data ) ) { // we use execscript on internet explorer // we use an anonymous function so that context is window // rather than jquery in firefox ( window.execscript || function( data ) { window[ "eval" ].call( window, data ); } )( data ); } }, // convert dashed to camelcase; used by the css and data modules // microsoft forgot to hump their vendor prefix (#9572) camelcase: function( string ) { return string.replace( rmsprefix, "ms-" ).replace( rdashalpha, fcamelcase ); }, nodename: function( elem, name ) { return elem.nodename && elem.nodename.tolowercase() === name.tolowercase(); }, // args is for internal usage only each: function( obj, callback, args ) { var value, i = 0, length = obj.length, isarray = isarraylike( obj ); if ( args ) { if ( isarray ) { for ( ; i < length; i++ ) { value = callback.apply( obj[ i ], args ); if ( value === false ) { break; } } } else { for ( i in obj ) { value = callback.apply( obj[ i ], args ); if ( value === false ) { break; } } } // a special, fast, case for the most common use of each } else { if ( isarray ) { for ( ; i < length; i++ ) { value = callback.call( obj[ i ], i, obj[ i ] ); if ( value === false ) { break; } } } else { for ( i in obj ) { value = callback.call( obj[ i ], i, obj[ i ] ); if ( value === false ) { break; } } } } return obj; }, // use native string.trim function wherever possible trim: core_trim && !core_trim.call("\ufeff\xa0") ? function( text ) { return text == null ? "" : core_trim.call( text ); } : // otherwise use our own trimming functionality function( text ) { return text == null ? "" : ( text + "" ).replace( rtrim, "" ); }, // results is for internal usage only makearray: function( arr, results ) { var ret = results || []; if ( arr != null ) { if ( isarraylike( object(arr) ) ) { jquery.merge( ret, typeof arr === "string" ? [ arr ] : arr ); } else { core_push.call( ret, arr ); } } return ret; }, inarray: function( elem, arr, i ) { var len; if ( arr ) { if ( core_indexof ) { return core_indexof.call( arr, elem, i ); } len = arr.length; i = i ? i < 0 ? math.max( 0, len + i ) : i : 0; for ( ; i < len; i++ ) { // skip accessing in sparse arrays if ( i in arr && arr[ i ] === elem ) { return i; } } } return -1; }, merge: function( first, second ) { var l = second.length, i = first.length, j = 0; if ( typeof l === "number" ) { for ( ; j < l; j++ ) { first[ i++ ] = second[ j ]; } } else { while ( second[j] !== undefined ) { first[ i++ ] = second[ j++ ]; } } first.length = i; return first; }, grep: function( elems, callback, inv ) { var retval, ret = [], i = 0, length = elems.length; inv = !!inv; // go through the array, only saving the items // that pass the validator function for ( ; i < length; i++ ) { retval = !!callback( elems[ i ], i ); if ( inv !== retval ) { ret.push( elems[ i ] ); } } return ret; }, // arg is for internal usage only map: function( elems, callback, arg ) { var value, i = 0, length = elems.length, isarray = isarraylike( elems ), ret = []; // go through the array, translating each of the items to their if ( isarray ) { for ( ; i < length; i++ ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret[ ret.length ] = value; } } // go through every key on the object, } else { for ( i in elems ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret[ ret.length ] = value; } } } // flatten any nested arrays return core_concat.apply( [], ret ); }, // a global guid counter for objects guid: 1, // bind a function to a context, optionally partially applying any // arguments. proxy: function( fn, context ) { var tmp, args, proxy; if ( typeof context === "string" ) { tmp = fn[ context ]; context = fn; fn = tmp; } // quick check to determine if target is callable, in the spec // this throws a typeerror, but we will just return undefined. if ( !jquery.isfunction( fn ) ) { return undefined; } // simulated bind args = core_slice.call( arguments, 2 ); proxy = function() { return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) ); }; // set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || jquery.guid++; return proxy; }, // multifunctional method to get and set values of a collection // the value/s can optionally be executed if it's a function access: function( elems, fn, key, value, chainable, emptyget, raw ) { var i = 0, length = elems.length, bulk = key == null; // sets many values if ( jquery.type( key ) === "object" ) { chainable = true; for ( i in key ) { jquery.access( elems, fn, i, key[i], true, emptyget, raw ); } // sets one value } else if ( value !== undefined ) { chainable = true; if ( !jquery.isfunction( value ) ) { raw = true; } if ( bulk ) { // bulk operations run against the entire set if ( raw ) { fn.call( elems, value ); fn = null; // ...except when executing function values } else { bulk = fn; fn = function( elem, key, value ) { return bulk.call( jquery( elem ), value ); }; } } if ( fn ) { for ( ; i < length; i++ ) { fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); } } } return chainable ? elems : // gets bulk ? fn.call( elems ) : length ? fn( elems[0], key ) : emptyget; }, now: function() { return ( new date() ).gettime(); } }); jquery.ready.promise = function( obj ) { if ( !readylist ) { readylist = jquery.deferred(); // catch cases where $(document).ready() is called after the browser event has already occurred. // we once tried to use readystate "interactive" here, but it caused issues like the one // discovered by chriss here: http://bugs.jquery.com/ticket/12282#comment:15 if ( document.readystate === "complete" ) { // handle it asynchronously to allow scripts the opportunity to delay ready settimeout( jquery.ready ); // standards-based browsers support domcontentloaded } else if ( document.addeventlistener ) { // use the handy event callback document.addeventlistener( "domcontentloaded", domcontentloaded, false ); // a fallback to window.onload, that will always work window.addeventlistener( "load", jquery.ready, false ); // if ie event model is used } else { // ensure firing before onload, maybe late but safe also for iframes document.attachevent( "onreadystatechange", domcontentloaded ); // a fallback to window.onload, that will always work window.attachevent( "onload", jquery.ready ); // if ie and not a frame // continually check to see if the document is ready var top = false; try { top = window.frameelement == null && document.documentelement; } catch(e) {} if ( top && top.doscroll ) { (function doscrollcheck() { if ( !jquery.isready ) { try { // use the trick by diego perini // http://javascript.nwbox.com/iecontentloaded/ top.doscroll("left"); } catch(e) { return settimeout( doscrollcheck, 50 ); } // and execute any waiting functions jquery.ready(); } })(); } } } return readylist.promise( obj ); }; // populate the class2type map jquery.each("boolean number string function array date regexp object error".split(" "), function(i, name) { class2type[ "[object " + name + "]" ] = name.tolowercase(); }); function isarraylike( obj ) { var length = obj.length, type = jquery.type( obj ); if ( jquery.iswindow( obj ) ) { return false; } if ( obj.nodetype === 1 && length ) { return true; } return type === "array" || type !== "function" && ( length === 0 || typeof length === "number" && length > 0 && ( length - 1 ) in obj ); } // all jquery objects should point back to these rootjquery = jquery(document); // string to object options format cache var optionscache = {}; // convert string-formatted options into object-formatted ones and store in cache function createoptions( options ) { var object = optionscache[ options ] = {}; jquery.each( options.match( core_rnotwhite ) || [], function( _, flag ) { object[ flag ] = true; }); return object; } /* * create a callback list using the following parameters: * * options: an optional list of space-separated options that will change how * the callback list behaves or a more traditional option object * * by default a callback list will act like an event callback list and can be * "fired" multiple times. * * possible options: * * once: will ensure the callback list can only be fired once (like a deferred) * * memory: will keep track of previous values and will call any callback added * after the list has been fired right away with the latest "memorized" * values (like a deferred) * * unique: will ensure a callback can only be added once (no duplicate in the list) * * stoponfalse: interrupt callings when a callback returns false * */ jquery.callbacks = function( options ) { // convert options from string-formatted to object-formatted if needed // (we check in cache first) options = typeof options === "string" ? ( optionscache[ options ] || createoptions( options ) ) : jquery.extend( {}, options ); var // last fire value (for non-forgettable lists) memory, // flag to know if list was already fired fired, // flag to know if list is currently firing firing, // first callback to fire (used internally by add and firewith) firingstart, // end of the loop when firing firinglength, // index of currently firing callback (modified by remove if needed) firingindex, // actual callback list list = [], // stack of fire calls for repeatable lists stack = !options.once && [], // fire callbacks fire = function( data ) { memory = options.memory && data; fired = true; firingindex = firingstart || 0; firingstart = 0; firinglength = list.length; firing = true; for ( ; list && firingindex < firinglength; firingindex++ ) { if ( list[ firingindex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stoponfalse ) { memory = false; // to prevent further calls using add break; } } firing = false; if ( list ) { if ( stack ) { if ( stack.length ) { fire( stack.shift() ); } } else if ( memory ) { list = []; } else { self.disable(); } } }, // actual callbacks object self = { // add a callback or a collection of callbacks to the list add: function() { if ( list ) { // first, we save the current length var start = list.length; (function add( args ) { jquery.each( args, function( _, arg ) { var type = jquery.type( arg ); if ( type === "function" ) { if ( !options.unique || !self.has( arg ) ) { list.push( arg ); } } else if ( arg && arg.length && type !== "string" ) { // inspect recursively add( arg ); } }); })( arguments ); // do we need to add the callbacks to the // current firing batch? if ( firing ) { firinglength = list.length; // with memory, if we're not firing then // we should call right away } else if ( memory ) { firingstart = start; fire( memory ); } } return this; }, // remove a callback from the list remove: function() { if ( list ) { jquery.each( arguments, function( _, arg ) { var index; while( ( index = jquery.inarray( arg, list, index ) ) > -1 ) { list.splice( index, 1 ); // handle firing indexes if ( firing ) { if ( index <= firinglength ) { firinglength--; } if ( index <= firingindex ) { firingindex--; } } } }); } return this; }, // control if a given callback is in the list has: function( fn ) { return jquery.inarray( fn, list ) > -1; }, // remove all callbacks from the list empty: function() { list = []; return this; }, // have the list do nothing anymore disable: function() { list = stack = memory = undefined; return this; }, // is it disabled? disabled: function() { return !list; }, // lock the list in its current state lock: function() { stack = undefined; if ( !memory ) { self.disable(); } return this; }, // is it locked? locked: function() { return !stack; }, // call all callbacks with the given context and arguments firewith: function( context, args ) { args = args || []; args = [ context, args.slice ? args.slice() : args ]; if ( list && ( !fired || stack ) ) { if ( firing ) { stack.push( args ); } else { fire( args ); } } return this; }, // call all the callbacks with the given arguments fire: function() { self.firewith( this, arguments ); return this; }, // to know if the callbacks have already been called at least once fired: function() { return !!fired; } }; return self; }; jquery.extend({ deferred: function( func ) { var tuples = [ // action, add listener, listener list, final state [ "resolve", "done", jquery.callbacks("once memory"), "resolved" ], [ "reject", "fail", jquery.callbacks("once memory"), "rejected" ], [ "notify", "progress", jquery.callbacks("memory") ] ], state = "pending", promise = { state: function() { return state; }, always: function() { deferred.done( arguments ).fail( arguments ); return this; }, then: function( /* fndone, fnfail, fnprogress */ ) { var fns = arguments; return jquery.deferred(function( newdefer ) { jquery.each( tuples, function( i, tuple ) { var action = tuple[ 0 ], fn = jquery.isfunction( fns[ i ] ) && fns[ i ]; // deferred[ done | fail | progress ] for forwarding actions to newdefer deferred[ tuple[1] ](function() { var returned = fn && fn.apply( this, arguments ); if ( returned && jquery.isfunction( returned.promise ) ) { returned.promise() .done( newdefer.resolve ) .fail( newdefer.reject ) .progress( newdefer.notify ); } else { newdefer[ action + "with" ]( this === promise ? newdefer.promise() : this, fn ? [ returned ] : arguments ); } }); }); fns = null; }).promise(); }, // get a promise for this deferred // if obj is provided, the promise aspect is added to the object promise: function( obj ) { return obj != null ? jquery.extend( obj, promise ) : promise; } }, deferred = {}; // keep pipe for back-compat promise.pipe = promise.then; // add list-specific methods jquery.each( tuples, function( i, tuple ) { var list = tuple[ 2 ], statestring = tuple[ 3 ]; // promise[ done | fail | progress ] = list.add promise[ tuple[1] ] = list.add; // handle state if ( statestring ) { list.add(function() { // state = [ resolved | rejected ] state = statestring; // [ reject_list | resolve_list ].disable; progress_list.lock }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); } // deferred[ resolve | reject | notify ] deferred[ tuple[0] ] = function() { deferred[ tuple[0] + "with" ]( this === deferred ? promise : this, arguments ); return this; }; deferred[ tuple[0] + "with" ] = list.firewith; }); // make the deferred a promise promise.promise( deferred ); // call given func if any if ( func ) { func.call( deferred, deferred ); } // all done! return deferred; }, // deferred helper when: function( subordinate /* , ..., subordinaten */ ) { var i = 0, resolvevalues = core_slice.call( arguments ), length = resolvevalues.length, // the count of uncompleted subordinates remaining = length !== 1 || ( subordinate && jquery.isfunction( subordinate.promise ) ) ? length : 0, // the master deferred. if resolvevalues consist of only a single deferred, just use that. deferred = remaining === 1 ? subordinate : jquery.deferred(), // update function for both resolve and progress values updatefunc = function( i, contexts, values ) { return function( value ) { contexts[ i ] = this; values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; if( values === progressvalues ) { deferred.notifywith( contexts, values ); } else if ( !( --remaining ) ) { deferred.resolvewith( contexts, values ); } }; }, progressvalues, progresscontexts, resolvecontexts; // add listeners to deferred subordinates; treat others as resolved if ( length > 1 ) { progressvalues = new array( length ); progresscontexts = new array( length ); resolvecontexts = new array( length ); for ( ; i < length; i++ ) { if ( resolvevalues[ i ] && jquery.isfunction( resolvevalues[ i ].promise ) ) { resolvevalues[ i ].promise() .done( updatefunc( i, resolvecontexts, resolvevalues ) ) .fail( deferred.reject ) .progress( updatefunc( i, progresscontexts, progressvalues ) ); } else { --remaining; } } } // if we're not waiting on anything, resolve the master if ( !remaining ) { deferred.resolvewith( resolvecontexts, resolvevalues ); } return deferred.promise(); } }); jquery.support = (function() { var support, all, a, select, opt, input, fragment, eventname, issupported, i, div = document.createelement("div"); // setup div.setattribute( "classname", "t" ); div.innerhtml = "
a"; // support tests won't run in some limited or non-browser environments all = div.getelementsbytagname("*"); a = div.getelementsbytagname("a")[ 0 ]; if ( !all || !a || !all.length ) { return {}; } // first batch of tests select = document.createelement("select"); opt = select.appendchild( document.createelement("option") ); input = div.getelementsbytagname("input")[ 0 ]; a.style.csstext = "top:1px;float:left;opacity:.5"; support = { // test setattribute on camelcase class. if it works, we need attrfixes when doing get/setattribute (ie6/7) getsetattribute: div.classname !== "t", // ie strips leading whitespace when .innerhtml is used leadingwhitespace: div.firstchild.nodetype === 3, // make sure that tbody elements aren't automatically inserted // ie will insert them into empty tables tbody: !div.getelementsbytagname("tbody").length, // make sure that link elements get serialized correctly by innerhtml // this requires a wrapper element in ie htmlserialize: !!div.getelementsbytagname("link").length, // get the style information from getattribute // (ie uses .csstext instead) style: /top/.test( a.getattribute("style") ), // make sure that urls aren't manipulated // (ie normalizes it by default) hrefnormalized: a.getattribute("href") === "/a", // make sure that element opacity exists // (ie uses filter instead) // use a regex to work around a webkit issue. see #5145 opacity: /^0.5/.test( a.style.opacity ), // verify style float existence // (ie uses stylefloat instead of cssfloat) cssfloat: !!a.style.cssfloat, // check the default checkbox/radio value ("" on webkit; "on" elsewhere) checkon: !!input.value, // make sure that a selected-by-default option has a working selected property. // (webkit defaults to false instead of true, ie too, if it's in an optgroup) optselected: opt.selected, // tests for enctype support on a form (#6743) enctype: !!document.createelement("form").enctype, // makes sure cloning an html5 element does not cause problems // where outerhtml is undefined, this still works html5clone: document.createelement("nav").clonenode( true ).outerhtml !== "<:nav>", // jquery.support.boxmodel deprecated in 1.8 since we don't support quirks mode boxmodel: document.compatmode === "css1compat", // will be defined later deleteexpando: true, nocloneevent: true, inlineblockneedslayout: false, shrinkwrapblocks: false, reliablemarginright: true, boxsizingreliable: true, pixelposition: false }; // make sure checked status is properly cloned input.checked = true; support.noclonechecked = input.clonenode( true ).checked; // make sure that the options inside disabled selects aren't marked as disabled // (webkit marks them as disabled) select.disabled = true; support.optdisabled = !opt.disabled; // support: ie<9 try { delete div.test; } catch( e ) { support.deleteexpando = false; } // check if we can trust getattribute("value") input = document.createelement("input"); input.setattribute( "value", "" ); support.input = input.getattribute( "value" ) === ""; // check if an input maintains its value after becoming a radio input.value = "t"; input.setattribute( "type", "radio" ); support.radiovalue = input.value === "t"; // #11217 - webkit loses check when the name is after the checked attribute input.setattribute( "checked", "t" ); input.setattribute( "name", "t" ); fragment = document.createdocumentfragment(); fragment.appendchild( input ); // check if a disconnected checkbox will retain its checked // value of true after appended to the dom (ie6/7) support.appendchecked = input.checked; // webkit doesn't clone checked state correctly in fragments support.checkclone = fragment.clonenode( true ).clonenode( true ).lastchild.checked; // support: ie<9 // opera does not clone events (and typeof div.attachevent === undefined). // ie9-10 clones events bound via attachevent, but they don't trigger with .click() if ( div.attachevent ) { div.attachevent( "onclick", function() { support.nocloneevent = false; }); div.clonenode( true ).click(); } // support: ie<9 (lack submit/change bubble), firefox 17+ (lack focusin event) // beware of csp restrictions (https://developer.mozilla.org/en/security/csp), test/csp.php for ( i in { submit: true, change: true, focusin: true }) { div.setattribute( eventname = "on" + i, "t" ); support[ i + "bubbles" ] = eventname in window || div.attributes[ eventname ].expando === false; } div.style.backgroundclip = "content-box"; div.clonenode( true ).style.backgroundclip = ""; support.clearclonestyle = div.style.backgroundclip === "content-box"; // run tests that need a body at doc ready jquery(function() { var container, margindiv, tds, divreset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", body = document.getelementsbytagname("body")[0]; if ( !body ) { // return for frameset docs that don't have a body return; } container = document.createelement("div"); container.style.csstext = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; body.appendchild( container ).appendchild( div ); // support: ie8 // check if table cells still have offsetwidth/height when they are set // to display:none and there are still other visible table cells in a // table row; if so, offsetwidth/height are not reliable for use when // determining if an element has been hidden directly using // display:none (it is still safe to use offsets if a parent element is // hidden; don safety goggles and see bug #4512 for more information). div.innerhtml = "
t
"; tds = div.getelementsbytagname("td"); tds[ 0 ].style.csstext = "padding:0;margin:0;border:0;display:none"; issupported = ( tds[ 0 ].offsetheight === 0 ); tds[ 0 ].style.display = ""; tds[ 1 ].style.display = "none"; // support: ie8 // check if empty table cells still have offsetwidth/height support.reliablehiddenoffsets = issupported && ( tds[ 0 ].offsetheight === 0 ); // check box-sizing and margin behavior div.innerhtml = ""; 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%;"; support.boxsizing = ( div.offsetwidth === 4 ); support.doesnotincludemargininbodyoffset = ( body.offsettop !== 1 ); // use window.getcomputedstyle because jsdom on node.js will break without it. if ( window.getcomputedstyle ) { support.pixelposition = ( window.getcomputedstyle( div, null ) || {} ).top !== "1%"; support.boxsizingreliable = ( window.getcomputedstyle( div, null ) || { width: "4px" } ).width === "4px"; // check if div with explicit width and no margin-right incorrectly // gets computed margin-right based on width of container. (#3333) // fails in webkit before feb 2011 nightlies // webkit bug 13343 - getcomputedstyle returns wrong value for margin-right margindiv = div.appendchild( document.createelement("div") ); margindiv.style.csstext = div.style.csstext = divreset; margindiv.style.marginright = margindiv.style.width = "0"; div.style.width = "1px"; support.reliablemarginright = !parsefloat( ( window.getcomputedstyle( margindiv, null ) || {} ).marginright ); } if ( typeof div.style.zoom !== "undefined" ) { // support: ie<8 // check if natively block-level elements act like inline-block // elements when setting their display to 'inline' and giving // them layout div.innerhtml = ""; div.style.csstext = divreset + "width:1px;padding:1px;display:inline;zoom:1"; support.inlineblockneedslayout = ( div.offsetwidth === 3 ); // support: ie6 // check if elements with layout shrink-wrap their children div.style.display = "block"; div.innerhtml = "
"; div.firstchild.style.width = "5px"; support.shrinkwrapblocks = ( div.offsetwidth !== 3 ); // prevent ie 6 from affecting layout for positioned elements #11048 // prevent ie from shrinking the body in ie 7 mode #12869 body.style.zoom = 1; } body.removechild( container ); // null elements to avoid leaks in ie container = div = tds = margindiv = null; }); // null elements to avoid leaks in ie all = select = fragment = opt = a = input = null; return support; })(); var rbrace = /(?:\{[\s\s]*\}|\[[\s\s]*\])$/, rmultidash = /([a-z])/g; function internaldata( elem, name, data, pvt /* internal use only */ ){ if ( !jquery.acceptdata( elem ) ) { return; } var thiscache, ret, internalkey = jquery.expando, getbyname = typeof name === "string", // we have to handle dom nodes and js objects differently because ie6-7 // can't gc object references properly across the dom-js boundary isnode = elem.nodetype, // only dom nodes need the global jquery cache; js object data is // attached directly to the object so gc can occur automatically cache = isnode ? jquery.cache : elem, // only defining an id for js objects if its cache already exists allows // the code to shortcut on the same path as a dom node with no cache id = isnode ? elem[ internalkey ] : elem[ internalkey ] && internalkey; // avoid doing any more work than we need to when trying to get data on an // object that has no data at all if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getbyname && data === undefined ) { return; } if ( !id ) { // only dom nodes need a new unique id for each element since their data // ends up in the global cache if ( isnode ) { elem[ internalkey ] = id = core_deletedids.pop() || jquery.guid++; } else { id = internalkey; } } if ( !cache[ id ] ) { cache[ id ] = {}; // avoids exposing jquery metadata on plain js objects when the object // is serialized using json.stringify if ( !isnode ) { cache[ id ].tojson = jquery.noop; } } // an object can be passed to jquery.data instead of a key/value pair; this gets // shallow copied over onto the existing cache if ( typeof name === "object" || typeof name === "function" ) { if ( pvt ) { cache[ id ] = jquery.extend( cache[ id ], name ); } else { cache[ id ].data = jquery.extend( cache[ id ].data, name ); } } thiscache = cache[ id ]; // jquery data() is stored in a separate object inside the object's internal data // cache in order to avoid key collisions between internal data and user-defined // data. if ( !pvt ) { if ( !thiscache.data ) { thiscache.data = {}; } thiscache = thiscache.data; } if ( data !== undefined ) { thiscache[ jquery.camelcase( name ) ] = data; } // check for both converted-to-camel and non-converted data property names // if a data property was specified if ( getbyname ) { // first try to find as-is property data ret = thiscache[ name ]; // test for null|undefined property data if ( ret == null ) { // try to find the camelcased property ret = thiscache[ jquery.camelcase( name ) ]; } } else { ret = thiscache; } return ret; } function internalremovedata( elem, name, pvt /* for internal use only */ ){ if ( !jquery.acceptdata( elem ) ) { return; } var thiscache, i, l, isnode = elem.nodetype, // see jquery.data for more information cache = isnode ? jquery.cache : elem, id = isnode ? elem[ jquery.expando ] : jquery.expando; // if there is already no cache entry for this object, there is no // purpose in continuing if ( !cache[ id ] ) { return; } if ( name ) { thiscache = pvt ? cache[ id ] : cache[ id ].data; if ( thiscache ) { // support array or space separated string names for data keys if ( !jquery.isarray( name ) ) { // try the string as a key before any manipulation if ( name in thiscache ) { name = [ name ]; } else { // split the camel cased version by spaces unless a key with the spaces exists name = jquery.camelcase( name ); if ( name in thiscache ) { name = [ name ]; } else { name = name.split(" "); } } } else { // if "name" is an array of keys... // when data is initially created, via ("key", "val") signature, // keys will be converted to camelcase. // since there is no way to tell _how_ a key was added, remove // both plain key and camelcase key. #12786 // this will only penalize the array argument path. name = name.concat( jquery.map( name, jquery.camelcase ) ); } for ( i = 0, l = name.length; i < l; i++ ) { delete thiscache[ name[i] ]; } // if there is no data left in the cache, we want to continue // and let the cache object itself get destroyed if ( !( pvt ? isemptydataobject : jquery.isemptyobject )( thiscache ) ) { return; } } } // see jquery.data for more information if ( !pvt ) { delete cache[ id ].data; // don't destroy the parent cache unless the internal data object // had been the only thing left in it if ( !isemptydataobject( cache[ id ] ) ) { return; } } // destroy the cache if ( isnode ) { jquery.cleandata( [ elem ], true ); // use delete when supported for expandos or `cache` is not a window per iswindow (#10080) } else if ( jquery.support.deleteexpando || cache != cache.window ) { delete cache[ id ]; // when all else fails, null } else { cache[ id ] = null; } } jquery.extend({ cache: {}, // unique for each copy of jquery on the page // non-digits removed to match rinlinejquery expando: "jquery" + ( core_version + math.random() ).replace( /\d/g, "" ), // the following elements throw uncatchable exceptions if you // attempt to add expando properties to them. nodata: { "embed": true, // ban all objects except for flash (which handle expandos) "object": "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000", "applet": true }, hasdata: function( elem ) { elem = elem.nodetype ? jquery.cache[ elem[jquery.expando] ] : elem[ jquery.expando ]; return !!elem && !isemptydataobject( elem ); }, data: function( elem, name, data ) { return internaldata( elem, name, data, false ); }, removedata: function( elem, name ) { return internalremovedata( elem, name, false ); }, // for internal use only. _data: function( elem, name, data ) { return internaldata( elem, name, data, true ); }, _removedata: function( elem, name ) { return internalremovedata( elem, name, true ); }, // a method for determining if a dom node can handle the data expando acceptdata: function( elem ) { var nodata = elem.nodename && jquery.nodata[ elem.nodename.tolowercase() ]; // nodes accept data unless otherwise specified; rejection can be conditional return !nodata || nodata !== true && elem.getattribute("classid") === nodata; } }); jquery.fn.extend({ data: function( key, value ) { var attrs, name, elem = this[0], i = 0, data = null; // gets all values if ( key === undefined ) { if ( this.length ) { data = jquery.data( elem ); if ( elem.nodetype === 1 && !jquery._data( elem, "parsedattrs" ) ) { attrs = elem.attributes; for ( ; i < attrs.length; i++ ) { name = attrs[i].name; if ( !name.indexof( "data-" ) ) { name = jquery.camelcase( name.substring(5) ); dataattr( elem, name, data[ name ] ); } } jquery._data( elem, "parsedattrs", true ); } } return data; } // sets multiple values if ( typeof key === "object" ) { return this.each(function() { jquery.data( this, key ); }); } return jquery.access( this, function( value ) { if ( value === undefined ) { // try to fetch any internally stored data first return elem ? dataattr( elem, key, jquery.data( elem, key ) ) : null; } this.each(function() { jquery.data( this, key, value ); }); }, null, value, arguments.length > 1, null, true ); }, removedata: function( key ) { return this.each(function() { jquery.removedata( this, key ); }); } }); function dataattr( elem, key, data ) { // if nothing was found internally, try to fetch any // data from the html5 data-* attribute if ( data === undefined && elem.nodetype === 1 ) { var name = "data-" + key.replace( rmultidash, "-$1" ).tolowercase(); data = elem.getattribute( name ); if ( typeof data === "string" ) { try { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : // only convert to a number if it doesn't change the string +data + "" === data ? +data : rbrace.test( data ) ? jquery.parsejson( data ) : data; } catch( e ) {} // make sure we set the data so it isn't changed later jquery.data( elem, key, data ); } else { data = undefined; } } return data; } // checks a cache object for emptiness function isemptydataobject( obj ) { var name; for ( name in obj ) { // if the public data object is empty, the private is still empty if ( name === "data" && jquery.isemptyobject( obj[name] ) ) { continue; } if ( name !== "tojson" ) { return false; } } return true; } jquery.extend({ queue: function( elem, type, data ) { var queue; if ( elem ) { type = ( type || "fx" ) + "queue"; queue = jquery._data( elem, type ); // speed up dequeue by getting out quickly if this is just a lookup if ( data ) { if ( !queue || jquery.isarray(data) ) { queue = jquery._data( elem, type, jquery.makearray(data) ); } else { queue.push( data ); } } return queue || []; } }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jquery.queue( elem, type ), startlength = queue.length, fn = queue.shift(), hooks = jquery._queuehooks( elem, type ), next = function() { jquery.dequeue( elem, type ); }; // if the fx queue is dequeued, always remove the progress sentinel if ( fn === "inprogress" ) { fn = queue.shift(); startlength--; } hooks.cur = fn; if ( fn ) { // add a progress sentinel to prevent the fx queue from being // automatically dequeued if ( type === "fx" ) { queue.unshift( "inprogress" ); } // clear up the last queue stop function delete hooks.stop; fn.call( elem, next, hooks ); } if ( !startlength && hooks ) { hooks.empty.fire(); } }, // not intended for public consumption - generates a queuehooks object, or returns the current one _queuehooks: function( elem, type ) { var key = type + "queuehooks"; return jquery._data( elem, key ) || jquery._data( elem, key, { empty: jquery.callbacks("once memory").add(function() { jquery._removedata( elem, type + "queue" ); jquery._removedata( elem, key ); }) }); } }); jquery.fn.extend({ queue: function( type, data ) { var setter = 2; if ( typeof type !== "string" ) { data = type; type = "fx"; setter--; } if ( arguments.length < setter ) { return jquery.queue( this[0], type ); } return data === undefined ? this : this.each(function() { var queue = jquery.queue( this, type, data ); // ensure a hooks for this queue jquery._queuehooks( this, type ); if ( type === "fx" && queue[0] !== "inprogress" ) { jquery.dequeue( this, type ); } }); }, dequeue: function( type ) { return this.each(function() { jquery.dequeue( this, type ); }); }, // based off of the plugin by clint helfers, with permission. // http://blindsignals.com/index.php/2009/07/jquery-delay/ delay: function( time, type ) { time = jquery.fx ? jquery.fx.speeds[ time ] || time : time; type = type || "fx"; return this.queue( type, function( next, hooks ) { var timeout = settimeout( next, time ); hooks.stop = function() { cleartimeout( timeout ); }; }); }, clearqueue: function( type ) { return this.queue( type || "fx", [] ); }, // get a promise resolved when queues of a certain type // are emptied (fx is the type by default) promise: function( type, obj ) { var tmp, count = 1, defer = jquery.deferred(), elements = this, i = this.length, resolve = function() { if ( !( --count ) ) { defer.resolvewith( elements, [ elements ] ); } }; if ( typeof type !== "string" ) { obj = type; type = undefined; } type = type || "fx"; while( i-- ) { tmp = jquery._data( elements[ i ], type + "queuehooks" ); if ( tmp && tmp.empty ) { count++; tmp.empty.add( resolve ); } } resolve(); return defer.promise( obj ); } }); var nodehook, boolhook, rclass = /[\t\r\n]/g, rreturn = /\r/g, rfocusable = /^(?:input|select|textarea|button|object)$/i, rclickable = /^(?:a|area)$/i, rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i, rusedefault = /^(?:checked|selected)$/i, getsetattribute = jquery.support.getsetattribute, getsetinput = jquery.support.input; jquery.fn.extend({ attr: function( name, value ) { return jquery.access( this, jquery.attr, name, value, arguments.length > 1 ); }, removeattr: function( name ) { return this.each(function() { jquery.removeattr( this, name ); }); }, prop: function( name, value ) { return jquery.access( this, jquery.prop, name, value, arguments.length > 1 ); }, removeprop: function( name ) { name = jquery.propfix[ name ] || name; return this.each(function() { // try/catch handles cases where ie balks (such as removing a property on window) try { this[ name ] = undefined; delete this[ name ]; } catch( e ) {} }); }, addclass: function( value ) { var classes, elem, cur, clazz, j, i = 0, len = this.length, proceed = typeof value === "string" && value; if ( jquery.isfunction( value ) ) { return this.each(function( j ) { jquery( this ).addclass( value.call( this, j, this.classname ) ); }); } if ( proceed ) { // the disjunction here is for better compressibility (see removeclass) classes = ( value || "" ).match( core_rnotwhite ) || []; for ( ; i < len; i++ ) { elem = this[ i ]; cur = elem.nodetype === 1 && ( elem.classname ? ( " " + elem.classname + " " ).replace( rclass, " " ) : " " ); if ( cur ) { j = 0; while ( (clazz = classes[j++]) ) { if ( cur.indexof( " " + clazz + " " ) < 0 ) { cur += clazz + " "; } } elem.classname = jquery.trim( cur ); } } } return this; }, removeclass: function( value ) { var classes, elem, cur, clazz, j, i = 0, len = this.length, proceed = arguments.length === 0 || typeof value === "string" && value; if ( jquery.isfunction( value ) ) { return this.each(function( j ) { jquery( this ).removeclass( value.call( this, j, this.classname ) ); }); } if ( proceed ) { classes = ( value || "" ).match( core_rnotwhite ) || []; for ( ; i < len; i++ ) { elem = this[ i ]; // this expression is here for better compressibility (see addclass) cur = elem.nodetype === 1 && ( elem.classname ? ( " " + elem.classname + " " ).replace( rclass, " " ) : "" ); if ( cur ) { j = 0; while ( (clazz = classes[j++]) ) { // remove *all* instances while ( cur.indexof( " " + clazz + " " ) >= 0 ) { cur = cur.replace( " " + clazz + " ", " " ); } } elem.classname = value ? jquery.trim( cur ) : ""; } } } return this; }, toggleclass: function( value, stateval ) { var type = typeof value, isbool = typeof stateval === "boolean"; if ( jquery.isfunction( value ) ) { return this.each(function( i ) { jquery( this ).toggleclass( value.call(this, i, this.classname, stateval), stateval ); }); } return this.each(function() { if ( type === "string" ) { // toggle individual class names var classname, i = 0, self = jquery( this ), state = stateval, classnames = value.match( core_rnotwhite ) || []; while ( (classname = classnames[ i++ ]) ) { // check each classname given, space separated list state = isbool ? state : !self.hasclass( classname ); self[ state ? "addclass" : "removeclass" ]( classname ); } // toggle whole class name } else if ( type === "undefined" || type === "boolean" ) { if ( this.classname ) { // store classname if set jquery._data( this, "__classname__", this.classname ); } // if the element has a class name or if we're passed "false", // then remove the whole classname (if there was one, the above saved it). // otherwise bring back whatever was previously saved (if anything), // falling back to the empty string if nothing was stored. this.classname = this.classname || value === false ? "" : jquery._data( this, "__classname__" ) || ""; } }); }, hasclass: function( selector ) { var classname = " " + selector + " ", i = 0, l = this.length; for ( ; i < l; i++ ) { if ( this[i].nodetype === 1 && (" " + this[i].classname + " ").replace(rclass, " ").indexof( classname ) >= 0 ) { return true; } } return false; }, val: function( value ) { var hooks, ret, isfunction, elem = this[0]; if ( !arguments.length ) { if ( elem ) { hooks = jquery.valhooks[ elem.type ] || jquery.valhooks[ elem.nodename.tolowercase() ]; if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { return ret; } ret = elem.value; return typeof ret === "string" ? // handle most common string cases ret.replace(rreturn, "") : // handle cases where value is null/undef or number ret == null ? "" : ret; } return; } isfunction = jquery.isfunction( value ); return this.each(function( i ) { var val, self = jquery(this); if ( this.nodetype !== 1 ) { return; } if ( isfunction ) { val = value.call( this, i, self.val() ); } else { val = value; } // treat null/undefined as ""; convert numbers to string if ( val == null ) { val = ""; } else if ( typeof val === "number" ) { val += ""; } else if ( jquery.isarray( val ) ) { val = jquery.map(val, function ( value ) { return value == null ? "" : value + ""; }); } hooks = jquery.valhooks[ this.type ] || jquery.valhooks[ this.nodename.tolowercase() ]; // if set returns undefined, fall back to normal setting if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { this.value = val; } }); } }); jquery.extend({ valhooks: { option: { get: function( elem ) { // attributes.value is undefined in blackberry 4.7 but // uses .value. see #6932 var val = elem.attributes.value; return !val || val.specified ? elem.value : elem.text; } }, select: { get: function( elem ) { var value, option, options = elem.options, index = elem.selectedindex, one = elem.type === "select-one" || index < 0, values = one ? null : [], max = one ? index + 1 : options.length, i = index < 0 ? max : one ? index : 0; // loop through all the selected options for ( ; i < max; i++ ) { option = options[ i ]; // oldie doesn't update selected after form reset (#2551) if ( ( option.selected || i === index ) && // don't return options that are disabled or in a disabled optgroup ( jquery.support.optdisabled ? !option.disabled : option.getattribute("disabled") === null ) && ( !option.parentnode.disabled || !jquery.nodename( option.parentnode, "optgroup" ) ) ) { // get the specific value for the option value = jquery( option ).val(); // we don't need an array for one selects if ( one ) { return value; } // multi-selects return an array values.push( value ); } } return values; }, set: function( elem, value ) { var values = jquery.makearray( value ); jquery(elem).find("option").each(function() { this.selected = jquery.inarray( jquery(this).val(), values ) >= 0; }); if ( !values.length ) { elem.selectedindex = -1; } return values; } } }, attr: function( elem, name, value ) { var ret, hooks, notxml, ntype = elem.nodetype; // don't get/set attributes on text, comment and attribute nodes if ( !elem || ntype === 3 || ntype === 8 || ntype === 2 ) { return; } // fallback to prop when attributes are not supported if ( typeof elem.getattribute === "undefined" ) { return jquery.prop( elem, name, value ); } notxml = ntype !== 1 || !jquery.isxmldoc( elem ); // all attributes are lowercase // grab necessary hook if one is defined if ( notxml ) { name = name.tolowercase(); hooks = jquery.attrhooks[ name ] || ( rboolean.test( name ) ? boolhook : nodehook ); } if ( value !== undefined ) { if ( value === null ) { jquery.removeattr( elem, name ); } else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { return ret; } else { elem.setattribute( name, value + "" ); return value; } } else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { return ret; } else { // in ie9+, flash objects don't have .getattribute (#12945) // support: ie9+ if ( typeof elem.getattribute !== "undefined" ) { ret = elem.getattribute( name ); } // non-existent attributes return null, we normalize to undefined return ret == null ? undefined : ret; } }, removeattr: function( elem, value ) { var name, propname, i = 0, attrnames = value && value.match( core_rnotwhite ); if ( attrnames && elem.nodetype === 1 ) { while ( (name = attrnames[i++]) ) { propname = jquery.propfix[ name ] || name; // boolean attributes get special treatment (#10870) if ( rboolean.test( name ) ) { // set corresponding property to false for boolean attributes // also clear defaultchecked/defaultselected (if appropriate) for ie<8 if ( !getsetattribute && rusedefault.test( name ) ) { elem[ jquery.camelcase( "default-" + name ) ] = elem[ propname ] = false; } else { elem[ propname ] = false; } // see #9699 for explanation of this approach (setting first, then removal) } else { jquery.attr( elem, name, "" ); } elem.removeattribute( getsetattribute ? name : propname ); } } }, attrhooks: { type: { set: function( elem, value ) { if ( !jquery.support.radiovalue && value === "radio" && jquery.nodename(elem, "input") ) { // setting the type on a radio button after the value resets the value in ie6-9 // reset value to default in case type is set after value during creation var val = elem.value; elem.setattribute( "type", value ); if ( val ) { elem.value = val; } return value; } } } }, propfix: { tabindex: "tabindex", readonly: "readonly", "for": "htmlfor", "class": "classname", maxlength: "maxlength", cellspacing: "cellspacing", cellpadding: "cellpadding", rowspan: "rowspan", colspan: "colspan", usemap: "usemap", frameborder: "frameborder", contenteditable: "contenteditable" }, prop: function( elem, name, value ) { var ret, hooks, notxml, ntype = elem.nodetype; // don't get/set properties on text, comment and attribute nodes if ( !elem || ntype === 3 || ntype === 8 || ntype === 2 ) { return; } notxml = ntype !== 1 || !jquery.isxmldoc( elem ); if ( notxml ) { // fix name and attach hooks name = jquery.propfix[ name ] || name; hooks = jquery.prophooks[ name ]; } if ( value !== undefined ) { if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { return ret; } else { return ( elem[ name ] = value ); } } else { if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { return ret; } else { return elem[ name ]; } } }, prophooks: { tabindex: { get: function( elem ) { // elem.tabindex doesn't always return the correct value when it hasn't been explicitly set // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ var attributenode = elem.getattributenode("tabindex"); return attributenode && attributenode.specified ? parseint( attributenode.value, 10 ) : rfocusable.test( elem.nodename ) || rclickable.test( elem.nodename ) && elem.href ? 0 : undefined; } } } }); // hook for boolean attributes boolhook = { get: function( elem, name ) { var // use .prop to determine if this attribute is understood as boolean prop = jquery.prop( elem, name ), // fetch it accordingly attr = typeof prop === "boolean" && elem.getattribute( name ), detail = typeof prop === "boolean" ? getsetinput && getsetattribute ? attr != null : // oldie fabricates an empty string for missing boolean attributes // and conflates checked/selected into attroperties rusedefault.test( name ) ? elem[ jquery.camelcase( "default-" + name ) ] : !!attr : // fetch an attribute node for properties not recognized as boolean elem.getattributenode( name ); return detail && detail.value !== false ? name.tolowercase() : undefined; }, set: function( elem, value, name ) { if ( value === false ) { // remove boolean attributes when set to false jquery.removeattr( elem, name ); } else if ( getsetinput && getsetattribute || !rusedefault.test( name ) ) { // ie<8 needs the *property* name elem.setattribute( !getsetattribute && jquery.propfix[ name ] || name, name ); // use defaultchecked and defaultselected for oldie } else { elem[ jquery.camelcase( "default-" + name ) ] = elem[ name ] = true; } return name; } }; // fix oldie value attroperty if ( !getsetinput || !getsetattribute ) { jquery.attrhooks.value = { get: function( elem, name ) { var ret = elem.getattributenode( name ); return jquery.nodename( elem, "input" ) ? // ignore the value *property* by using defaultvalue elem.defaultvalue : ret && ret.specified ? ret.value : undefined; }, set: function( elem, value, name ) { if ( jquery.nodename( elem, "input" ) ) { // does not return so that setattribute is also used elem.defaultvalue = value; } else { // use nodehook if defined (#1954); otherwise setattribute is fine return nodehook && nodehook.set( elem, value, name ); } } }; } // ie6/7 do not support getting/setting some attributes with get/setattribute if ( !getsetattribute ) { // use this for any attribute in ie6/7 // this fixes almost every ie6/7 issue nodehook = jquery.valhooks.button = { get: function( elem, name ) { var ret = elem.getattributenode( name ); return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ? ret.value : undefined; }, set: function( elem, value, name ) { // set the existing or create a new attribute node var ret = elem.getattributenode( name ); if ( !ret ) { elem.setattributenode( (ret = elem.ownerdocument.createattribute( name )) ); } ret.value = value += ""; // break association with cloned elements by also using setattribute (#9646) return name === "value" || value === elem.getattribute( name ) ? value : undefined; } }; // set contenteditable to false on removals(#10429) // setting to empty string throws an error as an invalid value jquery.attrhooks.contenteditable = { get: nodehook.get, set: function( elem, value, name ) { nodehook.set( elem, value === "" ? false : value, name ); } }; // set width and height to auto instead of 0 on empty string( bug #8150 ) // this is for removals jquery.each([ "width", "height" ], function( i, name ) { jquery.attrhooks[ name ] = jquery.extend( jquery.attrhooks[ name ], { set: function( elem, value ) { if ( value === "" ) { elem.setattribute( name, "auto" ); return value; } } }); }); } // some attributes require a special call on ie // http://msdn.microsoft.com/en-us/library/ms536429%28vs.85%29.aspx if ( !jquery.support.hrefnormalized ) { jquery.each([ "href", "src", "width", "height" ], function( i, name ) { jquery.attrhooks[ name ] = jquery.extend( jquery.attrhooks[ name ], { get: function( elem ) { var ret = elem.getattribute( name, 2 ); return ret == null ? undefined : ret; } }); }); // href/src property should get the full normalized url (#10299/#12915) jquery.each([ "href", "src" ], function( i, name ) { jquery.prophooks[ name ] = { get: function( elem ) { return elem.getattribute( name, 4 ); } }; }); } if ( !jquery.support.style ) { jquery.attrhooks.style = { get: function( elem ) { // return undefined in the case of empty string // note: ie uppercases css property names, but if we were to .tolowercase() // .csstext, that would destroy case senstitivity in url's, like in "background" return elem.style.csstext || undefined; }, set: function( elem, value ) { return ( elem.style.csstext = value + "" ); } }; } // safari mis-reports the default selected property of an option // accessing the parent's selectedindex property fixes it if ( !jquery.support.optselected ) { jquery.prophooks.selected = jquery.extend( jquery.prophooks.selected, { get: function( elem ) { var parent = elem.parentnode; if ( parent ) { parent.selectedindex; // make sure that it also works with optgroups, see #5701 if ( parent.parentnode ) { parent.parentnode.selectedindex; } } return null; } }); } // ie6/7 call enctype encoding if ( !jquery.support.enctype ) { jquery.propfix.enctype = "encoding"; } // radios and checkboxes getter/setter if ( !jquery.support.checkon ) { jquery.each([ "radio", "checkbox" ], function() { jquery.valhooks[ this ] = { get: function( elem ) { // handle the case where in webkit "" is returned instead of "on" if a value isn't specified return elem.getattribute("value") === null ? "on" : elem.value; } }; }); } jquery.each([ "radio", "checkbox" ], function() { jquery.valhooks[ this ] = jquery.extend( jquery.valhooks[ this ], { set: function( elem, value ) { if ( jquery.isarray( value ) ) { return ( elem.checked = jquery.inarray( jquery(elem).val(), value ) >= 0 ); } } }); }); var rformelems = /^(?:input|select|textarea)$/i, rkeyevent = /^key/, rmouseevent = /^(?:mouse|contextmenu)|click/, rfocusmorph = /^(?:focusinfocus|focusoutblur)$/, rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; function returntrue() { return true; } function returnfalse() { return false; } /* * helper functions for managing events -- not part of the public interface. * props to dean edwards' addevent library for many of the ideas. */ jquery.event = { global: {}, add: function( elem, types, handler, data, selector ) { var handleobjin, eventhandle, tmp, events, t, handleobj, special, handlers, type, namespaces, origtype, // don't attach events to nodata or text/comment nodes (but allow plain objects) elemdata = elem.nodetype !== 3 && elem.nodetype !== 8 && jquery._data( elem ); if ( !elemdata ) { return; } // caller can pass in an object of custom data in lieu of the handler if ( handler.handler ) { handleobjin = handler; handler = handleobjin.handler; selector = handleobjin.selector; } // make sure that the handler has a unique id, used to find/remove it later if ( !handler.guid ) { handler.guid = jquery.guid++; } // init the element's event structure and main handler, if this is the first if ( !(events = elemdata.events) ) { events = elemdata.events = {}; } if ( !(eventhandle = elemdata.handle) ) { eventhandle = elemdata.handle = function( e ) { // discard the second event of a jquery.event.trigger() and // when an event is called after a page has unloaded return typeof jquery !== "undefined" && (!e || jquery.event.triggered !== e.type) ? jquery.event.dispatch.apply( eventhandle.elem, arguments ) : undefined; }; // add elem as a property of the handle fn to prevent a memory leak with ie non-native events eventhandle.elem = elem; } // handle multiple events separated by a space // jquery(...).bind("mouseover mouseout", fn); types = ( types || "" ).match( core_rnotwhite ) || [""]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[t] ) || []; type = origtype = tmp[1]; namespaces = ( tmp[2] || "" ).split( "." ).sort(); // if event changes its type, use the special event handlers for the changed type special = jquery.event.special[ type ] || {}; // if selector defined, determine special event api type, otherwise given type type = ( selector ? special.delegatetype : special.bindtype ) || type; // update special based on newly reset type special = jquery.event.special[ type ] || {}; // handleobj is passed to all event handlers handleobj = jquery.extend({ type: type, origtype: origtype, data: data, handler: handler, guid: handler.guid, selector: selector, needscontext: selector && jquery.expr.match.needscontext.test( selector ), namespace: namespaces.join(".") }, handleobjin ); // init the event handler queue if we're the first if ( !(handlers = events[ type ]) ) { handlers = events[ type ] = []; handlers.delegatecount = 0; // only use addeventlistener/attachevent if the special events handler returns false if ( !special.setup || special.setup.call( elem, data, namespaces, eventhandle ) === false ) { // bind the global event handler to the element if ( elem.addeventlistener ) { elem.addeventlistener( type, eventhandle, false ); } else if ( elem.attachevent ) { elem.attachevent( "on" + type, eventhandle ); } } } if ( special.add ) { special.add.call( elem, handleobj ); if ( !handleobj.handler.guid ) { handleobj.handler.guid = handler.guid; } } // add to the element's handler list, delegates in front if ( selector ) { handlers.splice( handlers.delegatecount++, 0, handleobj ); } else { handlers.push( handleobj ); } // keep track of which events have ever been used, for event optimization jquery.event.global[ type ] = true; } // nullify elem to prevent memory leaks in ie elem = null; }, // detach an event or set of events from an element remove: function( elem, types, handler, selector, mappedtypes ) { var j, origcount, tmp, events, t, handleobj, special, handlers, type, namespaces, origtype, elemdata = jquery.hasdata( elem ) && jquery._data( elem ); if ( !elemdata || !(events = elemdata.events) ) { return; } // once for each type.namespace in types; type may be omitted types = ( types || "" ).match( core_rnotwhite ) || [""]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[t] ) || []; type = origtype = tmp[1]; namespaces = ( tmp[2] || "" ).split( "." ).sort(); // unbind all events (on this namespace, if provided) for the element if ( !type ) { for ( type in events ) { jquery.event.remove( elem, type + types[ t ], handler, selector, true ); } continue; } special = jquery.event.special[ type ] || {}; type = ( selector ? special.delegatetype : special.bindtype ) || type; handlers = events[ type ] || []; tmp = tmp[2] && new regexp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); // remove matching events origcount = j = handlers.length; while ( j-- ) { handleobj = handlers[ j ]; if ( ( mappedtypes || origtype === handleobj.origtype ) && ( !handler || handler.guid === handleobj.guid ) && ( !tmp || tmp.test( handleobj.namespace ) ) && ( !selector || selector === handleobj.selector || selector === "**" && handleobj.selector ) ) { handlers.splice( j, 1 ); if ( handleobj.selector ) { handlers.delegatecount--; } if ( special.remove ) { special.remove.call( elem, handleobj ); } } } // remove generic event handler if we removed something and no more handlers exist // (avoids potential for endless recursion during removal of special event handlers) if ( origcount && !handlers.length ) { if ( !special.teardown || special.teardown.call( elem, namespaces, elemdata.handle ) === false ) { jquery.removeevent( elem, type, elemdata.handle ); } delete events[ type ]; } } // remove the expando if it's no longer used if ( jquery.isemptyobject( events ) ) { delete elemdata.handle; // removedata also checks for emptiness and clears the expando if empty // so use it instead of delete jquery._removedata( elem, "events" ); } }, trigger: function( event, data, elem, onlyhandlers ) { var i, cur, tmp, bubbletype, ontype, handle, special, eventpath = [ elem || document ], type = event.type || event, namespaces = event.namespace ? event.namespace.split(".") : []; cur = tmp = elem = elem || document; // don't do events on text and comment nodes if ( elem.nodetype === 3 || elem.nodetype === 8 ) { return; } // focus/blur morphs to focusin/out; ensure we're not firing them right now if ( rfocusmorph.test( type + jquery.event.triggered ) ) { return; } if ( type.indexof(".") >= 0 ) { // namespaced trigger; create a regexp to match event type in handle() namespaces = type.split("."); type = namespaces.shift(); namespaces.sort(); } ontype = type.indexof(":") < 0 && "on" + type; // caller can pass in a jquery.event object, object, or just an event type string event = event[ jquery.expando ] ? event : new jquery.event( type, typeof event === "object" && event ); event.istrigger = true; event.namespace = namespaces.join("."); event.namespace_re = event.namespace ? new regexp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : null; // clean up the event in case it is being reused event.result = undefined; if ( !event.target ) { event.target = elem; } // clone any incoming data and prepend the event, creating the handler arg list data = data == null ? [ event ] : jquery.makearray( data, [ event ] ); // allow special events to draw outside the lines special = jquery.event.special[ type ] || {}; if ( !onlyhandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { return; } // determine event propagation path in advance, per w3c events spec (#9951) // bubble up to document, then to window; watch for a global ownerdocument var (#9724) if ( !onlyhandlers && !special.nobubble && !jquery.iswindow( elem ) ) { bubbletype = special.delegatetype || type; if ( !rfocusmorph.test( bubbletype + type ) ) { cur = cur.parentnode; } for ( ; cur; cur = cur.parentnode ) { eventpath.push( cur ); tmp = cur; } // only add window if we got to document (e.g., not plain obj or detached dom) if ( tmp === (elem.ownerdocument || document) ) { eventpath.push( tmp.defaultview || tmp.parentwindow || window ); } } // fire handlers on the event path i = 0; while ( (cur = eventpath[i++]) && !event.ispropagationstopped() ) { event.type = i > 1 ? bubbletype : special.bindtype || type; // jquery handler handle = ( jquery._data( cur, "events" ) || {} )[ event.type ] && jquery._data( cur, "handle" ); if ( handle ) { handle.apply( cur, data ); } // native handler handle = ontype && cur[ ontype ]; if ( handle && jquery.acceptdata( cur ) && handle.apply && handle.apply( cur, data ) === false ) { event.preventdefault(); } } event.type = type; // if nobody prevented the default action, do it now if ( !onlyhandlers && !event.isdefaultprevented() ) { if ( (!special._default || special._default.apply( elem.ownerdocument, data ) === false) && !(type === "click" && jquery.nodename( elem, "a" )) && jquery.acceptdata( elem ) ) { // call a native dom method on the target with the same name name as the event. // can't use an .isfunction() check here because ie6/7 fails that test. // don't do default actions on window, that's where global variables be (#6170) if ( ontype && elem[ type ] && !jquery.iswindow( elem ) ) { // don't re-trigger an onfoo event when we call its foo() method tmp = elem[ ontype ]; if ( tmp ) { elem[ ontype ] = null; } // prevent re-triggering of the same event, since we already bubbled it above jquery.event.triggered = type; try { elem[ type ](); } catch ( e ) { // ie<9 dies on focus/blur to hidden element (#1486,#12518) // only reproducible on winxp ie8 native, not ie9 in ie8 mode } jquery.event.triggered = undefined; if ( tmp ) { elem[ ontype ] = tmp; } } } } return event.result; }, dispatch: function( event ) { // make a writable jquery.event from the native event object event = jquery.event.fix( event ); var i, j, ret, matched, handleobj, handlerqueue = [], args = core_slice.call( arguments ), handlers = ( jquery._data( this, "events" ) || {} )[ event.type ] || [], special = jquery.event.special[ event.type ] || {}; // use the fix-ed jquery.event rather than the (read-only) native event args[0] = event; event.delegatetarget = this; // call the predispatch hook for the mapped type, and let it bail if desired if ( special.predispatch && special.predispatch.call( this, event ) === false ) { return; } // determine handlers handlerqueue = jquery.event.handlers.call( this, event, handlers ); // run delegates first; they may want to stop propagation beneath us i = 0; while ( (matched = handlerqueue[ i++ ]) && !event.ispropagationstopped() ) { event.currenttarget = matched.elem; j = 0; while ( (handleobj = matched.handlers[ j++ ]) && !event.isimmediatepropagationstopped() ) { // triggered event must either 1) have no namespace, or // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). if ( !event.namespace_re || event.namespace_re.test( handleobj.namespace ) ) { event.handleobj = handleobj; event.data = handleobj.data; ret = ( (jquery.event.special[ handleobj.origtype ] || {}).handle || handleobj.handler ) .apply( matched.elem, args ); if ( ret !== undefined ) { if ( (event.result = ret) === false ) { event.preventdefault(); event.stoppropagation(); } } } } } // call the postdispatch hook for the mapped type if ( special.postdispatch ) { special.postdispatch.call( this, event ); } return event.result; }, handlers: function( event, handlers ) { var i, matches, sel, handleobj, handlerqueue = [], delegatecount = handlers.delegatecount, cur = event.target; // find delegate handlers // black-hole svg instance trees (#13180) // avoid non-left-click bubbling in firefox (#3861) if ( delegatecount && cur.nodetype && (!event.button || event.type !== "click") ) { for ( ; cur != this; cur = cur.parentnode || this ) { // don't process clicks on disabled elements (#6911, #8165, #11382, #11764) if ( cur.disabled !== true || event.type !== "click" ) { matches = []; for ( i = 0; i < delegatecount; i++ ) { handleobj = handlers[ i ]; // don't conflict with object.prototype properties (#13203) sel = handleobj.selector + " "; if ( matches[ sel ] === undefined ) { matches[ sel ] = handleobj.needscontext ? jquery( sel, this ).index( cur ) >= 0 : jquery.find( sel, this, null, [ cur ] ).length; } if ( matches[ sel ] ) { matches.push( handleobj ); } } if ( matches.length ) { handlerqueue.push({ elem: cur, handlers: matches }); } } } } // add the remaining (directly-bound) handlers if ( delegatecount < handlers.length ) { handlerqueue.push({ elem: this, handlers: handlers.slice( delegatecount ) }); } return handlerqueue; }, fix: function( event ) { if ( event[ jquery.expando ] ) { return event; } // create a writable copy of the event object and normalize some properties var i, prop, originalevent = event, fixhook = jquery.event.fixhooks[ event.type ] || {}, copy = fixhook.props ? this.props.concat( fixhook.props ) : this.props; event = new jquery.event( originalevent ); i = copy.length; while ( i-- ) { prop = copy[ i ]; event[ prop ] = originalevent[ prop ]; } // support: ie<9 // fix target property (#1925) if ( !event.target ) { event.target = originalevent.srcelement || document; } // support: chrome 23+, safari? // target should not be a text node (#504, #13143) if ( event.target.nodetype === 3 ) { event.target = event.target.parentnode; } // support: ie<9 // for mouse/key events, metakey==false if it's undefined (#3368, #11328) event.metakey = !!event.metakey; return fixhook.filter ? fixhook.filter( event, originalevent ) : event; }, // includes some event props shared by keyevent and mouseevent props: "altkey bubbles cancelable ctrlkey currenttarget eventphase metakey relatedtarget shiftkey target timestamp view which".split(" "), fixhooks: {}, keyhooks: { props: "char charcode key keycode".split(" "), filter: function( event, original ) { // add which for key events if ( event.which == null ) { event.which = original.charcode != null ? original.charcode : original.keycode; } return event; } }, mousehooks: { props: "button buttons clientx clienty fromelement offsetx offsety pagex pagey screenx screeny toelement".split(" "), filter: function( event, original ) { var eventdoc, doc, body, button = original.button, fromelement = original.fromelement; // calculate pagex/y if missing and clientx/y available if ( event.pagex == null && original.clientx != null ) { eventdoc = event.target.ownerdocument || document; doc = eventdoc.documentelement; body = eventdoc.body; event.pagex = original.clientx + ( doc && doc.scrollleft || body && body.scrollleft || 0 ) - ( doc && doc.clientleft || body && body.clientleft || 0 ); event.pagey = original.clienty + ( doc && doc.scrolltop || body && body.scrolltop || 0 ) - ( doc && doc.clienttop || body && body.clienttop || 0 ); } // add relatedtarget, if necessary if ( !event.relatedtarget && fromelement ) { event.relatedtarget = fromelement === event.target ? original.toelement : fromelement; } // add which for click: 1 === left; 2 === middle; 3 === right // note: button is not normalized, so don't use it if ( !event.which && button !== undefined ) { event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); } return event; } }, special: { load: { // prevent triggered image.load events from bubbling to window.load nobubble: true }, click: { // for checkbox, fire native event so checked state will be right trigger: function() { if ( jquery.nodename( this, "input" ) && this.type === "checkbox" && this.click ) { this.click(); return false; } } }, focus: { // fire native event if possible so blur/focus sequence is correct trigger: function() { if ( this !== document.activeelement && this.focus ) { try { this.focus(); return false; } catch ( e ) { // support: ie<9 // if we error on focus to hidden element (#1486, #12518), // let .trigger() run the handlers } } }, delegatetype: "focusin" }, blur: { trigger: function() { if ( this === document.activeelement && this.blur ) { this.blur(); return false; } }, delegatetype: "focusout" }, beforeunload: { postdispatch: function( event ) { // even when returnvalue equals to undefined firefox will still show alert if ( event.result !== undefined ) { event.originalevent.returnvalue = event.result; } } } }, simulate: function( type, elem, event, bubble ) { // piggyback on a donor event to simulate a different one. // fake originalevent to avoid donor's stoppropagation, but if the // simulated event prevents default then we do the same on the donor. var e = jquery.extend( new jquery.event(), event, { type: type, issimulated: true, originalevent: {} } ); if ( bubble ) { jquery.event.trigger( e, null, elem ); } else { jquery.event.dispatch.call( elem, e ); } if ( e.isdefaultprevented() ) { event.preventdefault(); } } }; jquery.removeevent = document.removeeventlistener ? function( elem, type, handle ) { if ( elem.removeeventlistener ) { elem.removeeventlistener( type, handle, false ); } } : function( elem, type, handle ) { var name = "on" + type; if ( elem.detachevent ) { // #8545, #7054, preventing memory leaks for custom events in ie6-8 // detachevent needed property on element, by name of that event, to properly expose it to gc if ( typeof elem[ name ] === "undefined" ) { elem[ name ] = null; } elem.detachevent( name, handle ); } }; jquery.event = function( src, props ) { // allow instantiation without the 'new' keyword if ( !(this instanceof jquery.event) ) { return new jquery.event( src, props ); } // event object if ( src && src.type ) { this.originalevent = src; this.type = src.type; // events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. this.isdefaultprevented = ( src.defaultprevented || src.returnvalue === false || src.getpreventdefault && src.getpreventdefault() ) ? returntrue : returnfalse; // event type } else { this.type = src; } // put explicitly provided properties onto the event object if ( props ) { jquery.extend( this, props ); } // create a timestamp if incoming event doesn't have one this.timestamp = src && src.timestamp || jquery.now(); // mark it as fixed this[ jquery.expando ] = true; }; // jquery.event is based on dom3 events as specified by the ecmascript language binding // http://www.w3.org/tr/2003/wd-dom-level-3-events-20030331/ecma-script-binding.html jquery.event.prototype = { isdefaultprevented: returnfalse, ispropagationstopped: returnfalse, isimmediatepropagationstopped: returnfalse, preventdefault: function() { var e = this.originalevent; this.isdefaultprevented = returntrue; if ( !e ) { return; } // if preventdefault exists, run it on the original event if ( e.preventdefault ) { e.preventdefault(); // support: ie // otherwise set the returnvalue property of the original event to false } else { e.returnvalue = false; } }, stoppropagation: function() { var e = this.originalevent; this.ispropagationstopped = returntrue; if ( !e ) { return; } // if stoppropagation exists, run it on the original event if ( e.stoppropagation ) { e.stoppropagation(); } // support: ie // set the cancelbubble property of the original event to true e.cancelbubble = true; }, stopimmediatepropagation: function() { this.isimmediatepropagationstopped = returntrue; this.stoppropagation(); } }; // create mouseenter/leave events using mouseover/out and event-time checks jquery.each({ mouseenter: "mouseover", mouseleave: "mouseout" }, function( orig, fix ) { jquery.event.special[ orig ] = { delegatetype: fix, bindtype: fix, handle: function( event ) { var ret, target = this, related = event.relatedtarget, handleobj = event.handleobj; // for mousenter/leave call the handler if related is outside the target. // nb: no relatedtarget if the mouse left/entered the browser window if ( !related || (related !== target && !jquery.contains( target, related )) ) { event.type = handleobj.origtype; ret = handleobj.handler.apply( this, arguments ); event.type = fix; } return ret; } }; }); // ie submit delegation if ( !jquery.support.submitbubbles ) { jquery.event.special.submit = { setup: function() { // only need this for delegated form submit events if ( jquery.nodename( this, "form" ) ) { return false; } // lazy-add a submit handler when a descendant form may potentially be submitted jquery.event.add( this, "click._submit keypress._submit", function( e ) { // node name check avoids a vml-related crash in ie (#9807) var elem = e.target, form = jquery.nodename( elem, "input" ) || jquery.nodename( elem, "button" ) ? elem.form : undefined; if ( form && !jquery._data( form, "submitbubbles" ) ) { jquery.event.add( form, "submit._submit", function( event ) { event._submit_bubble = true; }); jquery._data( form, "submitbubbles", true ); } }); // return undefined since we don't need an event listener }, postdispatch: function( event ) { // if form was submitted by the user, bubble the event up the tree if ( event._submit_bubble ) { delete event._submit_bubble; if ( this.parentnode && !event.istrigger ) { jquery.event.simulate( "submit", this.parentnode, event, true ); } } }, teardown: function() { // only need this for delegated form submit events if ( jquery.nodename( this, "form" ) ) { return false; } // remove delegated handlers; cleandata eventually reaps submit handlers attached above jquery.event.remove( this, "._submit" ); } }; } // ie change delegation and checkbox/radio fix if ( !jquery.support.changebubbles ) { jquery.event.special.change = { setup: function() { if ( rformelems.test( this.nodename ) ) { // ie doesn't fire change on a check/radio until blur; trigger it on click // after a propertychange. eat the blur-change in special.change.handle. // this still fires onchange a second time for check/radio after blur. if ( this.type === "checkbox" || this.type === "radio" ) { jquery.event.add( this, "propertychange._change", function( event ) { if ( event.originalevent.propertyname === "checked" ) { this._just_changed = true; } }); jquery.event.add( this, "click._change", function( event ) { if ( this._just_changed && !event.istrigger ) { this._just_changed = false; } // allow triggered, simulated change events (#11500) jquery.event.simulate( "change", this, event, true ); }); } return false; } // delegated event; lazy-add a change handler on descendant inputs jquery.event.add( this, "beforeactivate._change", function( e ) { var elem = e.target; if ( rformelems.test( elem.nodename ) && !jquery._data( elem, "changebubbles" ) ) { jquery.event.add( elem, "change._change", function( event ) { if ( this.parentnode && !event.issimulated && !event.istrigger ) { jquery.event.simulate( "change", this.parentnode, event, true ); } }); jquery._data( elem, "changebubbles", true ); } }); }, handle: function( event ) { var elem = event.target; // swallow native change events from checkbox/radio, we already triggered them above if ( this !== elem || event.issimulated || event.istrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { return event.handleobj.handler.apply( this, arguments ); } }, teardown: function() { jquery.event.remove( this, "._change" ); return !rformelems.test( this.nodename ); } }; } // create "bubbling" focus and blur events if ( !jquery.support.focusinbubbles ) { jquery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { // attach a single capturing handler while someone wants focusin/focusout var attaches = 0, handler = function( event ) { jquery.event.simulate( fix, event.target, jquery.event.fix( event ), true ); }; jquery.event.special[ fix ] = { setup: function() { if ( attaches++ === 0 ) { document.addeventlistener( orig, handler, true ); } }, teardown: function() { if ( --attaches === 0 ) { document.removeeventlistener( orig, handler, true ); } } }; }); } jquery.fn.extend({ on: function( types, selector, data, fn, /*internal*/ one ) { var origfn, type; // types can be a map of types/handlers if ( typeof types === "object" ) { // ( types-object, selector, data ) if ( typeof selector !== "string" ) { // ( types-object, data ) data = data || selector; selector = undefined; } for ( type in types ) { this.on( type, selector, data, types[ type ], one ); } return this; } if ( data == null && fn == null ) { // ( types, fn ) fn = selector; data = selector = undefined; } else if ( fn == null ) { if ( typeof selector === "string" ) { // ( types, selector, fn ) fn = data; data = undefined; } else { // ( types, data, fn ) fn = data; data = selector; selector = undefined; } } if ( fn === false ) { fn = returnfalse; } else if ( !fn ) { return this; } if ( one === 1 ) { origfn = fn; fn = function( event ) { // can use an empty set, since event contains the info jquery().off( event ); return origfn.apply( this, arguments ); }; // use same guid so caller can remove using origfn fn.guid = origfn.guid || ( origfn.guid = jquery.guid++ ); } return this.each( function() { jquery.event.add( this, types, fn, data, selector ); }); }, one: function( types, selector, data, fn ) { return this.on( types, selector, data, fn, 1 ); }, off: function( types, selector, fn ) { var handleobj, type; if ( types && types.preventdefault && types.handleobj ) { // ( event ) dispatched jquery.event handleobj = types.handleobj; jquery( types.delegatetarget ).off( handleobj.namespace ? handleobj.origtype + "." + handleobj.namespace : handleobj.origtype, handleobj.selector, handleobj.handler ); return this; } if ( typeof types === "object" ) { // ( types-object [, selector] ) for ( type in types ) { this.off( type, selector, types[ type ] ); } return this; } if ( selector === false || typeof selector === "function" ) { // ( types [, fn] ) fn = selector; selector = undefined; } if ( fn === false ) { fn = returnfalse; } return this.each(function() { jquery.event.remove( this, types, fn, selector ); }); }, bind: function( types, data, fn ) { return this.on( types, null, data, fn ); }, unbind: function( types, fn ) { return this.off( types, null, fn ); }, delegate: function( selector, types, data, fn ) { return this.on( types, selector, data, fn ); }, undelegate: function( selector, types, fn ) { // ( namespace ) or ( selector, types [, fn] ) return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); }, trigger: function( type, data ) { return this.each(function() { jquery.event.trigger( type, data, this ); }); }, triggerhandler: function( type, data ) { var elem = this[0]; if ( elem ) { return jquery.event.trigger( type, data, elem, true ); } }, hover: function( fnover, fnout ) { return this.mouseenter( fnover ).mouseleave( fnout || fnover ); } }); jquery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { // handle event binding jquery.fn[ name ] = function( data, fn ) { return arguments.length > 0 ? this.on( name, null, data, fn ) : this.trigger( name ); }; if ( rkeyevent.test( name ) ) { jquery.event.fixhooks[ name ] = jquery.event.keyhooks; } if ( rmouseevent.test( name ) ) { jquery.event.fixhooks[ name ] = jquery.event.mousehooks; } }); /*! * sizzle css selector engine * copyright 2012 jquery foundation and other contributors * released under the mit license * http://sizzlejs.com/ */ (function( window, undefined ) { var i, cachedruns, expr, gettext, isxml, compile, hasduplicate, outermostcontext, // local document vars setdocument, document, docelem, documentisxml, rbuggyqsa, rbuggymatches, matches, contains, sortorder, // instance-specific data expando = "sizzle" + -(new date()), preferreddoc = window.document, support = {}, dirruns = 0, done = 0, classcache = createcache(), tokencache = createcache(), compilercache = createcache(), // general-purpose constants strundefined = typeof undefined, max_negative = 1 << 31, // array methods arr = [], pop = arr.pop, push = arr.push, slice = arr.slice, // use a stripped-down indexof if we can't use a native one indexof = arr.indexof || function( elem ) { var i = 0, len = this.length; for ( ; i < len; i++ ) { if ( this[i] === elem ) { return i; } } return -1; }, // regular expressions // whitespace characters http://www.w3.org/tr/css3-selectors/#whitespace whitespace = "[\\x20\\t\\r\\n\\f]", // http://www.w3.org/tr/css3-syntax/#characters characterencoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", // loosely modeled on css identifier characters // an unquoted value should be a css identifier http://www.w3.org/tr/css3-selectors/#attribute-selectors // proper syntax: http://www.w3.org/tr/css21/syndata.html#value-def-identifier identifier = characterencoding.replace( "w", "w#" ), // acceptable operators http://www.w3.org/tr/selectors/#attribute-selectors operators = "([*^$|!~]?=)", attributes = "\\[" + whitespace + "*(" + characterencoding + ")" + whitespace + "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", // prefer arguments quoted, // then not containing pseudos/brackets, // then attribute selectors/non-parenthetical expressions, // then anything else // these preferences are here to reduce the number of selectors // needing tokenize in the pseudo prefilter pseudos = ":(" + characterencoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", // leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter rtrim = new regexp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), rcomma = new regexp( "^" + whitespace + "*," + whitespace + "*" ), rcombinators = new regexp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), rpseudo = new regexp( pseudos ), ridentifier = new regexp( "^" + identifier + "$" ), matchexpr = { "id": new regexp( "^#(" + characterencoding + ")" ), "class": new regexp( "^\\.(" + characterencoding + ")" ), "name": new regexp( "^\\[name=['\"]?(" + characterencoding + ")['\"]?\\]" ), "tag": new regexp( "^(" + characterencoding.replace( "w", "w*" ) + ")" ), "attr": new regexp( "^" + attributes ), "pseudo": new regexp( "^" + pseudos ), "child": new regexp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), // for use in libraries implementing .is() // we use this for pos matching in `select` "needscontext": new regexp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) }, rsibling = /[\x20\t\r\n\f]*[+~]/, rnative = /\{\s*\[native code\]\s*\}/, // easily-parseable/retrievable id or tag or class selectors rquickexpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rescape = /'|\\/g, rattributequotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, // css escapes http://www.w3.org/tr/css21/syndata.html#escaped-characters runescape = /\\([\da-fa-f]{1,6}[\x20\t\r\n\f]?|.)/g, funescape = function( _, escaped ) { var high = "0x" + escaped - 0x10000; // nan means non-codepoint return high !== high ? escaped : // bmp codepoint high < 0 ? string.fromcharcode( high + 0x10000 ) : // supplemental plane codepoint (surrogate pair) string.fromcharcode( high >> 10 | 0xd800, high & 0x3ff | 0xdc00 ); }; // use a stripped-down slice if we can't use a native one try { slice.call( docelem.childnodes, 0 )[0].nodetype; } catch ( e ) { slice = function( i ) { var elem, results = []; for ( ; (elem = this[i]); i++ ) { results.push( elem ); } return results; }; } /** * for feature detection * @param {function} fn the function to test for native support */ function isnative( fn ) { return rnative.test( fn + "" ); } /** * create key-value caches of limited size * @returns {function(string, object)} returns the object data after storing it on itself with * property name the (space-suffixed) string and (if the cache is larger than expr.cachelength) * deleting the oldest entry */ function createcache() { var cache, keys = []; return (cache = function( key, value ) { // use (key + " ") to avoid collision with native prototype properties (see issue #157) if ( keys.push( key += " " ) > expr.cachelength ) { // only keep the most recent entries delete cache[ keys.shift() ]; } return (cache[ key ] = value); }); } /** * mark a function for special use by sizzle * @param {function} fn the function to mark */ function markfunction( fn ) { fn[ expando ] = true; return fn; } /** * support testing using an element * @param {function} fn passed the created div and expects a boolean result */ function assert( fn ) { var div = document.createelement("div"); try { return fn( div ); } catch (e) { return false; } finally { // release memory in ie div = null; } } function sizzle( selector, context, results, seed ) { var match, elem, m, nodetype, // qsa vars i, groups, old, nid, newcontext, newselector; if ( ( context ? context.ownerdocument || context : preferreddoc ) !== document ) { setdocument( context ); } context = context || document; results = results || []; if ( !selector || typeof selector !== "string" ) { return results; } if ( (nodetype = context.nodetype) !== 1 && nodetype !== 9 ) { return []; } if ( !documentisxml && !seed ) { // shortcuts if ( (match = rquickexpr.exec( selector )) ) { // speed-up: sizzle("#id") if ( (m = match[1]) ) { if ( nodetype === 9 ) { elem = context.getelementbyid( m ); // check parentnode to catch when blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentnode ) { // handle the case where ie, opera, and webkit return items // by name instead of id if ( elem.id === m ) { results.push( elem ); return results; } } else { return results; } } else { // context is not a document if ( context.ownerdocument && (elem = context.ownerdocument.getelementbyid( m )) && contains( context, elem ) && elem.id === m ) { results.push( elem ); return results; } } // speed-up: sizzle("tag") } else if ( match[2] ) { push.apply( results, slice.call(context.getelementsbytagname( selector ), 0) ); return results; // speed-up: sizzle(".class") } else if ( (m = match[3]) && support.getbyclassname && context.getelementsbyclassname ) { push.apply( results, slice.call(context.getelementsbyclassname( m ), 0) ); return results; } } // qsa path if ( support.qsa && !rbuggyqsa.test(selector) ) { old = true; nid = expando; newcontext = context; newselector = nodetype === 9 && selector; // qsa works strangely on element-rooted queries // we can work around this by specifying an extra id on the root // and working up from there (thanks to andrew dupont for the technique) // ie 8 doesn't work on object elements if ( nodetype === 1 && context.nodename.tolowercase() !== "object" ) { groups = tokenize( selector ); if ( (old = context.getattribute("id")) ) { nid = old.replace( rescape, "\\$&" ); } else { context.setattribute( "id", nid ); } nid = "[id='" + nid + "'] "; i = groups.length; while ( i-- ) { groups[i] = nid + toselector( groups[i] ); } newcontext = rsibling.test( selector ) && context.parentnode || context; newselector = groups.join(","); } if ( newselector ) { try { push.apply( results, slice.call( newcontext.queryselectorall( newselector ), 0 ) ); return results; } catch(qsaerror) { } finally { if ( !old ) { context.removeattribute("id"); } } } } } // all others return select( selector.replace( rtrim, "$1" ), context, results, seed ); } /** * detect xml * @param {element|object} elem an element or a document */ isxml = sizzle.isxml = function( elem ) { // documentelement is verified for cases where it doesn't yet exist // (such as loading iframes in ie - #4833) var documentelement = elem && (elem.ownerdocument || elem).documentelement; return documentelement ? documentelement.nodename !== "html" : false; }; /** * sets document-related variables once based on the current document * @param {element|object} [doc] an element or document object to use to set the document * @returns {object} returns the current document */ setdocument = sizzle.setdocument = function( node ) { var doc = node ? node.ownerdocument || node : preferreddoc; // if no document and documentelement is available, return if ( doc === document || doc.nodetype !== 9 || !doc.documentelement ) { return document; } // set our document document = doc; docelem = doc.documentelement; // support tests documentisxml = isxml( doc ); // check if getelementsbytagname("*") returns only elements support.tagnamenocomments = assert(function( div ) { div.appendchild( doc.createcomment("") ); return !div.getelementsbytagname("*").length; }); // check if attributes should be retrieved by attribute nodes support.attributes = assert(function( div ) { div.innerhtml = ""; var type = typeof div.lastchild.getattribute("multiple"); // ie8 returns a string for some attributes even when not present return type !== "boolean" && type !== "string"; }); // check if getelementsbyclassname can be trusted support.getbyclassname = assert(function( div ) { // opera can't find a second classname (in 9.6) div.innerhtml = ""; if ( !div.getelementsbyclassname || !div.getelementsbyclassname("e").length ) { return false; } // safari 3.2 caches class attributes and doesn't catch changes div.lastchild.classname = "e"; return div.getelementsbyclassname("e").length === 2; }); // check if getelementbyid returns elements by name // check if getelementsbyname privileges form controls or returns elements by id support.getbyname = assert(function( div ) { // inject content div.id = expando + 0; div.innerhtml = "
"; docelem.insertbefore( div, docelem.firstchild ); // test var pass = doc.getelementsbyname && // buggy browsers will return fewer than the correct 2 doc.getelementsbyname( expando ).length === 2 + // buggy browsers will return more than the correct 0 doc.getelementsbyname( expando + 0 ).length; support.getidnotname = !doc.getelementbyid( expando ); // cleanup docelem.removechild( div ); return pass; }); // ie6/7 return modified attributes expr.attrhandle = assert(function( div ) { div.innerhtml = ""; return div.firstchild && typeof div.firstchild.getattribute !== strundefined && div.firstchild.getattribute("href") === "#"; }) ? {} : { "href": function( elem ) { return elem.getattribute( "href", 2 ); }, "type": function( elem ) { return elem.getattribute("type"); } }; // id find and filter if ( support.getidnotname ) { expr.find["id"] = function( id, context ) { if ( typeof context.getelementbyid !== strundefined && !documentisxml ) { var m = context.getelementbyid( id ); // check parentnode to catch when blackberry 4.6 returns // nodes that are no longer in the document #6963 return m && m.parentnode ? [m] : []; } }; expr.filter["id"] = function( id ) { var attrid = id.replace( runescape, funescape ); return function( elem ) { return elem.getattribute("id") === attrid; }; }; } else { expr.find["id"] = function( id, context ) { if ( typeof context.getelementbyid !== strundefined && !documentisxml ) { var m = context.getelementbyid( id ); return m ? m.id === id || typeof m.getattributenode !== strundefined && m.getattributenode("id").value === id ? [m] : undefined : []; } }; expr.filter["id"] = function( id ) { var attrid = id.replace( runescape, funescape ); return function( elem ) { var node = typeof elem.getattributenode !== strundefined && elem.getattributenode("id"); return node && node.value === attrid; }; }; } // tag expr.find["tag"] = support.tagnamenocomments ? function( tag, context ) { if ( typeof context.getelementsbytagname !== strundefined ) { return context.getelementsbytagname( tag ); } } : function( tag, context ) { var elem, tmp = [], i = 0, results = context.getelementsbytagname( tag ); // filter out possible comments if ( tag === "*" ) { for ( ; (elem = results[i]); i++ ) { if ( elem.nodetype === 1 ) { tmp.push( elem ); } } return tmp; } return results; }; // name expr.find["name"] = support.getbyname && function( tag, context ) { if ( typeof context.getelementsbyname !== strundefined ) { return context.getelementsbyname( name ); } }; // class expr.find["class"] = support.getbyclassname && function( classname, context ) { if ( typeof context.getelementsbyclassname !== strundefined && !documentisxml ) { return context.getelementsbyclassname( classname ); } }; // qsa and matchesselector support // matchesselector(:active) reports false when true (ie9/opera 11.5) rbuggymatches = []; // qsa(:focus) reports false when true (chrome 21), // no need to also add to buggymatches since matches checks buggyqsa // a support test would require too much code (would include document ready) rbuggyqsa = [ ":focus" ]; if ( (support.qsa = isnative(doc.queryselectorall)) ) { // build qsa regex // regex strategy adopted from diego perini assert(function( div ) { // select is set to empty string on purpose // this is to test ie's treatment of not explictly // setting a boolean content attribute, // since its presence should be enough // http://bugs.jquery.com/ticket/12359 div.innerhtml = ""; // ie8 - some boolean attributes are not treated correctly if ( !div.queryselectorall("[selected]").length ) { rbuggyqsa.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); } // webkit/opera - :checked should return selected option elements // http://www.w3.org/tr/2011/rec-css3-selectors-20110929/#checked // ie8 throws error here and will not see later tests if ( !div.queryselectorall(":checked").length ) { rbuggyqsa.push(":checked"); } }); assert(function( div ) { // opera 10-12/ie8 - ^= $= *= and empty values // should not select anything div.innerhtml = ""; if ( div.queryselectorall("[i^='']").length ) { rbuggyqsa.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); } // ff 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) // ie8 throws error here and will not see later tests if ( !div.queryselectorall(":enabled").length ) { rbuggyqsa.push( ":enabled", ":disabled" ); } // opera 10-11 does not throw on post-comma invalid pseudos div.queryselectorall("*,:x"); rbuggyqsa.push(",.*:"); }); } if ( (support.matchesselector = isnative( (matches = docelem.matchesselector || docelem.mozmatchesselector || docelem.webkitmatchesselector || docelem.omatchesselector || docelem.msmatchesselector) )) ) { assert(function( div ) { // check to see if it's possible to do matchesselector // on a disconnected node (ie 9) support.disconnectedmatch = matches.call( div, "div" ); // this should fail with an exception // gecko does not error, returns false instead matches.call( div, "[s!='']:x" ); rbuggymatches.push( "!=", pseudos ); }); } rbuggyqsa = new regexp( rbuggyqsa.join("|") ); rbuggymatches = new regexp( rbuggymatches.join("|") ); // element contains another // purposefully does not implement inclusive descendent // as in, an element does not contain itself contains = isnative(docelem.contains) || docelem.comparedocumentposition ? function( a, b ) { var adown = a.nodetype === 9 ? a.documentelement : a, bup = b && b.parentnode; return a === bup || !!( bup && bup.nodetype === 1 && ( adown.contains ? adown.contains( bup ) : a.comparedocumentposition && a.comparedocumentposition( bup ) & 16 )); } : function( a, b ) { if ( b ) { while ( (b = b.parentnode) ) { if ( b === a ) { return true; } } } return false; }; // document order sorting sortorder = docelem.comparedocumentposition ? function( a, b ) { var compare; if ( a === b ) { hasduplicate = true; return 0; } if ( (compare = b.comparedocumentposition && a.comparedocumentposition && a.comparedocumentposition( b )) ) { if ( compare & 1 || a.parentnode && a.parentnode.nodetype === 11 ) { if ( a === doc || contains( preferreddoc, a ) ) { return -1; } if ( b === doc || contains( preferreddoc, b ) ) { return 1; } return 0; } return compare & 4 ? -1 : 1; } return a.comparedocumentposition ? -1 : 1; } : function( a, b ) { var cur, i = 0, aup = a.parentnode, bup = b.parentnode, ap = [ a ], bp = [ b ]; // the nodes are identical, we can exit early if ( a === b ) { hasduplicate = true; return 0; // fallback to using sourceindex (in ie) if it's available on both nodes } else if ( a.sourceindex && b.sourceindex ) { return ( ~b.sourceindex || max_negative ) - ( contains( preferreddoc, a ) && ~a.sourceindex || max_negative ); // parentless nodes are either documents or disconnected } else if ( !aup || !bup ) { return a === doc ? -1 : b === doc ? 1 : aup ? -1 : bup ? 1 : 0; // if the nodes are siblings, we can do a quick check } else if ( aup === bup ) { return siblingcheck( a, b ); } // otherwise we need full lists of their ancestors for comparison cur = a; while ( (cur = cur.parentnode) ) { ap.unshift( cur ); } cur = b; while ( (cur = cur.parentnode) ) { bp.unshift( cur ); } // walk down the tree looking for a discrepancy while ( ap[i] === bp[i] ) { i++; } return i ? // do a sibling check if the nodes have a common ancestor siblingcheck( ap[i], bp[i] ) : // otherwise nodes in our document sort first ap[i] === preferreddoc ? -1 : bp[i] === preferreddoc ? 1 : 0; }; // always assume the presence of duplicates if sort doesn't // pass them to our comparison function (as in google chrome). hasduplicate = false; [0, 0].sort( sortorder ); support.detectduplicates = hasduplicate; return document; }; sizzle.matches = function( expr, elements ) { return sizzle( expr, null, null, elements ); }; sizzle.matchesselector = function( elem, expr ) { // set document vars if needed if ( ( elem.ownerdocument || elem ) !== document ) { setdocument( elem ); } // make sure that attribute selectors are quoted expr = expr.replace( rattributequotes, "='$1']" ); // rbuggyqsa always contains :focus, so no need for an existence check if ( support.matchesselector && !documentisxml && (!rbuggymatches || !rbuggymatches.test(expr)) && !rbuggyqsa.test(expr) ) { try { var ret = matches.call( elem, expr ); // ie 9's matchesselector returns false on disconnected nodes if ( ret || support.disconnectedmatch || // as well, disconnected nodes are said to be in a document // fragment in ie 9 elem.document && elem.document.nodetype !== 11 ) { return ret; } } catch(e) {} } return sizzle( expr, document, null, [elem] ).length > 0; }; sizzle.contains = function( context, elem ) { // set document vars if needed if ( ( context.ownerdocument || context ) !== document ) { setdocument( context ); } return contains( context, elem ); }; sizzle.attr = function( elem, name ) { var val; // set document vars if needed if ( ( elem.ownerdocument || elem ) !== document ) { setdocument( elem ); } if ( !documentisxml ) { name = name.tolowercase(); } if ( (val = expr.attrhandle[ name ]) ) { return val( elem ); } if ( documentisxml || support.attributes ) { return elem.getattribute( name ); } return ( (val = elem.getattributenode( name )) || elem.getattribute( name ) ) && elem[ name ] === true ? name : val && val.specified ? val.value : null; }; sizzle.error = function( msg ) { throw new error( "syntax error, unrecognized expression: " + msg ); }; // document sorting and removing duplicates sizzle.uniquesort = function( results ) { var elem, duplicates = [], i = 1, j = 0; // unless we *know* we can detect duplicates, assume their presence hasduplicate = !support.detectduplicates; results.sort( sortorder ); if ( hasduplicate ) { for ( ; (elem = results[i]); i++ ) { if ( elem === results[ i - 1 ] ) { j = duplicates.push( i ); } } while ( j-- ) { results.splice( duplicates[ j ], 1 ); } } return results; }; function siblingcheck( a, b ) { var cur = a && b && a.nextsibling; for ( ; cur; cur = cur.nextsibling ) { if ( cur === b ) { return -1; } } return a ? 1 : -1; } // returns a function to use in pseudos for input types function createinputpseudo( type ) { return function( elem ) { var name = elem.nodename.tolowercase(); return name === "input" && elem.type === type; }; } // returns a function to use in pseudos for buttons function createbuttonpseudo( type ) { return function( elem ) { var name = elem.nodename.tolowercase(); return (name === "input" || name === "button") && elem.type === type; }; } // returns a function to use in pseudos for positionals function createpositionalpseudo( fn ) { return markfunction(function( argument ) { argument = +argument; return markfunction(function( seed, matches ) { var j, matchindexes = fn( [], seed.length, argument ), i = matchindexes.length; // match elements found at the specified indexes while ( i-- ) { if ( seed[ (j = matchindexes[i]) ] ) { seed[j] = !(matches[j] = seed[j]); } } }); }); } /** * utility function for retrieving the text value of an array of dom nodes * @param {array|element} elem */ gettext = sizzle.gettext = function( elem ) { var node, ret = "", i = 0, nodetype = elem.nodetype; if ( !nodetype ) { // if no nodetype, this is expected to be an array for ( ; (node = elem[i]); i++ ) { // do not traverse comment nodes ret += gettext( node ); } } else if ( nodetype === 1 || nodetype === 9 || nodetype === 11 ) { // use textcontent for elements // innertext usage removed for consistency of new lines (see #11153) if ( typeof elem.textcontent === "string" ) { return elem.textcontent; } else { // traverse its children for ( elem = elem.firstchild; elem; elem = elem.nextsibling ) { ret += gettext( elem ); } } } else if ( nodetype === 3 || nodetype === 4 ) { return elem.nodevalue; } // do not include comment or processing instruction nodes return ret; }; expr = sizzle.selectors = { // can be adjusted by the user cachelength: 50, createpseudo: markfunction, match: matchexpr, find: {}, relative: { ">": { dir: "parentnode", first: true }, " ": { dir: "parentnode" }, "+": { dir: "previoussibling", first: true }, "~": { dir: "previoussibling" } }, prefilter: { "attr": function( match ) { match[1] = match[1].replace( runescape, funescape ); // move the given value to match[3] whether quoted or unquoted match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); if ( match[2] === "~=" ) { match[3] = " " + match[3] + " "; } return match.slice( 0, 4 ); }, "child": function( match ) { /* matches from matchexpr["child"] 1 type (only|nth|...) 2 what (child|of-type) 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 4 xn-component of xn+y argument ([+-]?\d*n|) 5 sign of xn-component 6 x of xn-component 7 sign of y-component 8 y of y-component */ match[1] = match[1].tolowercase(); if ( match[1].slice( 0, 3 ) === "nth" ) { // nth-* requires argument if ( !match[3] ) { sizzle.error( match[0] ); } // numeric x and y parameters for expr.filter.child // remember that false/true cast respectively to 0/1 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); // other types prohibit arguments } else if ( match[3] ) { sizzle.error( match[0] ); } return match; }, "pseudo": function( match ) { var excess, unquoted = !match[5] && match[2]; if ( matchexpr["child"].test( match[0] ) ) { return null; } // accept quoted arguments as-is if ( match[4] ) { match[2] = match[4]; // strip excess characters from unquoted arguments } else if ( unquoted && rpseudo.test( unquoted ) && // get excess from tokenize (recursively) (excess = tokenize( unquoted, true )) && // advance to the next closing parenthesis (excess = unquoted.indexof( ")", unquoted.length - excess ) - unquoted.length) ) { // excess is a negative index match[0] = match[0].slice( 0, excess ); match[2] = unquoted.slice( 0, excess ); } // return only captures needed by the pseudo filter method (type and argument) return match.slice( 0, 3 ); } }, filter: { "tag": function( nodename ) { if ( nodename === "*" ) { return function() { return true; }; } nodename = nodename.replace( runescape, funescape ).tolowercase(); return function( elem ) { return elem.nodename && elem.nodename.tolowercase() === nodename; }; }, "class": function( classname ) { var pattern = classcache[ classname + " " ]; return pattern || (pattern = new regexp( "(^|" + whitespace + ")" + classname + "(" + whitespace + "|$)" )) && classcache( classname, function( elem ) { return pattern.test( elem.classname || (typeof elem.getattribute !== strundefined && elem.getattribute("class")) || "" ); }); }, "attr": function( name, operator, check ) { return function( elem ) { var result = sizzle.attr( elem, name ); if ( result == null ) { return operator === "!="; } if ( !operator ) { return true; } result += ""; return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexof( check ) === 0 : operator === "*=" ? check && result.indexof( check ) > -1 : operator === "$=" ? check && result.substr( result.length - check.length ) === check : operator === "~=" ? ( " " + result + " " ).indexof( check ) > -1 : operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" : false; }; }, "child": function( type, what, argument, first, last ) { var simple = type.slice( 0, 3 ) !== "nth", forward = type.slice( -4 ) !== "last", oftype = what === "of-type"; return first === 1 && last === 0 ? // shortcut for :nth-*(n) function( elem ) { return !!elem.parentnode; } : function( elem, context, xml ) { var cache, outercache, node, diff, nodeindex, start, dir = simple !== forward ? "nextsibling" : "previoussibling", parent = elem.parentnode, name = oftype && elem.nodename.tolowercase(), usecache = !xml && !oftype; if ( parent ) { // :(first|last|only)-(child|of-type) if ( simple ) { while ( dir ) { node = elem; while ( (node = node[ dir ]) ) { if ( oftype ? node.nodename.tolowercase() === name : node.nodetype === 1 ) { return false; } } // reverse direction for :only-* (if we haven't yet done so) start = dir = type === "only" && !start && "nextsibling"; } return true; } start = [ forward ? parent.firstchild : parent.lastchild ]; // non-xml :nth-child(...) stores cache data on `parent` if ( forward && usecache ) { // seek `elem` from a previously-cached index outercache = parent[ expando ] || (parent[ expando ] = {}); cache = outercache[ type ] || []; nodeindex = cache[0] === dirruns && cache[1]; diff = cache[0] === dirruns && cache[2]; node = nodeindex && parent.childnodes[ nodeindex ]; while ( (node = ++nodeindex && node && node[ dir ] || // fallback to seeking `elem` from the start (diff = nodeindex = 0) || start.pop()) ) { // when found, cache indexes on `parent` and break if ( node.nodetype === 1 && ++diff && node === elem ) { outercache[ type ] = [ dirruns, nodeindex, diff ]; break; } } // use previously-cached element index if available } else if ( usecache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { diff = cache[1]; // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) } else { // use the same loop as above to seek `elem` from the start while ( (node = ++nodeindex && node && node[ dir ] || (diff = nodeindex = 0) || start.pop()) ) { if ( ( oftype ? node.nodename.tolowercase() === name : node.nodetype === 1 ) && ++diff ) { // cache the index of each encountered element if ( usecache ) { (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; } if ( node === elem ) { break; } } } } // incorporate the offset, then check against cycle size diff -= last; return diff === first || ( diff % first === 0 && diff / first >= 0 ); } }; }, "pseudo": function( pseudo, argument ) { // pseudo-class names are case-insensitive // http://www.w3.org/tr/selectors/#pseudo-classes // prioritize by case sensitivity in case custom pseudos are added with uppercase letters // remember that setfilters inherits from pseudos var args, fn = expr.pseudos[ pseudo ] || expr.setfilters[ pseudo.tolowercase() ] || sizzle.error( "unsupported pseudo: " + pseudo ); // the user may use createpseudo to indicate that // arguments are needed to create the filter function // just as sizzle does if ( fn[ expando ] ) { return fn( argument ); } // but maintain support for old signatures if ( fn.length > 1 ) { args = [ pseudo, pseudo, "", argument ]; return expr.setfilters.hasownproperty( pseudo.tolowercase() ) ? markfunction(function( seed, matches ) { var idx, matched = fn( seed, argument ), i = matched.length; while ( i-- ) { idx = indexof.call( seed, matched[i] ); seed[ idx ] = !( matches[ idx ] = matched[i] ); } }) : function( elem ) { return fn( elem, 0, args ); }; } return fn; } }, pseudos: { // potentially complex pseudos "not": markfunction(function( selector ) { // trim the selector passed to compile // to avoid treating leading and trailing // spaces as combinators var input = [], results = [], matcher = compile( selector.replace( rtrim, "$1" ) ); return matcher[ expando ] ? markfunction(function( seed, matches, context, xml ) { var elem, unmatched = matcher( seed, null, xml, [] ), i = seed.length; // match elements unmatched by `matcher` while ( i-- ) { if ( (elem = unmatched[i]) ) { seed[i] = !(matches[i] = elem); } } }) : function( elem, context, xml ) { input[0] = elem; matcher( input, null, xml, results ); return !results.pop(); }; }), "has": markfunction(function( selector ) { return function( elem ) { return sizzle( selector, elem ).length > 0; }; }), "contains": markfunction(function( text ) { return function( elem ) { return ( elem.textcontent || elem.innertext || gettext( elem ) ).indexof( text ) > -1; }; }), // "whether an element is represented by a :lang() selector // is based solely on the element's language value // being equal to the identifier c, // or beginning with the identifier c immediately followed by "-". // the matching of c against the element's language value is performed case-insensitively. // the identifier c does not have to be a valid language name." // http://www.w3.org/tr/selectors/#lang-pseudo "lang": markfunction( function( lang ) { // lang value must be a valid identifider if ( !ridentifier.test(lang || "") ) { sizzle.error( "unsupported lang: " + lang ); } lang = lang.replace( runescape, funescape ).tolowercase(); return function( elem ) { var elemlang; do { if ( (elemlang = documentisxml ? elem.getattribute("xml:lang") || elem.getattribute("lang") : elem.lang) ) { elemlang = elemlang.tolowercase(); return elemlang === lang || elemlang.indexof( lang + "-" ) === 0; } } while ( (elem = elem.parentnode) && elem.nodetype === 1 ); return false; }; }), // miscellaneous "target": function( elem ) { var hash = window.location && window.location.hash; return hash && hash.slice( 1 ) === elem.id; }, "root": function( elem ) { return elem === docelem; }, "focus": function( elem ) { return elem === document.activeelement && (!document.hasfocus || document.hasfocus()) && !!(elem.type || elem.href || ~elem.tabindex); }, // boolean properties "enabled": function( elem ) { return elem.disabled === false; }, "disabled": function( elem ) { return elem.disabled === true; }, "checked": function( elem ) { // in css3, :checked should return both checked and selected elements // http://www.w3.org/tr/2011/rec-css3-selectors-20110929/#checked var nodename = elem.nodename.tolowercase(); return (nodename === "input" && !!elem.checked) || (nodename === "option" && !!elem.selected); }, "selected": function( elem ) { // accessing this property makes selected-by-default // options in safari work properly if ( elem.parentnode ) { elem.parentnode.selectedindex; } return elem.selected === true; }, // contents "empty": function( elem ) { // http://www.w3.org/tr/selectors/#empty-pseudo // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), // not comment, processing instructions, or others // thanks to diego perini for the nodename shortcut // greater than "@" means alpha characters (specifically not starting with "#" or "?") for ( elem = elem.firstchild; elem; elem = elem.nextsibling ) { if ( elem.nodename > "@" || elem.nodetype === 3 || elem.nodetype === 4 ) { return false; } } return true; }, "parent": function( elem ) { return !expr.pseudos["empty"]( elem ); }, // element/input types "header": function( elem ) { return rheader.test( elem.nodename ); }, "input": function( elem ) { return rinputs.test( elem.nodename ); }, "button": function( elem ) { var name = elem.nodename.tolowercase(); return name === "input" && elem.type === "button" || name === "button"; }, "text": function( elem ) { var attr; // ie6 and 7 will map elem.type to 'text' for new html5 types (search, etc) // use getattribute instead to test this case return elem.nodename.tolowercase() === "input" && elem.type === "text" && ( (attr = elem.getattribute("type")) == null || attr.tolowercase() === elem.type ); }, // position-in-collection "first": createpositionalpseudo(function() { return [ 0 ]; }), "last": createpositionalpseudo(function( matchindexes, length ) { return [ length - 1 ]; }), "eq": createpositionalpseudo(function( matchindexes, length, argument ) { return [ argument < 0 ? argument + length : argument ]; }), "even": createpositionalpseudo(function( matchindexes, length ) { var i = 0; for ( ; i < length; i += 2 ) { matchindexes.push( i ); } return matchindexes; }), "odd": createpositionalpseudo(function( matchindexes, length ) { var i = 1; for ( ; i < length; i += 2 ) { matchindexes.push( i ); } return matchindexes; }), "lt": createpositionalpseudo(function( matchindexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; --i >= 0; ) { matchindexes.push( i ); } return matchindexes; }), "gt": createpositionalpseudo(function( matchindexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; ++i < length; ) { matchindexes.push( i ); } return matchindexes; }) } }; // add button/input type pseudos for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { expr.pseudos[ i ] = createinputpseudo( i ); } for ( i in { submit: true, reset: true } ) { expr.pseudos[ i ] = createbuttonpseudo( i ); } function tokenize( selector, parseonly ) { var matched, match, tokens, type, sofar, groups, prefilters, cached = tokencache[ selector + " " ]; if ( cached ) { return parseonly ? 0 : cached.slice( 0 ); } sofar = selector; groups = []; prefilters = expr.prefilter; while ( sofar ) { // comma and first run if ( !matched || (match = rcomma.exec( sofar )) ) { if ( match ) { // don't consume trailing commas as valid sofar = sofar.slice( match[0].length ) || sofar; } groups.push( tokens = [] ); } matched = false; // combinators if ( (match = rcombinators.exec( sofar )) ) { matched = match.shift(); tokens.push( { value: matched, // cast descendant combinators to space type: match[0].replace( rtrim, " " ) } ); sofar = sofar.slice( matched.length ); } // filters for ( type in expr.filter ) { if ( (match = matchexpr[ type ].exec( sofar )) && (!prefilters[ type ] || (match = prefilters[ type ]( match ))) ) { matched = match.shift(); tokens.push( { value: matched, type: type, matches: match } ); sofar = sofar.slice( matched.length ); } } if ( !matched ) { break; } } // return the length of the invalid excess // if we're just parsing // otherwise, throw an error or return tokens return parseonly ? sofar.length : sofar ? sizzle.error( selector ) : // cache the tokens tokencache( selector, groups ).slice( 0 ); } function toselector( tokens ) { var i = 0, len = tokens.length, selector = ""; for ( ; i < len; i++ ) { selector += tokens[i].value; } return selector; } function addcombinator( matcher, combinator, base ) { var dir = combinator.dir, checknonelements = base && combinator.dir === "parentnode", donename = done++; return combinator.first ? // check against closest ancestor/preceding element function( elem, context, xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodetype === 1 || checknonelements ) { return matcher( elem, context, xml ); } } } : // check against all ancestor/preceding elements function( elem, context, xml ) { var data, cache, outercache, dirkey = dirruns + " " + donename; // we can't set arbitrary data on xml nodes, so they don't benefit from dir caching if ( xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodetype === 1 || checknonelements ) { if ( matcher( elem, context, xml ) ) { return true; } } } } else { while ( (elem = elem[ dir ]) ) { if ( elem.nodetype === 1 || checknonelements ) { outercache = elem[ expando ] || (elem[ expando ] = {}); if ( (cache = outercache[ dir ]) && cache[0] === dirkey ) { if ( (data = cache[1]) === true || data === cachedruns ) { return data === true; } } else { cache = outercache[ dir ] = [ dirkey ]; cache[1] = matcher( elem, context, xml ) || cachedruns; if ( cache[1] === true ) { return true; } } } } } }; } function elementmatcher( matchers ) { return matchers.length > 1 ? function( elem, context, xml ) { var i = matchers.length; while ( i-- ) { if ( !matchers[i]( elem, context, xml ) ) { return false; } } return true; } : matchers[0]; } function condense( unmatched, map, filter, context, xml ) { var elem, newunmatched = [], i = 0, len = unmatched.length, mapped = map != null; for ( ; i < len; i++ ) { if ( (elem = unmatched[i]) ) { if ( !filter || filter( elem, context, xml ) ) { newunmatched.push( elem ); if ( mapped ) { map.push( i ); } } } } return newunmatched; } function setmatcher( prefilter, selector, matcher, postfilter, postfinder, postselector ) { if ( postfilter && !postfilter[ expando ] ) { postfilter = setmatcher( postfilter ); } if ( postfinder && !postfinder[ expando ] ) { postfinder = setmatcher( postfinder, postselector ); } return markfunction(function( seed, results, context, xml ) { var temp, i, elem, premap = [], postmap = [], preexisting = results.length, // get initial elements from seed or context elems = seed || multiplecontexts( selector || "*", context.nodetype ? [ context ] : context, [] ), // prefilter to get matcher input, preserving a map for seed-results synchronization matcherin = prefilter && ( seed || !selector ) ? condense( elems, premap, prefilter, context, xml ) : elems, matcherout = matcher ? // if we have a postfinder, or filtered seed, or non-seed postfilter or preexisting results, postfinder || ( seed ? prefilter : preexisting || postfilter ) ? // ...intermediate processing is necessary [] : // ...otherwise use results directly results : matcherin; // find primary matches if ( matcher ) { matcher( matcherin, matcherout, context, xml ); } // apply postfilter if ( postfilter ) { temp = condense( matcherout, postmap ); postfilter( temp, [], context, xml ); // un-match failing elements by moving them back to matcherin i = temp.length; while ( i-- ) { if ( (elem = temp[i]) ) { matcherout[ postmap[i] ] = !(matcherin[ postmap[i] ] = elem); } } } if ( seed ) { if ( postfinder || prefilter ) { if ( postfinder ) { // get the final matcherout by condensing this intermediate into postfinder contexts temp = []; i = matcherout.length; while ( i-- ) { if ( (elem = matcherout[i]) ) { // restore matcherin since elem is not yet a final match temp.push( (matcherin[i] = elem) ); } } postfinder( null, (matcherout = []), temp, xml ); } // move matched elements from seed to results to keep them synchronized i = matcherout.length; while ( i-- ) { if ( (elem = matcherout[i]) && (temp = postfinder ? indexof.call( seed, elem ) : premap[i]) > -1 ) { seed[temp] = !(results[temp] = elem); } } } // add elements to results, through postfinder if defined } else { matcherout = condense( matcherout === results ? matcherout.splice( preexisting, matcherout.length ) : matcherout ); if ( postfinder ) { postfinder( null, results, matcherout, xml ); } else { push.apply( results, matcherout ); } } }); } function matcherfromtokens( tokens ) { var checkcontext, matcher, j, len = tokens.length, leadingrelative = expr.relative[ tokens[0].type ], implicitrelative = leadingrelative || expr.relative[" "], i = leadingrelative ? 1 : 0, // the foundational matcher ensures that elements are reachable from top-level context(s) matchcontext = addcombinator( function( elem ) { return elem === checkcontext; }, implicitrelative, true ), matchanycontext = addcombinator( function( elem ) { return indexof.call( checkcontext, elem ) > -1; }, implicitrelative, true ), matchers = [ function( elem, context, xml ) { return ( !leadingrelative && ( xml || context !== outermostcontext ) ) || ( (checkcontext = context).nodetype ? matchcontext( elem, context, xml ) : matchanycontext( elem, context, xml ) ); } ]; for ( ; i < len; i++ ) { if ( (matcher = expr.relative[ tokens[i].type ]) ) { matchers = [ addcombinator(elementmatcher( matchers ), matcher) ]; } else { matcher = expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); // return special upon seeing a positional matcher if ( matcher[ expando ] ) { // find the next relative operator (if any) for proper handling j = ++i; for ( ; j < len; j++ ) { if ( expr.relative[ tokens[j].type ] ) { break; } } return setmatcher( i > 1 && elementmatcher( matchers ), i > 1 && toselector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ), matcher, i < j && matcherfromtokens( tokens.slice( i, j ) ), j < len && matcherfromtokens( (tokens = tokens.slice( j )) ), j < len && toselector( tokens ) ); } matchers.push( matcher ); } } return elementmatcher( matchers ); } function matcherfromgroupmatchers( elementmatchers, setmatchers ) { // a counter to specify which element is currently being matched var matchercachedruns = 0, byset = setmatchers.length > 0, byelement = elementmatchers.length > 0, supermatcher = function( seed, context, xml, results, expandcontext ) { var elem, j, matcher, setmatched = [], matchedcount = 0, i = "0", unmatched = seed && [], outermost = expandcontext != null, contextbackup = outermostcontext, // we must always have either seed elements or context elems = seed || byelement && expr.find["tag"]( "*", expandcontext && context.parentnode || context ), // nested matchers should use non-integer dirruns dirrunsunique = (dirruns += contextbackup == null ? 1 : math.e); if ( outermost ) { outermostcontext = context !== document && context; cachedruns = matchercachedruns; } // add elements passing elementmatchers directly to results for ( ; (elem = elems[i]) != null; i++ ) { if ( byelement && elem ) { for ( j = 0; (matcher = elementmatchers[j]); j++ ) { if ( matcher( elem, context, xml ) ) { results.push( elem ); break; } } if ( outermost ) { dirruns = dirrunsunique; cachedruns = ++matchercachedruns; } } // track unmatched elements for set filters if ( byset ) { // they will have gone through all possible matchers if ( (elem = !matcher && elem) ) { matchedcount--; } // lengthen the array for every element, matched or not if ( seed ) { unmatched.push( elem ); } } } // apply set filters to unmatched elements // `i` starts as a string, so matchedcount would equal "00" if there are no elements matchedcount += i; if ( byset && i !== matchedcount ) { for ( j = 0; (matcher = setmatchers[j]); j++ ) { matcher( unmatched, setmatched, context, xml ); } if ( seed ) { // reintegrate element matches to eliminate the need for sorting if ( matchedcount > 0 ) { while ( i-- ) { if ( !(unmatched[i] || setmatched[i]) ) { setmatched[i] = pop.call( results ); } } } // discard index placeholder values to get only actual matches setmatched = condense( setmatched ); } // add matches to results push.apply( results, setmatched ); // seedless set matches succeeding multiple successful matchers stipulate sorting if ( outermost && !seed && setmatched.length > 0 && ( matchedcount + setmatchers.length ) > 1 ) { sizzle.uniquesort( results ); } } // override manipulation of globals by nested matchers if ( outermost ) { dirruns = dirrunsunique; outermostcontext = contextbackup; } return unmatched; }; return byset ? markfunction( supermatcher ) : supermatcher; } compile = sizzle.compile = function( selector, group /* internal use only */ ) { var i, setmatchers = [], elementmatchers = [], cached = compilercache[ selector + " " ]; if ( !cached ) { // generate a function of recursive functions that can be used to check each element if ( !group ) { group = tokenize( selector ); } i = group.length; while ( i-- ) { cached = matcherfromtokens( group[i] ); if ( cached[ expando ] ) { setmatchers.push( cached ); } else { elementmatchers.push( cached ); } } // cache the compiled function cached = compilercache( selector, matcherfromgroupmatchers( elementmatchers, setmatchers ) ); } return cached; }; function multiplecontexts( selector, contexts, results ) { var i = 0, len = contexts.length; for ( ; i < len; i++ ) { sizzle( selector, contexts[i], results ); } return results; } function select( selector, context, results, seed ) { var i, tokens, token, type, find, match = tokenize( selector ); if ( !seed ) { // try to minimize operations if there is only one group if ( match.length === 1 ) { // take a shortcut and set the context if the root selector is an id tokens = match[0] = match[0].slice( 0 ); if ( tokens.length > 2 && (token = tokens[0]).type === "id" && context.nodetype === 9 && !documentisxml && expr.relative[ tokens[1].type ] ) { context = expr.find["id"]( token.matches[0].replace( runescape, funescape ), context )[0]; if ( !context ) { return results; } selector = selector.slice( tokens.shift().value.length ); } // fetch a seed set for right-to-left matching for ( i = matchexpr["needscontext"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) { token = tokens[i]; // abort if we hit a combinator if ( expr.relative[ (type = token.type) ] ) { break; } if ( (find = expr.find[ type ]) ) { // search, expanding context for leading sibling combinators if ( (seed = find( token.matches[0].replace( runescape, funescape ), rsibling.test( tokens[0].type ) && context.parentnode || context )) ) { // if seed is empty or no tokens remain, we can return early tokens.splice( i, 1 ); selector = seed.length && toselector( tokens ); if ( !selector ) { push.apply( results, slice.call( seed, 0 ) ); return results; } break; } } } } } // compile and execute a filtering function // provide `match` to avoid retokenization if we modified the selector above compile( selector, match )( seed, context, documentisxml, results, rsibling.test( selector ) ); return results; } // deprecated expr.pseudos["nth"] = expr.pseudos["eq"]; // easy api for creating new setfilters function setfilters() {} expr.filters = setfilters.prototype = expr.pseudos; expr.setfilters = new setfilters(); // initialize with the default document setdocument(); // override sizzle attribute retrieval sizzle.attr = jquery.attr; jquery.find = sizzle; jquery.expr = sizzle.selectors; jquery.expr[":"] = jquery.expr.pseudos; jquery.unique = sizzle.uniquesort; jquery.text = sizzle.gettext; jquery.isxmldoc = sizzle.isxml; jquery.contains = sizzle.contains; })( window ); var runtil = /until$/, rparentsprev = /^(?:parents|prev(?:until|all))/, issimple = /^.[^:#\[\.,]*$/, rneedscontext = jquery.expr.match.needscontext, // methods guaranteed to produce a unique set when starting from a unique set guaranteedunique = { children: true, contents: true, next: true, prev: true }; jquery.fn.extend({ find: function( selector ) { var i, ret, self; if ( typeof selector !== "string" ) { self = this; return this.pushstack( jquery( selector ).filter(function() { for ( i = 0; i < self.length; i++ ) { if ( jquery.contains( self[ i ], this ) ) { return true; } } }) ); } ret = []; for ( i = 0; i < this.length; i++ ) { jquery.find( selector, this[ i ], ret ); } // needed because $( selector, context ) becomes $( context ).find( selector ) ret = this.pushstack( jquery.unique( ret ) ); ret.selector = ( this.selector ? this.selector + " " : "" ) + selector; return ret; }, has: function( target ) { var i, targets = jquery( target, this ), len = targets.length; return this.filter(function() { for ( i = 0; i < len; i++ ) { if ( jquery.contains( this, targets[i] ) ) { return true; } } }); }, not: function( selector ) { return this.pushstack( winnow(this, selector, false) ); }, filter: function( selector ) { return this.pushstack( winnow(this, selector, true) ); }, is: function( selector ) { return !!selector && ( typeof selector === "string" ? // if this is a positional/relative selector, check membership in the returned set // so $("p:first").is("p:last") won't return true for a doc with two "p". rneedscontext.test( selector ) ? jquery( selector, this.context ).index( this[0] ) >= 0 : jquery.filter( selector, this ).length > 0 : this.filter( selector ).length > 0 ); }, closest: function( selectors, context ) { var cur, i = 0, l = this.length, ret = [], pos = rneedscontext.test( selectors ) || typeof selectors !== "string" ? jquery( selectors, context || this.context ) : 0; for ( ; i < l; i++ ) { cur = this[i]; while ( cur && cur.ownerdocument && cur !== context && cur.nodetype !== 11 ) { if ( pos ? pos.index(cur) > -1 : jquery.find.matchesselector(cur, selectors) ) { ret.push( cur ); break; } cur = cur.parentnode; } } return this.pushstack( ret.length > 1 ? jquery.unique( ret ) : ret ); }, // determine the position of an element within // the matched set of elements index: function( elem ) { // no argument, return index in parent if ( !elem ) { return ( this[0] && this[0].parentnode ) ? this.first().prevall().length : -1; } // index in selector if ( typeof elem === "string" ) { return jquery.inarray( this[0], jquery( elem ) ); } // locate the position of the desired element return jquery.inarray( // if it receives a jquery object, the first element is used elem.jquery ? elem[0] : elem, this ); }, add: function( selector, context ) { var set = typeof selector === "string" ? jquery( selector, context ) : jquery.makearray( selector && selector.nodetype ? [ selector ] : selector ), all = jquery.merge( this.get(), set ); return this.pushstack( jquery.unique(all) ); }, addback: function( selector ) { return this.add( selector == null ? this.prevobject : this.prevobject.filter(selector) ); } }); jquery.fn.andself = jquery.fn.addback; function sibling( cur, dir ) { do { cur = cur[ dir ]; } while ( cur && cur.nodetype !== 1 ); return cur; } jquery.each({ parent: function( elem ) { var parent = elem.parentnode; return parent && parent.nodetype !== 11 ? parent : null; }, parents: function( elem ) { return jquery.dir( elem, "parentnode" ); }, parentsuntil: function( elem, i, until ) { return jquery.dir( elem, "parentnode", until ); }, next: function( elem ) { return sibling( elem, "nextsibling" ); }, prev: function( elem ) { return sibling( elem, "previoussibling" ); }, nextall: function( elem ) { return jquery.dir( elem, "nextsibling" ); }, prevall: function( elem ) { return jquery.dir( elem, "previoussibling" ); }, nextuntil: function( elem, i, until ) { return jquery.dir( elem, "nextsibling", until ); }, prevuntil: function( elem, i, until ) { return jquery.dir( elem, "previoussibling", until ); }, siblings: function( elem ) { return jquery.sibling( ( elem.parentnode || {} ).firstchild, elem ); }, children: function( elem ) { return jquery.sibling( elem.firstchild ); }, contents: function( elem ) { return jquery.nodename( elem, "iframe" ) ? elem.contentdocument || elem.contentwindow.document : jquery.merge( [], elem.childnodes ); } }, function( name, fn ) { jquery.fn[ name ] = function( until, selector ) { var ret = jquery.map( this, fn, until ); if ( !runtil.test( name ) ) { selector = until; } if ( selector && typeof selector === "string" ) { ret = jquery.filter( selector, ret ); } ret = this.length > 1 && !guaranteedunique[ name ] ? jquery.unique( ret ) : ret; if ( this.length > 1 && rparentsprev.test( name ) ) { ret = ret.reverse(); } return this.pushstack( ret ); }; }); jquery.extend({ filter: function( expr, elems, not ) { if ( not ) { expr = ":not(" + expr + ")"; } return elems.length === 1 ? jquery.find.matchesselector(elems[0], expr) ? [ elems[0] ] : [] : jquery.find.matches(expr, elems); }, dir: function( elem, dir, until ) { var matched = [], cur = elem[ dir ]; while ( cur && cur.nodetype !== 9 && (until === undefined || cur.nodetype !== 1 || !jquery( cur ).is( until )) ) { if ( cur.nodetype === 1 ) { matched.push( cur ); } cur = cur[dir]; } return matched; }, sibling: function( n, elem ) { var r = []; for ( ; n; n = n.nextsibling ) { if ( n.nodetype === 1 && n !== elem ) { r.push( n ); } } return r; } }); // implement the identical functionality for filter and not function winnow( elements, qualifier, keep ) { // can't pass null or undefined to indexof in firefox 4 // set to 0 to skip string check qualifier = qualifier || 0; if ( jquery.isfunction( qualifier ) ) { return jquery.grep(elements, function( elem, i ) { var retval = !!qualifier.call( elem, i, elem ); return retval === keep; }); } else if ( qualifier.nodetype ) { return jquery.grep(elements, function( elem ) { return ( elem === qualifier ) === keep; }); } else if ( typeof qualifier === "string" ) { var filtered = jquery.grep(elements, function( elem ) { return elem.nodetype === 1; }); if ( issimple.test( qualifier ) ) { return jquery.filter(qualifier, filtered, !keep); } else { qualifier = jquery.filter( qualifier, filtered ); } } return jquery.grep(elements, function( elem ) { return ( jquery.inarray( elem, qualifier ) >= 0 ) === keep; }); } function createsafefragment( document ) { var list = nodenames.split( "|" ), safefrag = document.createdocumentfragment(); if ( safefrag.createelement ) { while ( list.length ) { safefrag.createelement( list.pop() ); } } return safefrag; } var nodenames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", rinlinejquery = / jquery\d+="(?:null|\d+)"/g, rnoshimcache = new regexp("<(?:" + nodenames + ")[\\s/>]", "i"), rleadingwhitespace = /^\s+/, rxhtmltag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, rtagname = /<([\w:]+)/, rtbody = /\s*$/g, // we have to close these tags to support xhtml (#13200) wrapmap = { option: [ 1, "" ], legend: [ 1, "
", "
" ], area: [ 1, "", "" ], param: [ 1, "", "" ], thead: [ 1, "", "
" ], tr: [ 2, "", "
" ], col: [ 2, "", "
" ], td: [ 3, "", "
" ], // ie6-8 can't serialize link, script, style, or any html5 (noscope) tags, // unless wrapped in a div with non-breaking characters in front of it. _default: jquery.support.htmlserialize ? [ 0, "", "" ] : [ 1, "x
", "
" ] }, safefragment = createsafefragment( document ), fragmentdiv = safefragment.appendchild( document.createelement("div") ); wrapmap.optgroup = wrapmap.option; wrapmap.tbody = wrapmap.tfoot = wrapmap.colgroup = wrapmap.caption = wrapmap.thead; wrapmap.th = wrapmap.td; jquery.fn.extend({ text: function( value ) { return jquery.access( this, function( value ) { return value === undefined ? jquery.text( this ) : this.empty().append( ( this[0] && this[0].ownerdocument || document ).createtextnode( value ) ); }, null, value, arguments.length ); }, wrapall: function( html ) { if ( jquery.isfunction( html ) ) { return this.each(function(i) { jquery(this).wrapall( html.call(this, i) ); }); } if ( this[0] ) { // the elements to wrap the target around var wrap = jquery( html, this[0].ownerdocument ).eq(0).clone(true); if ( this[0].parentnode ) { wrap.insertbefore( this[0] ); } wrap.map(function() { var elem = this; while ( elem.firstchild && elem.firstchild.nodetype === 1 ) { elem = elem.firstchild; } return elem; }).append( this ); } return this; }, wrapinner: function( html ) { if ( jquery.isfunction( html ) ) { return this.each(function(i) { jquery(this).wrapinner( html.call(this, i) ); }); } return this.each(function() { var self = jquery( this ), contents = self.contents(); if ( contents.length ) { contents.wrapall( html ); } else { self.append( html ); } }); }, wrap: function( html ) { var isfunction = jquery.isfunction( html ); return this.each(function(i) { jquery( this ).wrapall( isfunction ? html.call(this, i) : html ); }); }, unwrap: function() { return this.parent().each(function() { if ( !jquery.nodename( this, "body" ) ) { jquery( this ).replacewith( this.childnodes ); } }).end(); }, append: function() { return this.dommanip(arguments, true, function( elem ) { if ( this.nodetype === 1 || this.nodetype === 11 || this.nodetype === 9 ) { this.appendchild( elem ); } }); }, prepend: function() { return this.dommanip(arguments, true, function( elem ) { if ( this.nodetype === 1 || this.nodetype === 11 || this.nodetype === 9 ) { this.insertbefore( elem, this.firstchild ); } }); }, before: function() { return this.dommanip( arguments, false, function( elem ) { if ( this.parentnode ) { this.parentnode.insertbefore( elem, this ); } }); }, after: function() { return this.dommanip( arguments, false, function( elem ) { if ( this.parentnode ) { this.parentnode.insertbefore( elem, this.nextsibling ); } }); }, // keepdata is for internal use only--do not document remove: function( selector, keepdata ) { var elem, i = 0; for ( ; (elem = this[i]) != null; i++ ) { if ( !selector || jquery.filter( selector, [ elem ] ).length > 0 ) { if ( !keepdata && elem.nodetype === 1 ) { jquery.cleandata( getall( elem ) ); } if ( elem.parentnode ) { if ( keepdata && jquery.contains( elem.ownerdocument, elem ) ) { setglobaleval( getall( elem, "script" ) ); } elem.parentnode.removechild( elem ); } } } return this; }, empty: function() { var elem, i = 0; for ( ; (elem = this[i]) != null; i++ ) { // remove element nodes and prevent memory leaks if ( elem.nodetype === 1 ) { jquery.cleandata( getall( elem, false ) ); } // remove any remaining nodes while ( elem.firstchild ) { elem.removechild( elem.firstchild ); } // if this is a select, ensure that it displays empty (#12336) // support: ie<9 if ( elem.options && jquery.nodename( elem, "select" ) ) { elem.options.length = 0; } } return this; }, clone: function( dataandevents, deepdataandevents ) { dataandevents = dataandevents == null ? false : dataandevents; deepdataandevents = deepdataandevents == null ? dataandevents : deepdataandevents; return this.map( function () { return jquery.clone( this, dataandevents, deepdataandevents ); }); }, html: function( value ) { return jquery.access( this, function( value ) { var elem = this[0] || {}, i = 0, l = this.length; if ( value === undefined ) { return elem.nodetype === 1 ? elem.innerhtml.replace( rinlinejquery, "" ) : undefined; } // see if we can take a shortcut and just use innerhtml if ( typeof value === "string" && !rnoinnerhtml.test( value ) && ( jquery.support.htmlserialize || !rnoshimcache.test( value ) ) && ( jquery.support.leadingwhitespace || !rleadingwhitespace.test( value ) ) && !wrapmap[ ( rtagname.exec( value ) || ["", ""] )[1].tolowercase() ] ) { value = value.replace( rxhtmltag, "<$1>" ); try { for (; i < l; i++ ) { // remove element nodes and prevent memory leaks elem = this[i] || {}; if ( elem.nodetype === 1 ) { jquery.cleandata( getall( elem, false ) ); elem.innerhtml = value; } } elem = 0; // if using innerhtml throws an exception, use the fallback method } catch(e) {} } if ( elem ) { this.empty().append( value ); } }, null, value, arguments.length ); }, replacewith: function( value ) { var isfunc = jquery.isfunction( value ); // make sure that the elements are removed from the dom before they are inserted // this can help fix replacing a parent with child elements if ( !isfunc && typeof value !== "string" ) { value = jquery( value ).not( this ).detach(); } return this.dommanip( [ value ], true, function( elem ) { var next = this.nextsibling, parent = this.parentnode; if ( parent && this.nodetype === 1 || this.nodetype === 11 ) { jquery( this ).remove(); if ( next ) { next.parentnode.insertbefore( elem, next ); } else { parent.appendchild( elem ); } } }); }, detach: function( selector ) { return this.remove( selector, true ); }, dommanip: function( args, table, callback ) { // flatten any nested arrays args = core_concat.apply( [], args ); var fragment, first, scripts, hasscripts, node, doc, i = 0, l = this.length, set = this, inoclone = l - 1, value = args[0], isfunction = jquery.isfunction( value ); // we can't clonenode fragments that contain checked, in webkit if ( isfunction || !( l <= 1 || typeof value !== "string" || jquery.support.checkclone || !rchecked.test( value ) ) ) { return this.each(function( index ) { var self = set.eq( index ); if ( isfunction ) { args[0] = value.call( this, index, table ? self.html() : undefined ); } self.dommanip( args, table, callback ); }); } if ( l ) { fragment = jquery.buildfragment( args, this[ 0 ].ownerdocument, false, this ); first = fragment.firstchild; if ( fragment.childnodes.length === 1 ) { fragment = first; } if ( first ) { table = table && jquery.nodename( first, "tr" ); scripts = jquery.map( getall( fragment, "script" ), disablescript ); hasscripts = scripts.length; // use the original fragment for the last item instead of the first because it can end up // being emptied incorrectly in certain situations (#8070). for ( ; i < l; i++ ) { node = fragment; if ( i !== inoclone ) { node = jquery.clone( node, true, true ); // keep references to cloned scripts for later restoration if ( hasscripts ) { jquery.merge( scripts, getall( node, "script" ) ); } } callback.call( table && jquery.nodename( this[i], "table" ) ? findorappend( this[i], "tbody" ) : this[i], node, i ); } if ( hasscripts ) { doc = scripts[ scripts.length - 1 ].ownerdocument; // reenable scripts jquery.map( scripts, restorescript ); // evaluate executable scripts on first document insertion for ( i = 0; i < hasscripts; i++ ) { node = scripts[ i ]; if ( rscripttype.test( node.type || "" ) && !jquery._data( node, "globaleval" ) && jquery.contains( doc, node ) ) { if ( node.src ) { // hope ajax is available... jquery.ajax({ url: node.src, type: "get", datatype: "script", async: false, global: false, "throws": true }); } else { jquery.globaleval( ( node.text || node.textcontent || node.innerhtml || "" ).replace( rcleanscript, "" ) ); } } } } // fix #11809: avoid leaking memory fragment = first = null; } } return this; } }); function findorappend( elem, tag ) { return elem.getelementsbytagname( tag )[0] || elem.appendchild( elem.ownerdocument.createelement( tag ) ); } // replace/restore the type attribute of script elements for safe dom manipulation function disablescript( elem ) { var attr = elem.getattributenode("type"); elem.type = ( attr && attr.specified ) + "/" + elem.type; return elem; } function restorescript( elem ) { var match = rscripttypemasked.exec( elem.type ); if ( match ) { elem.type = match[1]; } else { elem.removeattribute("type"); } return elem; } // mark scripts as having already been evaluated function setglobaleval( elems, refelements ) { var elem, i = 0; for ( ; (elem = elems[i]) != null; i++ ) { jquery._data( elem, "globaleval", !refelements || jquery._data( refelements[i], "globaleval" ) ); } } function clonecopyevent( src, dest ) { if ( dest.nodetype !== 1 || !jquery.hasdata( src ) ) { return; } var type, i, l, olddata = jquery._data( src ), curdata = jquery._data( dest, olddata ), events = olddata.events; if ( events ) { delete curdata.handle; curdata.events = {}; for ( type in events ) { for ( i = 0, l = events[ type ].length; i < l; i++ ) { jquery.event.add( dest, type, events[ type ][ i ] ); } } } // make the cloned public data object a copy from the original if ( curdata.data ) { curdata.data = jquery.extend( {}, curdata.data ); } } function fixclonenodeissues( src, dest ) { var nodename, data, e; // we do not need to do anything for non-elements if ( dest.nodetype !== 1 ) { return; } nodename = dest.nodename.tolowercase(); // ie6-8 copies events bound via attachevent when using clonenode. if ( !jquery.support.nocloneevent && dest[ jquery.expando ] ) { data = jquery._data( dest ); for ( e in data.events ) { jquery.removeevent( dest, e, data.handle ); } // event data gets referenced instead of copied if the expando gets copied too dest.removeattribute( jquery.expando ); } // ie blanks contents when cloning scripts, and tries to evaluate newly-set text if ( nodename === "script" && dest.text !== src.text ) { disablescript( dest ).text = src.text; restorescript( dest ); // ie6-10 improperly clones children of object elements using classid. // ie10 throws nomodificationallowederror if parent is null, #12132. } else if ( nodename === "object" ) { if ( dest.parentnode ) { dest.outerhtml = src.outerhtml; } // this path appears unavoidable for ie9. when cloning an object // element in ie9, the outerhtml strategy above is not sufficient. // if the src has innerhtml and the destination does not, // copy the src.innerhtml into the dest.innerhtml. #10324 if ( jquery.support.html5clone && ( src.innerhtml && !jquery.trim(dest.innerhtml) ) ) { dest.innerhtml = src.innerhtml; } } else if ( nodename === "input" && manipulation_rcheckabletype.test( src.type ) ) { // ie6-8 fails to persist the checked state of a cloned checkbox // or radio button. worse, ie6-7 fail to give the cloned element // a checked appearance if the defaultchecked value isn't also set dest.defaultchecked = dest.checked = src.checked; // ie6-7 get confused and end up setting the value of a cloned // checkbox/radio button to an empty string instead of "on" if ( dest.value !== src.value ) { dest.value = src.value; } // ie6-8 fails to return the selected option to the default selected // state when cloning options } else if ( nodename === "option" ) { dest.defaultselected = dest.selected = src.defaultselected; // ie6-8 fails to set the defaultvalue to the correct value when // cloning other types of input fields } else if ( nodename === "input" || nodename === "textarea" ) { dest.defaultvalue = src.defaultvalue; } } jquery.each({ appendto: "append", prependto: "prepend", insertbefore: "before", insertafter: "after", replaceall: "replacewith" }, function( name, original ) { jquery.fn[ name ] = function( selector ) { var elems, i = 0, ret = [], insert = jquery( selector ), last = insert.length - 1; for ( ; i <= last; i++ ) { elems = i === last ? this : this.clone(true); jquery( insert[i] )[ original ]( elems ); // modern browsers can apply jquery collections as arrays, but oldie needs a .get() core_push.apply( ret, elems.get() ); } return this.pushstack( ret ); }; }); function getall( context, tag ) { var elems, elem, i = 0, found = typeof context.getelementsbytagname !== "undefined" ? context.getelementsbytagname( tag || "*" ) : typeof context.queryselectorall !== "undefined" ? context.queryselectorall( tag || "*" ) : undefined; if ( !found ) { for ( found = [], elems = context.childnodes || context; (elem = elems[i]) != null; i++ ) { if ( !tag || jquery.nodename( elem, tag ) ) { found.push( elem ); } else { jquery.merge( found, getall( elem, tag ) ); } } } return tag === undefined || tag && jquery.nodename( context, tag ) ? jquery.merge( [ context ], found ) : found; } // used in buildfragment, fixes the defaultchecked property function fixdefaultchecked( elem ) { if ( manipulation_rcheckabletype.test( elem.type ) ) { elem.defaultchecked = elem.checked; } } jquery.extend({ clone: function( elem, dataandevents, deepdataandevents ) { var destelements, srcelements, node, i, clone, inpage = jquery.contains( elem.ownerdocument, elem ); if ( jquery.support.html5clone || jquery.isxmldoc(elem) || !rnoshimcache.test( "<" + elem.nodename + ">" ) ) { clone = elem.clonenode( true ); // ie<=8 does not properly clone detached, unknown element nodes } else { fragmentdiv.innerhtml = elem.outerhtml; fragmentdiv.removechild( clone = fragmentdiv.firstchild ); } if ( (!jquery.support.nocloneevent || !jquery.support.noclonechecked) && (elem.nodetype === 1 || elem.nodetype === 11) && !jquery.isxmldoc(elem) ) { // we eschew sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 destelements = getall( clone ); srcelements = getall( elem ); // fix all ie cloning issues for ( i = 0; (node = srcelements[i]) != null; ++i ) { // ensure that the destination node is not null; fixes #9587 if ( destelements[i] ) { fixclonenodeissues( node, destelements[i] ); } } } // copy the events from the original to the clone if ( dataandevents ) { if ( deepdataandevents ) { srcelements = srcelements || getall( elem ); destelements = destelements || getall( clone ); for ( i = 0; (node = srcelements[i]) != null; i++ ) { clonecopyevent( node, destelements[i] ); } } else { clonecopyevent( elem, clone ); } } // preserve script evaluation history destelements = getall( clone, "script" ); if ( destelements.length > 0 ) { setglobaleval( destelements, !inpage && getall( elem, "script" ) ); } destelements = srcelements = node = null; // return the cloned set return clone; }, buildfragment: function( elems, context, scripts, selection ) { var contains, elem, tag, tmp, wrap, tbody, j, l = elems.length, // ensure a safe fragment safe = createsafefragment( context ), nodes = [], i = 0; for ( ; i < l; i++ ) { elem = elems[ i ]; if ( elem || elem === 0 ) { // add nodes directly if ( jquery.type( elem ) === "object" ) { jquery.merge( nodes, elem.nodetype ? [ elem ] : elem ); // convert non-html into a text node } else if ( !rhtml.test( elem ) ) { nodes.push( context.createtextnode( elem ) ); // convert html into dom nodes } else { tmp = tmp || safe.appendchild( context.createelement("div") ); // deserialize a standard representation tag = ( rtagname.exec( elem ) || ["", ""] )[1].tolowercase(); wrap = wrapmap[ tag ] || wrapmap._default; tmp.innerhtml = wrap[1] + elem.replace( rxhtmltag, "<$1>" ) + wrap[2]; // descend through wrappers to the right content j = wrap[0]; while ( j-- ) { tmp = tmp.lastchild; } // manually add leading whitespace removed by ie if ( !jquery.support.leadingwhitespace && rleadingwhitespace.test( elem ) ) { nodes.push( context.createtextnode( rleadingwhitespace.exec( elem )[0] ) ); } // remove ie's autoinserted from table fragments if ( !jquery.support.tbody ) { // string was a , *may* have spurious elem = tag === "table" && !rtbody.test( elem ) ? tmp.firstchild : // string was a bare or wrap[1] === "
" && !rtbody.test( elem ) ? tmp : 0; j = elem && elem.childnodes.length; while ( j-- ) { if ( jquery.nodename( (tbody = elem.childnodes[j]), "tbody" ) && !tbody.childnodes.length ) { elem.removechild( tbody ); } } } jquery.merge( nodes, tmp.childnodes ); // fix #12392 for webkit and ie > 9 tmp.textcontent = ""; // fix #12392 for oldie while ( tmp.firstchild ) { tmp.removechild( tmp.firstchild ); } // remember the top-level container for proper cleanup tmp = safe.lastchild; } } } // fix #11356: clear elements from fragment if ( tmp ) { safe.removechild( tmp ); } // reset defaultchecked for any radios and checkboxes // about to be appended to the dom in ie 6/7 (#8060) if ( !jquery.support.appendchecked ) { jquery.grep( getall( nodes, "input" ), fixdefaultchecked ); } i = 0; while ( (elem = nodes[ i++ ]) ) { // #4087 - if origin and destination elements are the same, and this is // that element, do not do anything if ( selection && jquery.inarray( elem, selection ) !== -1 ) { continue; } contains = jquery.contains( elem.ownerdocument, elem ); // append to fragment tmp = getall( safe.appendchild( elem ), "script" ); // preserve script evaluation history if ( contains ) { setglobaleval( tmp ); } // capture executables if ( scripts ) { j = 0; while ( (elem = tmp[ j++ ]) ) { if ( rscripttype.test( elem.type || "" ) ) { scripts.push( elem ); } } } } tmp = null; return safe; }, cleandata: function( elems, /* internal */ acceptdata ) { var data, id, elem, type, i = 0, internalkey = jquery.expando, cache = jquery.cache, deleteexpando = jquery.support.deleteexpando, special = jquery.event.special; for ( ; (elem = elems[i]) != null; i++ ) { if ( acceptdata || jquery.acceptdata( elem ) ) { id = elem[ internalkey ]; data = id && cache[ id ]; if ( data ) { if ( data.events ) { for ( type in data.events ) { if ( special[ type ] ) { jquery.event.remove( elem, type ); // this is a shortcut to avoid jquery.event.remove's overhead } else { jquery.removeevent( elem, type, data.handle ); } } } // remove cache only if it was not already removed by jquery.event.remove if ( cache[ id ] ) { delete cache[ id ]; // ie does not allow us to delete expando properties from nodes, // nor does it have a removeattribute function on document nodes; // we must handle all of these cases if ( deleteexpando ) { delete elem[ internalkey ]; } else if ( typeof elem.removeattribute !== "undefined" ) { elem.removeattribute( internalkey ); } else { elem[ internalkey ] = null; } core_deletedids.push( id ); } } } } } }); var curcss, getstyles, iframe, ralpha = /alpha\([^)]*\)/i, ropacity = /opacity\s*=\s*([^)]*)/, rposition = /^(top|right|bottom|left)$/, // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" // see here for display values: https://developer.mozilla.org/en-us/docs/css/display rdisplayswap = /^(none|table(?!-c[ea]).+)/, rmargin = /^margin/, rnumsplit = new regexp( "^(" + core_pnum + ")(.*)$", "i" ), rnumnonpx = new regexp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), rrelnum = new regexp( "^([+-])=(" + core_pnum + ")", "i" ), elemdisplay = { body: "block" }, cssshow = { position: "absolute", visibility: "hidden", display: "block" }, cssnormaltransform = { letterspacing: 0, fontweight: 400 }, cssexpand = [ "top", "right", "bottom", "left" ], cssprefixes = [ "webkit", "o", "moz", "ms" ]; // return a css property mapped to a potentially vendor prefixed property function vendorpropname( style, name ) { // shortcut for names that are not vendor prefixed if ( name in style ) { return name; } // check for vendor prefixed names var capname = name.charat(0).touppercase() + name.slice(1), origname = name, i = cssprefixes.length; while ( i-- ) { name = cssprefixes[ i ] + capname; if ( name in style ) { return name; } } return origname; } function ishidden( elem, el ) { // ishidden might be called from jquery#filter function; // in that case, element will be second argument elem = el || elem; return jquery.css( elem, "display" ) === "none" || !jquery.contains( elem.ownerdocument, elem ); } function showhide( elements, show ) { var elem, values = [], index = 0, length = elements.length; for ( ; index < length; index++ ) { elem = elements[ index ]; if ( !elem.style ) { continue; } values[ index ] = jquery._data( elem, "olddisplay" ); if ( show ) { // reset the inline display of this element to learn if it is // being hidden by cascaded rules or not if ( !values[ index ] && elem.style.display === "none" ) { elem.style.display = ""; } // set elements which have been overridden with display: none // in a stylesheet to whatever the default browser style is // for such an element if ( elem.style.display === "" && ishidden( elem ) ) { values[ index ] = jquery._data( elem, "olddisplay", css_defaultdisplay(elem.nodename) ); } } else if ( !values[ index ] && !ishidden( elem ) ) { jquery._data( elem, "olddisplay", jquery.css( elem, "display" ) ); } } // set the display of most of the elements in a second loop // to avoid the constant reflow for ( index = 0; index < length; index++ ) { elem = elements[ index ]; if ( !elem.style ) { continue; } if ( !show || elem.style.display === "none" || elem.style.display === "" ) { elem.style.display = show ? values[ index ] || "" : "none"; } } return elements; } jquery.fn.extend({ css: function( name, value ) { return jquery.access( this, function( elem, name, value ) { var styles, len, map = {}, i = 0; if ( jquery.isarray( name ) ) { styles = getstyles( elem ); len = name.length; for ( ; i < len; i++ ) { map[ name[ i ] ] = jquery.css( elem, name[ i ], false, styles ); } return map; } return value !== undefined ? jquery.style( elem, name, value ) : jquery.css( elem, name ); }, name, value, arguments.length > 1 ); }, show: function() { return showhide( this, true ); }, hide: function() { return showhide( this ); }, toggle: function( state ) { var bool = typeof state === "boolean"; return this.each(function() { if ( bool ? state : ishidden( this ) ) { jquery( this ).show(); } else { jquery( this ).hide(); } }); } }); jquery.extend({ // add in style property hooks for overriding the default // behavior of getting and setting a style property csshooks: { opacity: { get: function( elem, computed ) { if ( computed ) { // we should always get a number back from opacity var ret = curcss( elem, "opacity" ); return ret === "" ? "1" : ret; } } } }, // exclude the following css properties to add px cssnumber: { "columncount": true, "fillopacity": true, "fontweight": true, "lineheight": true, "opacity": true, "orphans": true, "widows": true, "zindex": true, "zoom": true }, // add in properties whose names you wish to fix before // setting or getting the value cssprops: { // normalize float css property "float": jquery.support.cssfloat ? "cssfloat" : "stylefloat" }, // get and set the style property on a dom node style: function( elem, name, value, extra ) { // don't set styles on text and comment nodes if ( !elem || elem.nodetype === 3 || elem.nodetype === 8 || !elem.style ) { return; } // make sure that we're working with the right name var ret, type, hooks, origname = jquery.camelcase( name ), style = elem.style; name = jquery.cssprops[ origname ] || ( jquery.cssprops[ origname ] = vendorpropname( style, origname ) ); // gets hook for the prefixed version // followed by the unprefixed version hooks = jquery.csshooks[ name ] || jquery.csshooks[ origname ]; // check if we're setting a value if ( value !== undefined ) { type = typeof value; // convert relative number strings (+= or -=) to relative numbers. #7345 if ( type === "string" && (ret = rrelnum.exec( value )) ) { value = ( ret[1] + 1 ) * ret[2] + parsefloat( jquery.css( elem, name ) ); // fixes bug #9237 type = "number"; } // make sure that nan and null values aren't set. see: #7116 if ( value == null || type === "number" && isnan( value ) ) { return; } // if a number was passed in, add 'px' to the (except for certain css properties) if ( type === "number" && !jquery.cssnumber[ origname ] ) { value += "px"; } // fixes #8908, it can be done more correctly by specifing setters in csshooks, // but it would mean to define eight (for every problematic property) identical functions if ( !jquery.support.clearclonestyle && value === "" && name.indexof("background") === 0 ) { style[ name ] = "inherit"; } // if a hook was provided, use that value, otherwise just set the specified value if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { // wrapped to prevent ie from throwing errors when 'invalid' values are provided // fixes bug #5509 try { style[ name ] = value; } catch(e) {} } } else { // if a hook was provided get the non-computed value from there if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { return ret; } // otherwise just get the value from the style object return style[ name ]; } }, css: function( elem, name, extra, styles ) { var val, num, hooks, origname = jquery.camelcase( name ); // make sure that we're working with the right name name = jquery.cssprops[ origname ] || ( jquery.cssprops[ origname ] = vendorpropname( elem.style, origname ) ); // gets hook for the prefixed version // followed by the unprefixed version hooks = jquery.csshooks[ name ] || jquery.csshooks[ origname ]; // if a hook was provided get the computed value from there if ( hooks && "get" in hooks ) { val = hooks.get( elem, true, extra ); } // otherwise, if a way to get the computed value exists, use that if ( val === undefined ) { val = curcss( elem, name, styles ); } //convert "normal" to computed value if ( val === "normal" && name in cssnormaltransform ) { val = cssnormaltransform[ name ]; } // return, converting to number if forced or a qualifier was provided and val looks numeric if ( extra ) { num = parsefloat( val ); return extra === true || jquery.isnumeric( num ) ? num || 0 : val; } return val; }, // a method for quickly swapping in/out css properties to get correct calculations swap: function( elem, options, callback, args ) { var ret, name, old = {}; // remember the old values, and insert the new ones for ( name in options ) { old[ name ] = elem.style[ name ]; elem.style[ name ] = options[ name ]; } ret = callback.apply( elem, args || [] ); // revert the old values for ( name in options ) { elem.style[ name ] = old[ name ]; } return ret; } }); // note: we've included the "window" in window.getcomputedstyle // because jsdom on node.js will break without it. if ( window.getcomputedstyle ) { getstyles = function( elem ) { return window.getcomputedstyle( elem, null ); }; curcss = function( elem, name, _computed ) { var width, minwidth, maxwidth, computed = _computed || getstyles( elem ), // getpropertyvalue is only needed for .css('filter') in ie9, see #12537 ret = computed ? computed.getpropertyvalue( name ) || computed[ name ] : undefined, style = elem.style; if ( computed ) { if ( ret === "" && !jquery.contains( elem.ownerdocument, elem ) ) { ret = jquery.style( elem, name ); } // a tribute to the "awesome hack by dean edwards" // chrome < 17 and safari 5.0 uses "computed value" instead of "used value" for margin-right // safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels // this is against the cssom draft spec: http://dev.w3.org/csswg/cssom/#resolved-values if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { // remember the original values width = style.width; minwidth = style.minwidth; maxwidth = style.maxwidth; // put in the new values to get a computed value out style.minwidth = style.maxwidth = style.width = ret; ret = computed.width; // revert the changed values style.width = width; style.minwidth = minwidth; style.maxwidth = maxwidth; } } return ret; }; } else if ( document.documentelement.currentstyle ) { getstyles = function( elem ) { return elem.currentstyle; }; curcss = function( elem, name, _computed ) { var left, rs, rsleft, computed = _computed || getstyles( elem ), ret = computed ? computed[ name ] : undefined, style = elem.style; // avoid setting ret to empty string here // so we don't default to auto if ( ret == null && style && style[ name ] ) { ret = style[ name ]; } // from the awesome hack by dean edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 // if we're not dealing with a regular pixel number // but a number that has a weird ending, we need to convert it to pixels // but not position css attributes, as those are proportional to the parent element instead // and we can't measure the parent instead because it might trigger a "stacking dolls" problem if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { // remember the original values left = style.left; rs = elem.runtimestyle; rsleft = rs && rs.left; // put in the new values to get a computed value out if ( rsleft ) { rs.left = elem.currentstyle.left; } style.left = name === "fontsize" ? "1em" : ret; ret = style.pixelleft + "px"; // revert the changed values style.left = left; if ( rsleft ) { rs.left = rsleft; } } return ret === "" ? "auto" : ret; }; } function setpositivenumber( elem, value, subtract ) { var matches = rnumsplit.exec( value ); return matches ? // guard against undefined "subtract", e.g., when used as in csshooks math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : value; } function augmentwidthorheight( elem, name, extra, isborderbox, styles ) { var i = extra === ( isborderbox ? "border" : "content" ) ? // if we already have the right measurement, avoid augmentation 4 : // otherwise initialize for horizontal or vertical properties name === "width" ? 1 : 0, val = 0; for ( ; i < 4; i += 2 ) { // both box models exclude margin, so add it if we want it if ( extra === "margin" ) { val += jquery.css( elem, extra + cssexpand[ i ], true, styles ); } if ( isborderbox ) { // border-box includes padding, so remove it if we want content if ( extra === "content" ) { val -= jquery.css( elem, "padding" + cssexpand[ i ], true, styles ); } // at this point, extra isn't border nor margin, so remove border if ( extra !== "margin" ) { val -= jquery.css( elem, "border" + cssexpand[ i ] + "width", true, styles ); } } else { // at this point, extra isn't content, so add padding val += jquery.css( elem, "padding" + cssexpand[ i ], true, styles ); // at this point, extra isn't content nor padding, so add border if ( extra !== "padding" ) { val += jquery.css( elem, "border" + cssexpand[ i ] + "width", true, styles ); } } } return val; } function getwidthorheight( elem, name, extra ) { // start with offset property, which is equivalent to the border-box value var valueisborderbox = true, val = name === "width" ? elem.offsetwidth : elem.offsetheight, styles = getstyles( elem ), isborderbox = jquery.support.boxsizing && jquery.css( elem, "boxsizing", false, styles ) === "border-box"; // some non-html elements return undefined for offsetwidth, so check for null/undefined // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 // mathml - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 if ( val <= 0 || val == null ) { // fall back to computed then uncomputed css if necessary val = curcss( elem, name, styles ); if ( val < 0 || val == null ) { val = elem.style[ name ]; } // computed unit is not pixels. stop here and return. if ( rnumnonpx.test(val) ) { return val; } // we need the check for style in case a browser which returns unreliable values // for getcomputedstyle silently falls back to the reliable elem.style valueisborderbox = isborderbox && ( jquery.support.boxsizingreliable || val === elem.style[ name ] ); // normalize "", auto, and prepare for extra val = parsefloat( val ) || 0; } // use the active box-sizing model to add/subtract irrelevant styles return ( val + augmentwidthorheight( elem, name, extra || ( isborderbox ? "border" : "content" ), valueisborderbox, styles ) ) + "px"; } // try to determine the default display value of an element function css_defaultdisplay( nodename ) { var doc = document, display = elemdisplay[ nodename ]; if ( !display ) { display = actualdisplay( nodename, doc ); // if the simple way fails, read from inside an iframe if ( display === "none" || !display ) { // use the already-created iframe if possible iframe = ( iframe || jquery("