" && !rtbody.test( elem ) ?
indvd00m@0: tmp :
indvd00m@0: 0;
indvd00m@0:
indvd00m@0: j = elem && elem.childNodes.length;
indvd00m@0: while ( j-- ) {
indvd00m@0: if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
indvd00m@0: elem.removeChild( tbody );
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: jQuery.merge( nodes, tmp.childNodes );
indvd00m@0:
indvd00m@0: // Fix #12392 for WebKit and IE > 9
indvd00m@0: tmp.textContent = "";
indvd00m@0:
indvd00m@0: // Fix #12392 for oldIE
indvd00m@0: while ( tmp.firstChild ) {
indvd00m@0: tmp.removeChild( tmp.firstChild );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Remember the top-level container for proper cleanup
indvd00m@0: tmp = safe.lastChild;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Fix #11356: Clear elements from fragment
indvd00m@0: if ( tmp ) {
indvd00m@0: safe.removeChild( tmp );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Reset defaultChecked for any radios and checkboxes
indvd00m@0: // about to be appended to the DOM in IE 6/7 (#8060)
indvd00m@0: if ( !support.appendChecked ) {
indvd00m@0: jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
indvd00m@0: }
indvd00m@0:
indvd00m@0: i = 0;
indvd00m@0: while ( (elem = nodes[ i++ ]) ) {
indvd00m@0:
indvd00m@0: // #4087 - If origin and destination elements are the same, and this is
indvd00m@0: // that element, do not do anything
indvd00m@0: if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
indvd00m@0: continue;
indvd00m@0: }
indvd00m@0:
indvd00m@0: contains = jQuery.contains( elem.ownerDocument, elem );
indvd00m@0:
indvd00m@0: // Append to fragment
indvd00m@0: tmp = getAll( safe.appendChild( elem ), "script" );
indvd00m@0:
indvd00m@0: // Preserve script evaluation history
indvd00m@0: if ( contains ) {
indvd00m@0: setGlobalEval( tmp );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Capture executables
indvd00m@0: if ( scripts ) {
indvd00m@0: j = 0;
indvd00m@0: while ( (elem = tmp[ j++ ]) ) {
indvd00m@0: if ( rscriptType.test( elem.type || "" ) ) {
indvd00m@0: scripts.push( elem );
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: tmp = null;
indvd00m@0:
indvd00m@0: return safe;
indvd00m@0: },
indvd00m@0:
indvd00m@0: cleanData: function( elems, /* internal */ acceptData ) {
indvd00m@0: var elem, type, id, data,
indvd00m@0: i = 0,
indvd00m@0: internalKey = jQuery.expando,
indvd00m@0: cache = jQuery.cache,
indvd00m@0: deleteExpando = support.deleteExpando,
indvd00m@0: special = jQuery.event.special;
indvd00m@0:
indvd00m@0: for ( ; (elem = elems[i]) != null; i++ ) {
indvd00m@0: if ( acceptData || jQuery.acceptData( elem ) ) {
indvd00m@0:
indvd00m@0: id = elem[ internalKey ];
indvd00m@0: data = id && cache[ id ];
indvd00m@0:
indvd00m@0: if ( data ) {
indvd00m@0: if ( data.events ) {
indvd00m@0: for ( type in data.events ) {
indvd00m@0: if ( special[ type ] ) {
indvd00m@0: jQuery.event.remove( elem, type );
indvd00m@0:
indvd00m@0: // This is a shortcut to avoid jQuery.event.remove's overhead
indvd00m@0: } else {
indvd00m@0: jQuery.removeEvent( elem, type, data.handle );
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Remove cache only if it was not already removed by jQuery.event.remove
indvd00m@0: if ( cache[ id ] ) {
indvd00m@0:
indvd00m@0: delete cache[ id ];
indvd00m@0:
indvd00m@0: // IE does not allow us to delete expando properties from nodes,
indvd00m@0: // nor does it have a removeAttribute function on Document nodes;
indvd00m@0: // we must handle all of these cases
indvd00m@0: if ( deleteExpando ) {
indvd00m@0: delete elem[ internalKey ];
indvd00m@0:
indvd00m@0: } else if ( typeof elem.removeAttribute !== strundefined ) {
indvd00m@0: elem.removeAttribute( internalKey );
indvd00m@0:
indvd00m@0: } else {
indvd00m@0: elem[ internalKey ] = null;
indvd00m@0: }
indvd00m@0:
indvd00m@0: deletedIds.push( id );
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0: jQuery.fn.extend({
indvd00m@0: text: function( value ) {
indvd00m@0: return access( this, function( value ) {
indvd00m@0: return value === undefined ?
indvd00m@0: jQuery.text( this ) :
indvd00m@0: this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
indvd00m@0: }, null, value, arguments.length );
indvd00m@0: },
indvd00m@0:
indvd00m@0: append: function() {
indvd00m@0: return this.domManip( arguments, function( elem ) {
indvd00m@0: if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
indvd00m@0: var target = manipulationTarget( this, elem );
indvd00m@0: target.appendChild( elem );
indvd00m@0: }
indvd00m@0: });
indvd00m@0: },
indvd00m@0:
indvd00m@0: prepend: function() {
indvd00m@0: return this.domManip( arguments, function( elem ) {
indvd00m@0: if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
indvd00m@0: var target = manipulationTarget( this, elem );
indvd00m@0: target.insertBefore( elem, target.firstChild );
indvd00m@0: }
indvd00m@0: });
indvd00m@0: },
indvd00m@0:
indvd00m@0: before: function() {
indvd00m@0: return this.domManip( arguments, function( elem ) {
indvd00m@0: if ( this.parentNode ) {
indvd00m@0: this.parentNode.insertBefore( elem, this );
indvd00m@0: }
indvd00m@0: });
indvd00m@0: },
indvd00m@0:
indvd00m@0: after: function() {
indvd00m@0: return this.domManip( arguments, function( elem ) {
indvd00m@0: if ( this.parentNode ) {
indvd00m@0: this.parentNode.insertBefore( elem, this.nextSibling );
indvd00m@0: }
indvd00m@0: });
indvd00m@0: },
indvd00m@0:
indvd00m@0: remove: function( selector, keepData /* Internal Use Only */ ) {
indvd00m@0: var elem,
indvd00m@0: elems = selector ? jQuery.filter( selector, this ) : this,
indvd00m@0: i = 0;
indvd00m@0:
indvd00m@0: for ( ; (elem = elems[i]) != null; i++ ) {
indvd00m@0:
indvd00m@0: if ( !keepData && elem.nodeType === 1 ) {
indvd00m@0: jQuery.cleanData( getAll( elem ) );
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( elem.parentNode ) {
indvd00m@0: if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
indvd00m@0: setGlobalEval( getAll( elem, "script" ) );
indvd00m@0: }
indvd00m@0: elem.parentNode.removeChild( elem );
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: return this;
indvd00m@0: },
indvd00m@0:
indvd00m@0: empty: function() {
indvd00m@0: var elem,
indvd00m@0: i = 0;
indvd00m@0:
indvd00m@0: for ( ; (elem = this[i]) != null; i++ ) {
indvd00m@0: // Remove element nodes and prevent memory leaks
indvd00m@0: if ( elem.nodeType === 1 ) {
indvd00m@0: jQuery.cleanData( getAll( elem, false ) );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Remove any remaining nodes
indvd00m@0: while ( elem.firstChild ) {
indvd00m@0: elem.removeChild( elem.firstChild );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // If this is a select, ensure that it displays empty (#12336)
indvd00m@0: // Support: IE<9
indvd00m@0: if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
indvd00m@0: elem.options.length = 0;
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: return this;
indvd00m@0: },
indvd00m@0:
indvd00m@0: clone: function( dataAndEvents, deepDataAndEvents ) {
indvd00m@0: dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
indvd00m@0: deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
indvd00m@0:
indvd00m@0: return this.map(function() {
indvd00m@0: return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
indvd00m@0: });
indvd00m@0: },
indvd00m@0:
indvd00m@0: html: function( value ) {
indvd00m@0: return access( this, function( value ) {
indvd00m@0: var elem = this[ 0 ] || {},
indvd00m@0: i = 0,
indvd00m@0: l = this.length;
indvd00m@0:
indvd00m@0: if ( value === undefined ) {
indvd00m@0: return elem.nodeType === 1 ?
indvd00m@0: elem.innerHTML.replace( rinlinejQuery, "" ) :
indvd00m@0: undefined;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // See if we can take a shortcut and just use innerHTML
indvd00m@0: if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
indvd00m@0: ( support.htmlSerialize || !rnoshimcache.test( value ) ) &&
indvd00m@0: ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
indvd00m@0: !wrapMap[ (rtagName.exec( value ) || [ "", "" ])[ 1 ].toLowerCase() ] ) {
indvd00m@0:
indvd00m@0: value = value.replace( rxhtmlTag, "<$1>$2>" );
indvd00m@0:
indvd00m@0: try {
indvd00m@0: for (; i < l; i++ ) {
indvd00m@0: // Remove element nodes and prevent memory leaks
indvd00m@0: elem = this[i] || {};
indvd00m@0: if ( elem.nodeType === 1 ) {
indvd00m@0: jQuery.cleanData( getAll( elem, false ) );
indvd00m@0: elem.innerHTML = value;
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: elem = 0;
indvd00m@0:
indvd00m@0: // If using innerHTML throws an exception, use the fallback method
indvd00m@0: } catch(e) {}
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( elem ) {
indvd00m@0: this.empty().append( value );
indvd00m@0: }
indvd00m@0: }, null, value, arguments.length );
indvd00m@0: },
indvd00m@0:
indvd00m@0: replaceWith: function() {
indvd00m@0: var arg = arguments[ 0 ];
indvd00m@0:
indvd00m@0: // Make the changes, replacing each context element with the new content
indvd00m@0: this.domManip( arguments, function( elem ) {
indvd00m@0: arg = this.parentNode;
indvd00m@0:
indvd00m@0: jQuery.cleanData( getAll( this ) );
indvd00m@0:
indvd00m@0: if ( arg ) {
indvd00m@0: arg.replaceChild( elem, this );
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0: // Force removal if there was no new content (e.g., from empty arguments)
indvd00m@0: return arg && (arg.length || arg.nodeType) ? this : this.remove();
indvd00m@0: },
indvd00m@0:
indvd00m@0: detach: function( selector ) {
indvd00m@0: return this.remove( selector, true );
indvd00m@0: },
indvd00m@0:
indvd00m@0: domManip: function( args, callback ) {
indvd00m@0:
indvd00m@0: // Flatten any nested arrays
indvd00m@0: args = concat.apply( [], args );
indvd00m@0:
indvd00m@0: var first, node, hasScripts,
indvd00m@0: scripts, doc, fragment,
indvd00m@0: i = 0,
indvd00m@0: l = this.length,
indvd00m@0: set = this,
indvd00m@0: iNoClone = l - 1,
indvd00m@0: value = args[0],
indvd00m@0: isFunction = jQuery.isFunction( value );
indvd00m@0:
indvd00m@0: // We can't cloneNode fragments that contain checked, in WebKit
indvd00m@0: if ( isFunction ||
indvd00m@0: ( l > 1 && typeof value === "string" &&
indvd00m@0: !support.checkClone && rchecked.test( value ) ) ) {
indvd00m@0: return this.each(function( index ) {
indvd00m@0: var self = set.eq( index );
indvd00m@0: if ( isFunction ) {
indvd00m@0: args[0] = value.call( this, index, self.html() );
indvd00m@0: }
indvd00m@0: self.domManip( args, callback );
indvd00m@0: });
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( l ) {
indvd00m@0: fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
indvd00m@0: first = fragment.firstChild;
indvd00m@0:
indvd00m@0: if ( fragment.childNodes.length === 1 ) {
indvd00m@0: fragment = first;
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( first ) {
indvd00m@0: scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
indvd00m@0: hasScripts = scripts.length;
indvd00m@0:
indvd00m@0: // Use the original fragment for the last item instead of the first because it can end up
indvd00m@0: // being emptied incorrectly in certain situations (#8070).
indvd00m@0: for ( ; i < l; i++ ) {
indvd00m@0: node = fragment;
indvd00m@0:
indvd00m@0: if ( i !== iNoClone ) {
indvd00m@0: node = jQuery.clone( node, true, true );
indvd00m@0:
indvd00m@0: // Keep references to cloned scripts for later restoration
indvd00m@0: if ( hasScripts ) {
indvd00m@0: jQuery.merge( scripts, getAll( node, "script" ) );
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: callback.call( this[i], node, i );
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( hasScripts ) {
indvd00m@0: doc = scripts[ scripts.length - 1 ].ownerDocument;
indvd00m@0:
indvd00m@0: // Reenable scripts
indvd00m@0: jQuery.map( scripts, restoreScript );
indvd00m@0:
indvd00m@0: // Evaluate executable scripts on first document insertion
indvd00m@0: for ( i = 0; i < hasScripts; i++ ) {
indvd00m@0: node = scripts[ i ];
indvd00m@0: if ( rscriptType.test( node.type || "" ) &&
indvd00m@0: !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
indvd00m@0:
indvd00m@0: if ( node.src ) {
indvd00m@0: // Optional AJAX dependency, but won't run scripts if not present
indvd00m@0: if ( jQuery._evalUrl ) {
indvd00m@0: jQuery._evalUrl( node.src );
indvd00m@0: }
indvd00m@0: } else {
indvd00m@0: jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Fix #11809: Avoid leaking memory
indvd00m@0: fragment = first = null;
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: return this;
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0: jQuery.each({
indvd00m@0: appendTo: "append",
indvd00m@0: prependTo: "prepend",
indvd00m@0: insertBefore: "before",
indvd00m@0: insertAfter: "after",
indvd00m@0: replaceAll: "replaceWith"
indvd00m@0: }, function( name, original ) {
indvd00m@0: jQuery.fn[ name ] = function( selector ) {
indvd00m@0: var elems,
indvd00m@0: i = 0,
indvd00m@0: ret = [],
indvd00m@0: insert = jQuery( selector ),
indvd00m@0: last = insert.length - 1;
indvd00m@0:
indvd00m@0: for ( ; i <= last; i++ ) {
indvd00m@0: elems = i === last ? this : this.clone(true);
indvd00m@0: jQuery( insert[i] )[ original ]( elems );
indvd00m@0:
indvd00m@0: // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
indvd00m@0: push.apply( ret, elems.get() );
indvd00m@0: }
indvd00m@0:
indvd00m@0: return this.pushStack( ret );
indvd00m@0: };
indvd00m@0: });
indvd00m@0:
indvd00m@0:
indvd00m@0: var iframe,
indvd00m@0: elemdisplay = {};
indvd00m@0:
indvd00m@0: /**
indvd00m@0: * Retrieve the actual display of a element
indvd00m@0: * @param {String} name nodeName of the element
indvd00m@0: * @param {Object} doc Document object
indvd00m@0: */
indvd00m@0: // Called only from within defaultDisplay
indvd00m@0: function actualDisplay( name, doc ) {
indvd00m@0: var style,
indvd00m@0: elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
indvd00m@0:
indvd00m@0: // getDefaultComputedStyle might be reliably used only on attached element
indvd00m@0: display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ?
indvd00m@0:
indvd00m@0: // Use of this method is a temporary fix (more like optmization) until something better comes along,
indvd00m@0: // since it was removed from specification and supported only in FF
indvd00m@0: style.display : jQuery.css( elem[ 0 ], "display" );
indvd00m@0:
indvd00m@0: // We don't have any data stored on the element,
indvd00m@0: // so use "detach" method as fast way to get rid of the element
indvd00m@0: elem.detach();
indvd00m@0:
indvd00m@0: return display;
indvd00m@0: }
indvd00m@0:
indvd00m@0: /**
indvd00m@0: * Try to determine the default display value of an element
indvd00m@0: * @param {String} nodeName
indvd00m@0: */
indvd00m@0: function defaultDisplay( nodeName ) {
indvd00m@0: var doc = document,
indvd00m@0: display = elemdisplay[ nodeName ];
indvd00m@0:
indvd00m@0: if ( !display ) {
indvd00m@0: display = actualDisplay( nodeName, doc );
indvd00m@0:
indvd00m@0: // If the simple way fails, read from inside an iframe
indvd00m@0: if ( display === "none" || !display ) {
indvd00m@0:
indvd00m@0: // Use the already-created iframe if possible
indvd00m@0: iframe = (iframe || jQuery( "" )).appendTo( doc.documentElement );
indvd00m@0:
indvd00m@0: // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
indvd00m@0: doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document;
indvd00m@0:
indvd00m@0: // Support: IE
indvd00m@0: doc.write();
indvd00m@0: doc.close();
indvd00m@0:
indvd00m@0: display = actualDisplay( nodeName, doc );
indvd00m@0: iframe.detach();
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Store the correct default display
indvd00m@0: elemdisplay[ nodeName ] = display;
indvd00m@0: }
indvd00m@0:
indvd00m@0: return display;
indvd00m@0: }
indvd00m@0:
indvd00m@0:
indvd00m@0: (function() {
indvd00m@0: var shrinkWrapBlocksVal;
indvd00m@0:
indvd00m@0: support.shrinkWrapBlocks = function() {
indvd00m@0: if ( shrinkWrapBlocksVal != null ) {
indvd00m@0: return shrinkWrapBlocksVal;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Will be changed later if needed.
indvd00m@0: shrinkWrapBlocksVal = false;
indvd00m@0:
indvd00m@0: // Minified: var b,c,d
indvd00m@0: var div, body, container;
indvd00m@0:
indvd00m@0: body = document.getElementsByTagName( "body" )[ 0 ];
indvd00m@0: if ( !body || !body.style ) {
indvd00m@0: // Test fired too early or in an unsupported environment, exit.
indvd00m@0: return;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Setup
indvd00m@0: div = document.createElement( "div" );
indvd00m@0: container = document.createElement( "div" );
indvd00m@0: container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
indvd00m@0: body.appendChild( container ).appendChild( div );
indvd00m@0:
indvd00m@0: // Support: IE6
indvd00m@0: // Check if elements with layout shrink-wrap their children
indvd00m@0: if ( typeof div.style.zoom !== strundefined ) {
indvd00m@0: // Reset CSS: box-sizing; display; margin; border
indvd00m@0: div.style.cssText =
indvd00m@0: // Support: Firefox<29, Android 2.3
indvd00m@0: // Vendor-prefix box-sizing
indvd00m@0: "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
indvd00m@0: "box-sizing:content-box;display:block;margin:0;border:0;" +
indvd00m@0: "padding:1px;width:1px;zoom:1";
indvd00m@0: div.appendChild( document.createElement( "div" ) ).style.width = "5px";
indvd00m@0: shrinkWrapBlocksVal = div.offsetWidth !== 3;
indvd00m@0: }
indvd00m@0:
indvd00m@0: body.removeChild( container );
indvd00m@0:
indvd00m@0: return shrinkWrapBlocksVal;
indvd00m@0: };
indvd00m@0:
indvd00m@0: })();
indvd00m@0: var rmargin = (/^margin/);
indvd00m@0:
indvd00m@0: var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0: var getStyles, curCSS,
indvd00m@0: rposition = /^(top|right|bottom|left)$/;
indvd00m@0:
indvd00m@0: if ( window.getComputedStyle ) {
indvd00m@0: getStyles = function( elem ) {
indvd00m@0: // Support: IE<=11+, Firefox<=30+ (#15098, #14150)
indvd00m@0: // IE throws on elements created in popups
indvd00m@0: // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
indvd00m@0: if ( elem.ownerDocument.defaultView.opener ) {
indvd00m@0: return elem.ownerDocument.defaultView.getComputedStyle( elem, null );
indvd00m@0: }
indvd00m@0:
indvd00m@0: return window.getComputedStyle( elem, null );
indvd00m@0: };
indvd00m@0:
indvd00m@0: curCSS = function( elem, name, computed ) {
indvd00m@0: var width, minWidth, maxWidth, ret,
indvd00m@0: style = elem.style;
indvd00m@0:
indvd00m@0: computed = computed || getStyles( elem );
indvd00m@0:
indvd00m@0: // getPropertyValue is only needed for .css('filter') in IE9, see #12537
indvd00m@0: ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined;
indvd00m@0:
indvd00m@0: if ( computed ) {
indvd00m@0:
indvd00m@0: if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
indvd00m@0: ret = jQuery.style( elem, name );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // A tribute to the "awesome hack by Dean Edwards"
indvd00m@0: // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
indvd00m@0: // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
indvd00m@0: // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
indvd00m@0: if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
indvd00m@0:
indvd00m@0: // Remember the original values
indvd00m@0: width = style.width;
indvd00m@0: minWidth = style.minWidth;
indvd00m@0: maxWidth = style.maxWidth;
indvd00m@0:
indvd00m@0: // Put in the new values to get a computed value out
indvd00m@0: style.minWidth = style.maxWidth = style.width = ret;
indvd00m@0: ret = computed.width;
indvd00m@0:
indvd00m@0: // Revert the changed values
indvd00m@0: style.width = width;
indvd00m@0: style.minWidth = minWidth;
indvd00m@0: style.maxWidth = maxWidth;
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Support: IE
indvd00m@0: // IE returns zIndex value as an integer.
indvd00m@0: return ret === undefined ?
indvd00m@0: ret :
indvd00m@0: ret + "";
indvd00m@0: };
indvd00m@0: } else if ( document.documentElement.currentStyle ) {
indvd00m@0: getStyles = function( elem ) {
indvd00m@0: return elem.currentStyle;
indvd00m@0: };
indvd00m@0:
indvd00m@0: curCSS = function( elem, name, computed ) {
indvd00m@0: var left, rs, rsLeft, ret,
indvd00m@0: style = elem.style;
indvd00m@0:
indvd00m@0: computed = computed || getStyles( elem );
indvd00m@0: ret = computed ? computed[ name ] : undefined;
indvd00m@0:
indvd00m@0: // Avoid setting ret to empty string here
indvd00m@0: // so we don't default to auto
indvd00m@0: if ( ret == null && style && style[ name ] ) {
indvd00m@0: ret = style[ name ];
indvd00m@0: }
indvd00m@0:
indvd00m@0: // From the awesome hack by Dean Edwards
indvd00m@0: // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
indvd00m@0:
indvd00m@0: // If we're not dealing with a regular pixel number
indvd00m@0: // but a number that has a weird ending, we need to convert it to pixels
indvd00m@0: // but not position css attributes, as those are proportional to the parent element instead
indvd00m@0: // and we can't measure the parent instead because it might trigger a "stacking dolls" problem
indvd00m@0: if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
indvd00m@0:
indvd00m@0: // Remember the original values
indvd00m@0: left = style.left;
indvd00m@0: rs = elem.runtimeStyle;
indvd00m@0: rsLeft = rs && rs.left;
indvd00m@0:
indvd00m@0: // Put in the new values to get a computed value out
indvd00m@0: if ( rsLeft ) {
indvd00m@0: rs.left = elem.currentStyle.left;
indvd00m@0: }
indvd00m@0: style.left = name === "fontSize" ? "1em" : ret;
indvd00m@0: ret = style.pixelLeft + "px";
indvd00m@0:
indvd00m@0: // Revert the changed values
indvd00m@0: style.left = left;
indvd00m@0: if ( rsLeft ) {
indvd00m@0: rs.left = rsLeft;
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Support: IE
indvd00m@0: // IE returns zIndex value as an integer.
indvd00m@0: return ret === undefined ?
indvd00m@0: ret :
indvd00m@0: ret + "" || "auto";
indvd00m@0: };
indvd00m@0: }
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0: function addGetHookIf( conditionFn, hookFn ) {
indvd00m@0: // Define the hook, we'll check on the first run if it's really needed.
indvd00m@0: return {
indvd00m@0: get: function() {
indvd00m@0: var condition = conditionFn();
indvd00m@0:
indvd00m@0: if ( condition == null ) {
indvd00m@0: // The test was not ready at this point; screw the hook this time
indvd00m@0: // but check again when needed next time.
indvd00m@0: return;
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( condition ) {
indvd00m@0: // Hook not needed (or it's not possible to use it due to missing dependency),
indvd00m@0: // remove it.
indvd00m@0: // Since there are no other hooks for marginRight, remove the whole object.
indvd00m@0: delete this.get;
indvd00m@0: return;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Hook needed; redefine it so that the support test is not executed again.
indvd00m@0:
indvd00m@0: return (this.get = hookFn).apply( this, arguments );
indvd00m@0: }
indvd00m@0: };
indvd00m@0: }
indvd00m@0:
indvd00m@0:
indvd00m@0: (function() {
indvd00m@0: // Minified: var b,c,d,e,f,g, h,i
indvd00m@0: var div, style, a, pixelPositionVal, boxSizingReliableVal,
indvd00m@0: reliableHiddenOffsetsVal, reliableMarginRightVal;
indvd00m@0:
indvd00m@0: // Setup
indvd00m@0: div = document.createElement( "div" );
indvd00m@0: div.innerHTML = " a";
indvd00m@0: a = div.getElementsByTagName( "a" )[ 0 ];
indvd00m@0: style = a && a.style;
indvd00m@0:
indvd00m@0: // Finish early in limited (non-browser) environments
indvd00m@0: if ( !style ) {
indvd00m@0: return;
indvd00m@0: }
indvd00m@0:
indvd00m@0: style.cssText = "float:left;opacity:.5";
indvd00m@0:
indvd00m@0: // Support: IE<9
indvd00m@0: // Make sure that element opacity exists (as opposed to filter)
indvd00m@0: support.opacity = style.opacity === "0.5";
indvd00m@0:
indvd00m@0: // Verify style float existence
indvd00m@0: // (IE uses styleFloat instead of cssFloat)
indvd00m@0: support.cssFloat = !!style.cssFloat;
indvd00m@0:
indvd00m@0: div.style.backgroundClip = "content-box";
indvd00m@0: div.cloneNode( true ).style.backgroundClip = "";
indvd00m@0: support.clearCloneStyle = div.style.backgroundClip === "content-box";
indvd00m@0:
indvd00m@0: // Support: Firefox<29, Android 2.3
indvd00m@0: // Vendor-prefix box-sizing
indvd00m@0: support.boxSizing = style.boxSizing === "" || style.MozBoxSizing === "" ||
indvd00m@0: style.WebkitBoxSizing === "";
indvd00m@0:
indvd00m@0: jQuery.extend(support, {
indvd00m@0: reliableHiddenOffsets: function() {
indvd00m@0: if ( reliableHiddenOffsetsVal == null ) {
indvd00m@0: computeStyleTests();
indvd00m@0: }
indvd00m@0: return reliableHiddenOffsetsVal;
indvd00m@0: },
indvd00m@0:
indvd00m@0: boxSizingReliable: function() {
indvd00m@0: if ( boxSizingReliableVal == null ) {
indvd00m@0: computeStyleTests();
indvd00m@0: }
indvd00m@0: return boxSizingReliableVal;
indvd00m@0: },
indvd00m@0:
indvd00m@0: pixelPosition: function() {
indvd00m@0: if ( pixelPositionVal == null ) {
indvd00m@0: computeStyleTests();
indvd00m@0: }
indvd00m@0: return pixelPositionVal;
indvd00m@0: },
indvd00m@0:
indvd00m@0: // Support: Android 2.3
indvd00m@0: reliableMarginRight: function() {
indvd00m@0: if ( reliableMarginRightVal == null ) {
indvd00m@0: computeStyleTests();
indvd00m@0: }
indvd00m@0: return reliableMarginRightVal;
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0: function computeStyleTests() {
indvd00m@0: // Minified: var b,c,d,j
indvd00m@0: var div, body, container, contents;
indvd00m@0:
indvd00m@0: body = document.getElementsByTagName( "body" )[ 0 ];
indvd00m@0: if ( !body || !body.style ) {
indvd00m@0: // Test fired too early or in an unsupported environment, exit.
indvd00m@0: return;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Setup
indvd00m@0: div = document.createElement( "div" );
indvd00m@0: container = document.createElement( "div" );
indvd00m@0: container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
indvd00m@0: body.appendChild( container ).appendChild( div );
indvd00m@0:
indvd00m@0: div.style.cssText =
indvd00m@0: // Support: Firefox<29, Android 2.3
indvd00m@0: // Vendor-prefix box-sizing
indvd00m@0: "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
indvd00m@0: "box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
indvd00m@0: "border:1px;padding:1px;width:4px;position:absolute";
indvd00m@0:
indvd00m@0: // Support: IE<9
indvd00m@0: // Assume reasonable values in the absence of getComputedStyle
indvd00m@0: pixelPositionVal = boxSizingReliableVal = false;
indvd00m@0: reliableMarginRightVal = true;
indvd00m@0:
indvd00m@0: // Check for getComputedStyle so that this code is not run in IE<9.
indvd00m@0: if ( window.getComputedStyle ) {
indvd00m@0: pixelPositionVal = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
indvd00m@0: boxSizingReliableVal =
indvd00m@0: ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
indvd00m@0:
indvd00m@0: // Support: Android 2.3
indvd00m@0: // Div with explicit width and no margin-right incorrectly
indvd00m@0: // gets computed margin-right based on width of container (#3333)
indvd00m@0: // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
indvd00m@0: contents = div.appendChild( document.createElement( "div" ) );
indvd00m@0:
indvd00m@0: // Reset CSS: box-sizing; display; margin; border; padding
indvd00m@0: contents.style.cssText = div.style.cssText =
indvd00m@0: // Support: Firefox<29, Android 2.3
indvd00m@0: // Vendor-prefix box-sizing
indvd00m@0: "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
indvd00m@0: "box-sizing:content-box;display:block;margin:0;border:0;padding:0";
indvd00m@0: contents.style.marginRight = contents.style.width = "0";
indvd00m@0: div.style.width = "1px";
indvd00m@0:
indvd00m@0: reliableMarginRightVal =
indvd00m@0: !parseFloat( ( window.getComputedStyle( contents, null ) || {} ).marginRight );
indvd00m@0:
indvd00m@0: div.removeChild( contents );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Support: IE8
indvd00m@0: // Check if table cells still have offsetWidth/Height when they are set
indvd00m@0: // to display:none and there are still other visible table cells in a
indvd00m@0: // table row; if so, offsetWidth/Height are not reliable for use when
indvd00m@0: // determining if an element has been hidden directly using
indvd00m@0: // display:none (it is still safe to use offsets if a parent element is
indvd00m@0: // hidden; don safety goggles and see bug #4512 for more information).
indvd00m@0: div.innerHTML = "";
indvd00m@0: contents = div.getElementsByTagName( "td" );
indvd00m@0: contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none";
indvd00m@0: reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
indvd00m@0: if ( reliableHiddenOffsetsVal ) {
indvd00m@0: contents[ 0 ].style.display = "";
indvd00m@0: contents[ 1 ].style.display = "none";
indvd00m@0: reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
indvd00m@0: }
indvd00m@0:
indvd00m@0: body.removeChild( container );
indvd00m@0: }
indvd00m@0:
indvd00m@0: })();
indvd00m@0:
indvd00m@0:
indvd00m@0: // A method for quickly swapping in/out CSS properties to get correct calculations.
indvd00m@0: jQuery.swap = function( elem, options, callback, args ) {
indvd00m@0: var ret, name,
indvd00m@0: old = {};
indvd00m@0:
indvd00m@0: // Remember the old values, and insert the new ones
indvd00m@0: for ( name in options ) {
indvd00m@0: old[ name ] = elem.style[ name ];
indvd00m@0: elem.style[ name ] = options[ name ];
indvd00m@0: }
indvd00m@0:
indvd00m@0: ret = callback.apply( elem, args || [] );
indvd00m@0:
indvd00m@0: // Revert the old values
indvd00m@0: for ( name in options ) {
indvd00m@0: elem.style[ name ] = old[ name ];
indvd00m@0: }
indvd00m@0:
indvd00m@0: return ret;
indvd00m@0: };
indvd00m@0:
indvd00m@0:
indvd00m@0: var
indvd00m@0: ralpha = /alpha\([^)]*\)/i,
indvd00m@0: ropacity = /opacity\s*=\s*([^)]*)/,
indvd00m@0:
indvd00m@0: // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
indvd00m@0: // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
indvd00m@0: rdisplayswap = /^(none|table(?!-c[ea]).+)/,
indvd00m@0: rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
indvd00m@0: rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ),
indvd00m@0:
indvd00m@0: cssShow = { position: "absolute", visibility: "hidden", display: "block" },
indvd00m@0: cssNormalTransform = {
indvd00m@0: letterSpacing: "0",
indvd00m@0: fontWeight: "400"
indvd00m@0: },
indvd00m@0:
indvd00m@0: cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
indvd00m@0:
indvd00m@0:
indvd00m@0: // return a css property mapped to a potentially vendor prefixed property
indvd00m@0: function vendorPropName( style, name ) {
indvd00m@0:
indvd00m@0: // shortcut for names that are not vendor prefixed
indvd00m@0: if ( name in style ) {
indvd00m@0: return name;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // check for vendor prefixed names
indvd00m@0: var capName = name.charAt(0).toUpperCase() + name.slice(1),
indvd00m@0: origName = name,
indvd00m@0: i = cssPrefixes.length;
indvd00m@0:
indvd00m@0: while ( i-- ) {
indvd00m@0: name = cssPrefixes[ i ] + capName;
indvd00m@0: if ( name in style ) {
indvd00m@0: return name;
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: return origName;
indvd00m@0: }
indvd00m@0:
indvd00m@0: function showHide( elements, show ) {
indvd00m@0: var display, elem, hidden,
indvd00m@0: values = [],
indvd00m@0: index = 0,
indvd00m@0: length = elements.length;
indvd00m@0:
indvd00m@0: for ( ; index < length; index++ ) {
indvd00m@0: elem = elements[ index ];
indvd00m@0: if ( !elem.style ) {
indvd00m@0: continue;
indvd00m@0: }
indvd00m@0:
indvd00m@0: values[ index ] = jQuery._data( elem, "olddisplay" );
indvd00m@0: display = elem.style.display;
indvd00m@0: if ( show ) {
indvd00m@0: // Reset the inline display of this element to learn if it is
indvd00m@0: // being hidden by cascaded rules or not
indvd00m@0: if ( !values[ index ] && display === "none" ) {
indvd00m@0: elem.style.display = "";
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Set elements which have been overridden with display: none
indvd00m@0: // in a stylesheet to whatever the default browser style is
indvd00m@0: // for such an element
indvd00m@0: if ( elem.style.display === "" && isHidden( elem ) ) {
indvd00m@0: values[ index ] = jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
indvd00m@0: }
indvd00m@0: } else {
indvd00m@0: hidden = isHidden( elem );
indvd00m@0:
indvd00m@0: if ( display && display !== "none" || !hidden ) {
indvd00m@0: jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Set the display of most of the elements in a second loop
indvd00m@0: // to avoid the constant reflow
indvd00m@0: for ( index = 0; index < length; index++ ) {
indvd00m@0: elem = elements[ index ];
indvd00m@0: if ( !elem.style ) {
indvd00m@0: continue;
indvd00m@0: }
indvd00m@0: if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
indvd00m@0: elem.style.display = show ? values[ index ] || "" : "none";
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: return elements;
indvd00m@0: }
indvd00m@0:
indvd00m@0: function setPositiveNumber( elem, value, subtract ) {
indvd00m@0: var matches = rnumsplit.exec( value );
indvd00m@0: return matches ?
indvd00m@0: // Guard against undefined "subtract", e.g., when used as in cssHooks
indvd00m@0: Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
indvd00m@0: value;
indvd00m@0: }
indvd00m@0:
indvd00m@0: function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
indvd00m@0: var i = extra === ( isBorderBox ? "border" : "content" ) ?
indvd00m@0: // If we already have the right measurement, avoid augmentation
indvd00m@0: 4 :
indvd00m@0: // Otherwise initialize for horizontal or vertical properties
indvd00m@0: name === "width" ? 1 : 0,
indvd00m@0:
indvd00m@0: val = 0;
indvd00m@0:
indvd00m@0: for ( ; i < 4; i += 2 ) {
indvd00m@0: // both box models exclude margin, so add it if we want it
indvd00m@0: if ( extra === "margin" ) {
indvd00m@0: val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( isBorderBox ) {
indvd00m@0: // border-box includes padding, so remove it if we want content
indvd00m@0: if ( extra === "content" ) {
indvd00m@0: val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // at this point, extra isn't border nor margin, so remove border
indvd00m@0: if ( extra !== "margin" ) {
indvd00m@0: val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
indvd00m@0: }
indvd00m@0: } else {
indvd00m@0: // at this point, extra isn't content, so add padding
indvd00m@0: val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
indvd00m@0:
indvd00m@0: // at this point, extra isn't content nor padding, so add border
indvd00m@0: if ( extra !== "padding" ) {
indvd00m@0: val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: return val;
indvd00m@0: }
indvd00m@0:
indvd00m@0: function getWidthOrHeight( elem, name, extra ) {
indvd00m@0:
indvd00m@0: // Start with offset property, which is equivalent to the border-box value
indvd00m@0: var valueIsBorderBox = true,
indvd00m@0: val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
indvd00m@0: styles = getStyles( elem ),
indvd00m@0: isBorderBox = support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
indvd00m@0:
indvd00m@0: // some non-html elements return undefined for offsetWidth, so check for null/undefined
indvd00m@0: // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
indvd00m@0: // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
indvd00m@0: if ( val <= 0 || val == null ) {
indvd00m@0: // Fall back to computed then uncomputed css if necessary
indvd00m@0: val = curCSS( elem, name, styles );
indvd00m@0: if ( val < 0 || val == null ) {
indvd00m@0: val = elem.style[ name ];
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Computed unit is not pixels. Stop here and return.
indvd00m@0: if ( rnumnonpx.test(val) ) {
indvd00m@0: return val;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // we need the check for style in case a browser which returns unreliable values
indvd00m@0: // for getComputedStyle silently falls back to the reliable elem.style
indvd00m@0: valueIsBorderBox = isBorderBox && ( support.boxSizingReliable() || val === elem.style[ name ] );
indvd00m@0:
indvd00m@0: // Normalize "", auto, and prepare for extra
indvd00m@0: val = parseFloat( val ) || 0;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // use the active box-sizing model to add/subtract irrelevant styles
indvd00m@0: return ( val +
indvd00m@0: augmentWidthOrHeight(
indvd00m@0: elem,
indvd00m@0: name,
indvd00m@0: extra || ( isBorderBox ? "border" : "content" ),
indvd00m@0: valueIsBorderBox,
indvd00m@0: styles
indvd00m@0: )
indvd00m@0: ) + "px";
indvd00m@0: }
indvd00m@0:
indvd00m@0: jQuery.extend({
indvd00m@0: // Add in style property hooks for overriding the default
indvd00m@0: // behavior of getting and setting a style property
indvd00m@0: cssHooks: {
indvd00m@0: opacity: {
indvd00m@0: get: function( elem, computed ) {
indvd00m@0: if ( computed ) {
indvd00m@0: // We should always get a number back from opacity
indvd00m@0: var ret = curCSS( elem, "opacity" );
indvd00m@0: return ret === "" ? "1" : ret;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0: },
indvd00m@0:
indvd00m@0: // Don't automatically add "px" to these possibly-unitless properties
indvd00m@0: cssNumber: {
indvd00m@0: "columnCount": true,
indvd00m@0: "fillOpacity": true,
indvd00m@0: "flexGrow": true,
indvd00m@0: "flexShrink": true,
indvd00m@0: "fontWeight": true,
indvd00m@0: "lineHeight": true,
indvd00m@0: "opacity": true,
indvd00m@0: "order": true,
indvd00m@0: "orphans": true,
indvd00m@0: "widows": true,
indvd00m@0: "zIndex": true,
indvd00m@0: "zoom": true
indvd00m@0: },
indvd00m@0:
indvd00m@0: // Add in properties whose names you wish to fix before
indvd00m@0: // setting or getting the value
indvd00m@0: cssProps: {
indvd00m@0: // normalize float css property
indvd00m@0: "float": support.cssFloat ? "cssFloat" : "styleFloat"
indvd00m@0: },
indvd00m@0:
indvd00m@0: // Get and set the style property on a DOM Node
indvd00m@0: style: function( elem, name, value, extra ) {
indvd00m@0: // Don't set styles on text and comment nodes
indvd00m@0: if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
indvd00m@0: return;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Make sure that we're working with the right name
indvd00m@0: var ret, type, hooks,
indvd00m@0: origName = jQuery.camelCase( name ),
indvd00m@0: style = elem.style;
indvd00m@0:
indvd00m@0: name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
indvd00m@0:
indvd00m@0: // gets hook for the prefixed version
indvd00m@0: // followed by the unprefixed version
indvd00m@0: hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
indvd00m@0:
indvd00m@0: // Check if we're setting a value
indvd00m@0: if ( value !== undefined ) {
indvd00m@0: type = typeof value;
indvd00m@0:
indvd00m@0: // convert relative number strings (+= or -=) to relative numbers. #7345
indvd00m@0: if ( type === "string" && (ret = rrelNum.exec( value )) ) {
indvd00m@0: value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
indvd00m@0: // Fixes bug #9237
indvd00m@0: type = "number";
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Make sure that null and NaN values aren't set. See: #7116
indvd00m@0: if ( value == null || value !== value ) {
indvd00m@0: return;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // If a number was passed in, add 'px' to the (except for certain CSS properties)
indvd00m@0: if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
indvd00m@0: value += "px";
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
indvd00m@0: // but it would mean to define eight (for every problematic property) identical functions
indvd00m@0: if ( !support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
indvd00m@0: style[ name ] = "inherit";
indvd00m@0: }
indvd00m@0:
indvd00m@0: // If a hook was provided, use that value, otherwise just set the specified value
indvd00m@0: if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
indvd00m@0:
indvd00m@0: // Support: IE
indvd00m@0: // Swallow errors from 'invalid' CSS values (#5509)
indvd00m@0: try {
indvd00m@0: style[ name ] = value;
indvd00m@0: } catch(e) {}
indvd00m@0: }
indvd00m@0:
indvd00m@0: } else {
indvd00m@0: // If a hook was provided get the non-computed value from there
indvd00m@0: if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
indvd00m@0: return ret;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Otherwise just get the value from the style object
indvd00m@0: return style[ name ];
indvd00m@0: }
indvd00m@0: },
indvd00m@0:
indvd00m@0: css: function( elem, name, extra, styles ) {
indvd00m@0: var num, val, hooks,
indvd00m@0: origName = jQuery.camelCase( name );
indvd00m@0:
indvd00m@0: // Make sure that we're working with the right name
indvd00m@0: name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
indvd00m@0:
indvd00m@0: // gets hook for the prefixed version
indvd00m@0: // followed by the unprefixed version
indvd00m@0: hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
indvd00m@0:
indvd00m@0: // If a hook was provided get the computed value from there
indvd00m@0: if ( hooks && "get" in hooks ) {
indvd00m@0: val = hooks.get( elem, true, extra );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Otherwise, if a way to get the computed value exists, use that
indvd00m@0: if ( val === undefined ) {
indvd00m@0: val = curCSS( elem, name, styles );
indvd00m@0: }
indvd00m@0:
indvd00m@0: //convert "normal" to computed value
indvd00m@0: if ( val === "normal" && name in cssNormalTransform ) {
indvd00m@0: val = cssNormalTransform[ name ];
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Return, converting to number if forced or a qualifier was provided and val looks numeric
indvd00m@0: if ( extra === "" || extra ) {
indvd00m@0: num = parseFloat( val );
indvd00m@0: return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
indvd00m@0: }
indvd00m@0: return val;
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0: jQuery.each([ "height", "width" ], function( i, name ) {
indvd00m@0: jQuery.cssHooks[ name ] = {
indvd00m@0: get: function( elem, computed, extra ) {
indvd00m@0: if ( computed ) {
indvd00m@0: // certain elements can have dimension info if we invisibly show them
indvd00m@0: // however, it must have a current display style that would benefit from this
indvd00m@0: return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ?
indvd00m@0: jQuery.swap( elem, cssShow, function() {
indvd00m@0: return getWidthOrHeight( elem, name, extra );
indvd00m@0: }) :
indvd00m@0: getWidthOrHeight( elem, name, extra );
indvd00m@0: }
indvd00m@0: },
indvd00m@0:
indvd00m@0: set: function( elem, value, extra ) {
indvd00m@0: var styles = extra && getStyles( elem );
indvd00m@0: return setPositiveNumber( elem, value, extra ?
indvd00m@0: augmentWidthOrHeight(
indvd00m@0: elem,
indvd00m@0: name,
indvd00m@0: extra,
indvd00m@0: support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
indvd00m@0: styles
indvd00m@0: ) : 0
indvd00m@0: );
indvd00m@0: }
indvd00m@0: };
indvd00m@0: });
indvd00m@0:
indvd00m@0: if ( !support.opacity ) {
indvd00m@0: jQuery.cssHooks.opacity = {
indvd00m@0: get: function( elem, computed ) {
indvd00m@0: // IE uses filters for opacity
indvd00m@0: return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
indvd00m@0: ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
indvd00m@0: computed ? "1" : "";
indvd00m@0: },
indvd00m@0:
indvd00m@0: set: function( elem, value ) {
indvd00m@0: var style = elem.style,
indvd00m@0: currentStyle = elem.currentStyle,
indvd00m@0: opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
indvd00m@0: filter = currentStyle && currentStyle.filter || style.filter || "";
indvd00m@0:
indvd00m@0: // IE has trouble with opacity if it does not have layout
indvd00m@0: // Force it by setting the zoom level
indvd00m@0: style.zoom = 1;
indvd00m@0:
indvd00m@0: // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
indvd00m@0: // if value === "", then remove inline opacity #12685
indvd00m@0: if ( ( value >= 1 || value === "" ) &&
indvd00m@0: jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
indvd00m@0: style.removeAttribute ) {
indvd00m@0:
indvd00m@0: // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
indvd00m@0: // if "filter:" is present at all, clearType is disabled, we want to avoid this
indvd00m@0: // style.removeAttribute is IE Only, but so apparently is this code path...
indvd00m@0: style.removeAttribute( "filter" );
indvd00m@0:
indvd00m@0: // if there is no filter style applied in a css rule or unset inline opacity, we are done
indvd00m@0: if ( value === "" || currentStyle && !currentStyle.filter ) {
indvd00m@0: return;
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // otherwise, set new filter values
indvd00m@0: style.filter = ralpha.test( filter ) ?
indvd00m@0: filter.replace( ralpha, opacity ) :
indvd00m@0: filter + " " + opacity;
indvd00m@0: }
indvd00m@0: };
indvd00m@0: }
indvd00m@0:
indvd00m@0: jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
indvd00m@0: function( elem, computed ) {
indvd00m@0: if ( computed ) {
indvd00m@0: // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
indvd00m@0: // Work around by temporarily setting element display to inline-block
indvd00m@0: return jQuery.swap( elem, { "display": "inline-block" },
indvd00m@0: curCSS, [ elem, "marginRight" ] );
indvd00m@0: }
indvd00m@0: }
indvd00m@0: );
indvd00m@0:
indvd00m@0: // These hooks are used by animate to expand properties
indvd00m@0: jQuery.each({
indvd00m@0: margin: "",
indvd00m@0: padding: "",
indvd00m@0: border: "Width"
indvd00m@0: }, function( prefix, suffix ) {
indvd00m@0: jQuery.cssHooks[ prefix + suffix ] = {
indvd00m@0: expand: function( value ) {
indvd00m@0: var i = 0,
indvd00m@0: expanded = {},
indvd00m@0:
indvd00m@0: // assumes a single number if not a string
indvd00m@0: parts = typeof value === "string" ? value.split(" ") : [ value ];
indvd00m@0:
indvd00m@0: for ( ; i < 4; i++ ) {
indvd00m@0: expanded[ prefix + cssExpand[ i ] + suffix ] =
indvd00m@0: parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
indvd00m@0: }
indvd00m@0:
indvd00m@0: return expanded;
indvd00m@0: }
indvd00m@0: };
indvd00m@0:
indvd00m@0: if ( !rmargin.test( prefix ) ) {
indvd00m@0: jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0: jQuery.fn.extend({
indvd00m@0: css: function( name, value ) {
indvd00m@0: return access( this, function( elem, name, value ) {
indvd00m@0: var styles, len,
indvd00m@0: map = {},
indvd00m@0: i = 0;
indvd00m@0:
indvd00m@0: if ( jQuery.isArray( name ) ) {
indvd00m@0: styles = getStyles( elem );
indvd00m@0: len = name.length;
indvd00m@0:
indvd00m@0: for ( ; i < len; i++ ) {
indvd00m@0: map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
indvd00m@0: }
indvd00m@0:
indvd00m@0: return map;
indvd00m@0: }
indvd00m@0:
indvd00m@0: return value !== undefined ?
indvd00m@0: jQuery.style( elem, name, value ) :
indvd00m@0: jQuery.css( elem, name );
indvd00m@0: }, name, value, arguments.length > 1 );
indvd00m@0: },
indvd00m@0: show: function() {
indvd00m@0: return showHide( this, true );
indvd00m@0: },
indvd00m@0: hide: function() {
indvd00m@0: return showHide( this );
indvd00m@0: },
indvd00m@0: toggle: function( state ) {
indvd00m@0: if ( typeof state === "boolean" ) {
indvd00m@0: return state ? this.show() : this.hide();
indvd00m@0: }
indvd00m@0:
indvd00m@0: return this.each(function() {
indvd00m@0: if ( isHidden( this ) ) {
indvd00m@0: jQuery( this ).show();
indvd00m@0: } else {
indvd00m@0: jQuery( this ).hide();
indvd00m@0: }
indvd00m@0: });
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0:
indvd00m@0: function Tween( elem, options, prop, end, easing ) {
indvd00m@0: return new Tween.prototype.init( elem, options, prop, end, easing );
indvd00m@0: }
indvd00m@0: jQuery.Tween = Tween;
indvd00m@0:
indvd00m@0: Tween.prototype = {
indvd00m@0: constructor: Tween,
indvd00m@0: init: function( elem, options, prop, end, easing, unit ) {
indvd00m@0: this.elem = elem;
indvd00m@0: this.prop = prop;
indvd00m@0: this.easing = easing || "swing";
indvd00m@0: this.options = options;
indvd00m@0: this.start = this.now = this.cur();
indvd00m@0: this.end = end;
indvd00m@0: this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
indvd00m@0: },
indvd00m@0: cur: function() {
indvd00m@0: var hooks = Tween.propHooks[ this.prop ];
indvd00m@0:
indvd00m@0: return hooks && hooks.get ?
indvd00m@0: hooks.get( this ) :
indvd00m@0: Tween.propHooks._default.get( this );
indvd00m@0: },
indvd00m@0: run: function( percent ) {
indvd00m@0: var eased,
indvd00m@0: hooks = Tween.propHooks[ this.prop ];
indvd00m@0:
indvd00m@0: if ( this.options.duration ) {
indvd00m@0: this.pos = eased = jQuery.easing[ this.easing ](
indvd00m@0: percent, this.options.duration * percent, 0, 1, this.options.duration
indvd00m@0: );
indvd00m@0: } else {
indvd00m@0: this.pos = eased = percent;
indvd00m@0: }
indvd00m@0: this.now = ( this.end - this.start ) * eased + this.start;
indvd00m@0:
indvd00m@0: if ( this.options.step ) {
indvd00m@0: this.options.step.call( this.elem, this.now, this );
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( hooks && hooks.set ) {
indvd00m@0: hooks.set( this );
indvd00m@0: } else {
indvd00m@0: Tween.propHooks._default.set( this );
indvd00m@0: }
indvd00m@0: return this;
indvd00m@0: }
indvd00m@0: };
indvd00m@0:
indvd00m@0: Tween.prototype.init.prototype = Tween.prototype;
indvd00m@0:
indvd00m@0: Tween.propHooks = {
indvd00m@0: _default: {
indvd00m@0: get: function( tween ) {
indvd00m@0: var result;
indvd00m@0:
indvd00m@0: if ( tween.elem[ tween.prop ] != null &&
indvd00m@0: (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
indvd00m@0: return tween.elem[ tween.prop ];
indvd00m@0: }
indvd00m@0:
indvd00m@0: // passing an empty string as a 3rd parameter to .css will automatically
indvd00m@0: // attempt a parseFloat and fallback to a string if the parse fails
indvd00m@0: // so, simple values such as "10px" are parsed to Float.
indvd00m@0: // complex values such as "rotate(1rad)" are returned as is.
indvd00m@0: result = jQuery.css( tween.elem, tween.prop, "" );
indvd00m@0: // Empty strings, null, undefined and "auto" are converted to 0.
indvd00m@0: return !result || result === "auto" ? 0 : result;
indvd00m@0: },
indvd00m@0: set: function( tween ) {
indvd00m@0: // use step hook for back compat - use cssHook if its there - use .style if its
indvd00m@0: // available and use plain properties where available
indvd00m@0: if ( jQuery.fx.step[ tween.prop ] ) {
indvd00m@0: jQuery.fx.step[ tween.prop ]( tween );
indvd00m@0: } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
indvd00m@0: jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
indvd00m@0: } else {
indvd00m@0: tween.elem[ tween.prop ] = tween.now;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0: };
indvd00m@0:
indvd00m@0: // Support: IE <=9
indvd00m@0: // Panic based approach to setting things on disconnected nodes
indvd00m@0:
indvd00m@0: Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
indvd00m@0: set: function( tween ) {
indvd00m@0: if ( tween.elem.nodeType && tween.elem.parentNode ) {
indvd00m@0: tween.elem[ tween.prop ] = tween.now;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: };
indvd00m@0:
indvd00m@0: jQuery.easing = {
indvd00m@0: linear: function( p ) {
indvd00m@0: return p;
indvd00m@0: },
indvd00m@0: swing: function( p ) {
indvd00m@0: return 0.5 - Math.cos( p * Math.PI ) / 2;
indvd00m@0: }
indvd00m@0: };
indvd00m@0:
indvd00m@0: jQuery.fx = Tween.prototype.init;
indvd00m@0:
indvd00m@0: // Back Compat <1.8 extension point
indvd00m@0: jQuery.fx.step = {};
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0: var
indvd00m@0: fxNow, timerId,
indvd00m@0: rfxtypes = /^(?:toggle|show|hide)$/,
indvd00m@0: rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ),
indvd00m@0: rrun = /queueHooks$/,
indvd00m@0: animationPrefilters = [ defaultPrefilter ],
indvd00m@0: tweeners = {
indvd00m@0: "*": [ function( prop, value ) {
indvd00m@0: var tween = this.createTween( prop, value ),
indvd00m@0: target = tween.cur(),
indvd00m@0: parts = rfxnum.exec( value ),
indvd00m@0: unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
indvd00m@0:
indvd00m@0: // Starting value computation is required for potential unit mismatches
indvd00m@0: start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
indvd00m@0: rfxnum.exec( jQuery.css( tween.elem, prop ) ),
indvd00m@0: scale = 1,
indvd00m@0: maxIterations = 20;
indvd00m@0:
indvd00m@0: if ( start && start[ 3 ] !== unit ) {
indvd00m@0: // Trust units reported by jQuery.css
indvd00m@0: unit = unit || start[ 3 ];
indvd00m@0:
indvd00m@0: // Make sure we update the tween properties later on
indvd00m@0: parts = parts || [];
indvd00m@0:
indvd00m@0: // Iteratively approximate from a nonzero starting point
indvd00m@0: start = +target || 1;
indvd00m@0:
indvd00m@0: do {
indvd00m@0: // If previous iteration zeroed out, double until we get *something*
indvd00m@0: // Use a string for doubling factor so we don't accidentally see scale as unchanged below
indvd00m@0: scale = scale || ".5";
indvd00m@0:
indvd00m@0: // Adjust and apply
indvd00m@0: start = start / scale;
indvd00m@0: jQuery.style( tween.elem, prop, start + unit );
indvd00m@0:
indvd00m@0: // Update scale, tolerating zero or NaN from tween.cur()
indvd00m@0: // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
indvd00m@0: } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Update tween properties
indvd00m@0: if ( parts ) {
indvd00m@0: start = tween.start = +start || +target || 0;
indvd00m@0: tween.unit = unit;
indvd00m@0: // If a +=/-= token was provided, we're doing a relative animation
indvd00m@0: tween.end = parts[ 1 ] ?
indvd00m@0: start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
indvd00m@0: +parts[ 2 ];
indvd00m@0: }
indvd00m@0:
indvd00m@0: return tween;
indvd00m@0: } ]
indvd00m@0: };
indvd00m@0:
indvd00m@0: // Animations created synchronously will run synchronously
indvd00m@0: function createFxNow() {
indvd00m@0: setTimeout(function() {
indvd00m@0: fxNow = undefined;
indvd00m@0: });
indvd00m@0: return ( fxNow = jQuery.now() );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Generate parameters to create a standard animation
indvd00m@0: function genFx( type, includeWidth ) {
indvd00m@0: var which,
indvd00m@0: attrs = { height: type },
indvd00m@0: i = 0;
indvd00m@0:
indvd00m@0: // if we include width, step value is 1 to do all cssExpand values,
indvd00m@0: // if we don't include width, step value is 2 to skip over Left and Right
indvd00m@0: includeWidth = includeWidth ? 1 : 0;
indvd00m@0: for ( ; i < 4 ; i += 2 - includeWidth ) {
indvd00m@0: which = cssExpand[ i ];
indvd00m@0: attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( includeWidth ) {
indvd00m@0: attrs.opacity = attrs.width = type;
indvd00m@0: }
indvd00m@0:
indvd00m@0: return attrs;
indvd00m@0: }
indvd00m@0:
indvd00m@0: function createTween( value, prop, animation ) {
indvd00m@0: var tween,
indvd00m@0: collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
indvd00m@0: index = 0,
indvd00m@0: length = collection.length;
indvd00m@0: for ( ; index < length; index++ ) {
indvd00m@0: if ( (tween = collection[ index ].call( animation, prop, value )) ) {
indvd00m@0:
indvd00m@0: // we're done with this property
indvd00m@0: return tween;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: function defaultPrefilter( elem, props, opts ) {
indvd00m@0: /* jshint validthis: true */
indvd00m@0: var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
indvd00m@0: anim = this,
indvd00m@0: orig = {},
indvd00m@0: style = elem.style,
indvd00m@0: hidden = elem.nodeType && isHidden( elem ),
indvd00m@0: dataShow = jQuery._data( elem, "fxshow" );
indvd00m@0:
indvd00m@0: // handle queue: false promises
indvd00m@0: if ( !opts.queue ) {
indvd00m@0: hooks = jQuery._queueHooks( elem, "fx" );
indvd00m@0: if ( hooks.unqueued == null ) {
indvd00m@0: hooks.unqueued = 0;
indvd00m@0: oldfire = hooks.empty.fire;
indvd00m@0: hooks.empty.fire = function() {
indvd00m@0: if ( !hooks.unqueued ) {
indvd00m@0: oldfire();
indvd00m@0: }
indvd00m@0: };
indvd00m@0: }
indvd00m@0: hooks.unqueued++;
indvd00m@0:
indvd00m@0: anim.always(function() {
indvd00m@0: // doing this makes sure that the complete handler will be called
indvd00m@0: // before this completes
indvd00m@0: anim.always(function() {
indvd00m@0: hooks.unqueued--;
indvd00m@0: if ( !jQuery.queue( elem, "fx" ).length ) {
indvd00m@0: hooks.empty.fire();
indvd00m@0: }
indvd00m@0: });
indvd00m@0: });
indvd00m@0: }
indvd00m@0:
indvd00m@0: // height/width overflow pass
indvd00m@0: if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
indvd00m@0: // Make sure that nothing sneaks out
indvd00m@0: // Record all 3 overflow attributes because IE does not
indvd00m@0: // change the overflow attribute when overflowX and
indvd00m@0: // overflowY are set to the same value
indvd00m@0: opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
indvd00m@0:
indvd00m@0: // Set display property to inline-block for height/width
indvd00m@0: // animations on inline elements that are having width/height animated
indvd00m@0: display = jQuery.css( elem, "display" );
indvd00m@0:
indvd00m@0: // Test default display if display is currently "none"
indvd00m@0: checkDisplay = display === "none" ?
indvd00m@0: jQuery._data( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
indvd00m@0:
indvd00m@0: if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
indvd00m@0:
indvd00m@0: // inline-level elements accept inline-block;
indvd00m@0: // block-level elements need to be inline with layout
indvd00m@0: if ( !support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) {
indvd00m@0: style.display = "inline-block";
indvd00m@0: } else {
indvd00m@0: style.zoom = 1;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( opts.overflow ) {
indvd00m@0: style.overflow = "hidden";
indvd00m@0: if ( !support.shrinkWrapBlocks() ) {
indvd00m@0: anim.always(function() {
indvd00m@0: style.overflow = opts.overflow[ 0 ];
indvd00m@0: style.overflowX = opts.overflow[ 1 ];
indvd00m@0: style.overflowY = opts.overflow[ 2 ];
indvd00m@0: });
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // show/hide pass
indvd00m@0: for ( prop in props ) {
indvd00m@0: value = props[ prop ];
indvd00m@0: if ( rfxtypes.exec( value ) ) {
indvd00m@0: delete props[ prop ];
indvd00m@0: toggle = toggle || value === "toggle";
indvd00m@0: if ( value === ( hidden ? "hide" : "show" ) ) {
indvd00m@0:
indvd00m@0: // If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden
indvd00m@0: if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
indvd00m@0: hidden = true;
indvd00m@0: } else {
indvd00m@0: continue;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
indvd00m@0:
indvd00m@0: // Any non-fx value stops us from restoring the original display value
indvd00m@0: } else {
indvd00m@0: display = undefined;
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( !jQuery.isEmptyObject( orig ) ) {
indvd00m@0: if ( dataShow ) {
indvd00m@0: if ( "hidden" in dataShow ) {
indvd00m@0: hidden = dataShow.hidden;
indvd00m@0: }
indvd00m@0: } else {
indvd00m@0: dataShow = jQuery._data( elem, "fxshow", {} );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // store state if its toggle - enables .stop().toggle() to "reverse"
indvd00m@0: if ( toggle ) {
indvd00m@0: dataShow.hidden = !hidden;
indvd00m@0: }
indvd00m@0: if ( hidden ) {
indvd00m@0: jQuery( elem ).show();
indvd00m@0: } else {
indvd00m@0: anim.done(function() {
indvd00m@0: jQuery( elem ).hide();
indvd00m@0: });
indvd00m@0: }
indvd00m@0: anim.done(function() {
indvd00m@0: var prop;
indvd00m@0: jQuery._removeData( elem, "fxshow" );
indvd00m@0: for ( prop in orig ) {
indvd00m@0: jQuery.style( elem, prop, orig[ prop ] );
indvd00m@0: }
indvd00m@0: });
indvd00m@0: for ( prop in orig ) {
indvd00m@0: tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
indvd00m@0:
indvd00m@0: if ( !( prop in dataShow ) ) {
indvd00m@0: dataShow[ prop ] = tween.start;
indvd00m@0: if ( hidden ) {
indvd00m@0: tween.end = tween.start;
indvd00m@0: tween.start = prop === "width" || prop === "height" ? 1 : 0;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // If this is a noop like .hide().hide(), restore an overwritten display value
indvd00m@0: } else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) {
indvd00m@0: style.display = display;
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: function propFilter( props, specialEasing ) {
indvd00m@0: var index, name, easing, value, hooks;
indvd00m@0:
indvd00m@0: // camelCase, specialEasing and expand cssHook pass
indvd00m@0: for ( index in props ) {
indvd00m@0: name = jQuery.camelCase( index );
indvd00m@0: easing = specialEasing[ name ];
indvd00m@0: value = props[ index ];
indvd00m@0: if ( jQuery.isArray( value ) ) {
indvd00m@0: easing = value[ 1 ];
indvd00m@0: value = props[ index ] = value[ 0 ];
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( index !== name ) {
indvd00m@0: props[ name ] = value;
indvd00m@0: delete props[ index ];
indvd00m@0: }
indvd00m@0:
indvd00m@0: hooks = jQuery.cssHooks[ name ];
indvd00m@0: if ( hooks && "expand" in hooks ) {
indvd00m@0: value = hooks.expand( value );
indvd00m@0: delete props[ name ];
indvd00m@0:
indvd00m@0: // not quite $.extend, this wont overwrite keys already present.
indvd00m@0: // also - reusing 'index' from above because we have the correct "name"
indvd00m@0: for ( index in value ) {
indvd00m@0: if ( !( index in props ) ) {
indvd00m@0: props[ index ] = value[ index ];
indvd00m@0: specialEasing[ index ] = easing;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: } else {
indvd00m@0: specialEasing[ name ] = easing;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: function Animation( elem, properties, options ) {
indvd00m@0: var result,
indvd00m@0: stopped,
indvd00m@0: index = 0,
indvd00m@0: length = animationPrefilters.length,
indvd00m@0: deferred = jQuery.Deferred().always( function() {
indvd00m@0: // don't match elem in the :animated selector
indvd00m@0: delete tick.elem;
indvd00m@0: }),
indvd00m@0: tick = function() {
indvd00m@0: if ( stopped ) {
indvd00m@0: return false;
indvd00m@0: }
indvd00m@0: var currentTime = fxNow || createFxNow(),
indvd00m@0: remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
indvd00m@0: // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
indvd00m@0: temp = remaining / animation.duration || 0,
indvd00m@0: percent = 1 - temp,
indvd00m@0: index = 0,
indvd00m@0: length = animation.tweens.length;
indvd00m@0:
indvd00m@0: for ( ; index < length ; index++ ) {
indvd00m@0: animation.tweens[ index ].run( percent );
indvd00m@0: }
indvd00m@0:
indvd00m@0: deferred.notifyWith( elem, [ animation, percent, remaining ]);
indvd00m@0:
indvd00m@0: if ( percent < 1 && length ) {
indvd00m@0: return remaining;
indvd00m@0: } else {
indvd00m@0: deferred.resolveWith( elem, [ animation ] );
indvd00m@0: return false;
indvd00m@0: }
indvd00m@0: },
indvd00m@0: animation = deferred.promise({
indvd00m@0: elem: elem,
indvd00m@0: props: jQuery.extend( {}, properties ),
indvd00m@0: opts: jQuery.extend( true, { specialEasing: {} }, options ),
indvd00m@0: originalProperties: properties,
indvd00m@0: originalOptions: options,
indvd00m@0: startTime: fxNow || createFxNow(),
indvd00m@0: duration: options.duration,
indvd00m@0: tweens: [],
indvd00m@0: createTween: function( prop, end ) {
indvd00m@0: var tween = jQuery.Tween( elem, animation.opts, prop, end,
indvd00m@0: animation.opts.specialEasing[ prop ] || animation.opts.easing );
indvd00m@0: animation.tweens.push( tween );
indvd00m@0: return tween;
indvd00m@0: },
indvd00m@0: stop: function( gotoEnd ) {
indvd00m@0: var index = 0,
indvd00m@0: // if we are going to the end, we want to run all the tweens
indvd00m@0: // otherwise we skip this part
indvd00m@0: length = gotoEnd ? animation.tweens.length : 0;
indvd00m@0: if ( stopped ) {
indvd00m@0: return this;
indvd00m@0: }
indvd00m@0: stopped = true;
indvd00m@0: for ( ; index < length ; index++ ) {
indvd00m@0: animation.tweens[ index ].run( 1 );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // resolve when we played the last frame
indvd00m@0: // otherwise, reject
indvd00m@0: if ( gotoEnd ) {
indvd00m@0: deferred.resolveWith( elem, [ animation, gotoEnd ] );
indvd00m@0: } else {
indvd00m@0: deferred.rejectWith( elem, [ animation, gotoEnd ] );
indvd00m@0: }
indvd00m@0: return this;
indvd00m@0: }
indvd00m@0: }),
indvd00m@0: props = animation.props;
indvd00m@0:
indvd00m@0: propFilter( props, animation.opts.specialEasing );
indvd00m@0:
indvd00m@0: for ( ; index < length ; index++ ) {
indvd00m@0: result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
indvd00m@0: if ( result ) {
indvd00m@0: return result;
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: jQuery.map( props, createTween, animation );
indvd00m@0:
indvd00m@0: if ( jQuery.isFunction( animation.opts.start ) ) {
indvd00m@0: animation.opts.start.call( elem, animation );
indvd00m@0: }
indvd00m@0:
indvd00m@0: jQuery.fx.timer(
indvd00m@0: jQuery.extend( tick, {
indvd00m@0: elem: elem,
indvd00m@0: anim: animation,
indvd00m@0: queue: animation.opts.queue
indvd00m@0: })
indvd00m@0: );
indvd00m@0:
indvd00m@0: // attach callbacks from options
indvd00m@0: return animation.progress( animation.opts.progress )
indvd00m@0: .done( animation.opts.done, animation.opts.complete )
indvd00m@0: .fail( animation.opts.fail )
indvd00m@0: .always( animation.opts.always );
indvd00m@0: }
indvd00m@0:
indvd00m@0: jQuery.Animation = jQuery.extend( Animation, {
indvd00m@0: tweener: function( props, callback ) {
indvd00m@0: if ( jQuery.isFunction( props ) ) {
indvd00m@0: callback = props;
indvd00m@0: props = [ "*" ];
indvd00m@0: } else {
indvd00m@0: props = props.split(" ");
indvd00m@0: }
indvd00m@0:
indvd00m@0: var prop,
indvd00m@0: index = 0,
indvd00m@0: length = props.length;
indvd00m@0:
indvd00m@0: for ( ; index < length ; index++ ) {
indvd00m@0: prop = props[ index ];
indvd00m@0: tweeners[ prop ] = tweeners[ prop ] || [];
indvd00m@0: tweeners[ prop ].unshift( callback );
indvd00m@0: }
indvd00m@0: },
indvd00m@0:
indvd00m@0: prefilter: function( callback, prepend ) {
indvd00m@0: if ( prepend ) {
indvd00m@0: animationPrefilters.unshift( callback );
indvd00m@0: } else {
indvd00m@0: animationPrefilters.push( callback );
indvd00m@0: }
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0: jQuery.speed = function( speed, easing, fn ) {
indvd00m@0: var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
indvd00m@0: complete: fn || !fn && easing ||
indvd00m@0: jQuery.isFunction( speed ) && speed,
indvd00m@0: duration: speed,
indvd00m@0: easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
indvd00m@0: };
indvd00m@0:
indvd00m@0: opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
indvd00m@0: opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
indvd00m@0:
indvd00m@0: // normalize opt.queue - true/undefined/null -> "fx"
indvd00m@0: if ( opt.queue == null || opt.queue === true ) {
indvd00m@0: opt.queue = "fx";
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Queueing
indvd00m@0: opt.old = opt.complete;
indvd00m@0:
indvd00m@0: opt.complete = function() {
indvd00m@0: if ( jQuery.isFunction( opt.old ) ) {
indvd00m@0: opt.old.call( this );
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( opt.queue ) {
indvd00m@0: jQuery.dequeue( this, opt.queue );
indvd00m@0: }
indvd00m@0: };
indvd00m@0:
indvd00m@0: return opt;
indvd00m@0: };
indvd00m@0:
indvd00m@0: jQuery.fn.extend({
indvd00m@0: fadeTo: function( speed, to, easing, callback ) {
indvd00m@0:
indvd00m@0: // show any hidden elements after setting opacity to 0
indvd00m@0: return this.filter( isHidden ).css( "opacity", 0 ).show()
indvd00m@0:
indvd00m@0: // animate to the value specified
indvd00m@0: .end().animate({ opacity: to }, speed, easing, callback );
indvd00m@0: },
indvd00m@0: animate: function( prop, speed, easing, callback ) {
indvd00m@0: var empty = jQuery.isEmptyObject( prop ),
indvd00m@0: optall = jQuery.speed( speed, easing, callback ),
indvd00m@0: doAnimation = function() {
indvd00m@0: // Operate on a copy of prop so per-property easing won't be lost
indvd00m@0: var anim = Animation( this, jQuery.extend( {}, prop ), optall );
indvd00m@0:
indvd00m@0: // Empty animations, or finishing resolves immediately
indvd00m@0: if ( empty || jQuery._data( this, "finish" ) ) {
indvd00m@0: anim.stop( true );
indvd00m@0: }
indvd00m@0: };
indvd00m@0: doAnimation.finish = doAnimation;
indvd00m@0:
indvd00m@0: return empty || optall.queue === false ?
indvd00m@0: this.each( doAnimation ) :
indvd00m@0: this.queue( optall.queue, doAnimation );
indvd00m@0: },
indvd00m@0: stop: function( type, clearQueue, gotoEnd ) {
indvd00m@0: var stopQueue = function( hooks ) {
indvd00m@0: var stop = hooks.stop;
indvd00m@0: delete hooks.stop;
indvd00m@0: stop( gotoEnd );
indvd00m@0: };
indvd00m@0:
indvd00m@0: if ( typeof type !== "string" ) {
indvd00m@0: gotoEnd = clearQueue;
indvd00m@0: clearQueue = type;
indvd00m@0: type = undefined;
indvd00m@0: }
indvd00m@0: if ( clearQueue && type !== false ) {
indvd00m@0: this.queue( type || "fx", [] );
indvd00m@0: }
indvd00m@0:
indvd00m@0: return this.each(function() {
indvd00m@0: var dequeue = true,
indvd00m@0: index = type != null && type + "queueHooks",
indvd00m@0: timers = jQuery.timers,
indvd00m@0: data = jQuery._data( this );
indvd00m@0:
indvd00m@0: if ( index ) {
indvd00m@0: if ( data[ index ] && data[ index ].stop ) {
indvd00m@0: stopQueue( data[ index ] );
indvd00m@0: }
indvd00m@0: } else {
indvd00m@0: for ( index in data ) {
indvd00m@0: if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
indvd00m@0: stopQueue( data[ index ] );
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: for ( index = timers.length; index--; ) {
indvd00m@0: if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
indvd00m@0: timers[ index ].anim.stop( gotoEnd );
indvd00m@0: dequeue = false;
indvd00m@0: timers.splice( index, 1 );
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // start the next in the queue if the last step wasn't forced
indvd00m@0: // timers currently will call their complete callbacks, which will dequeue
indvd00m@0: // but only if they were gotoEnd
indvd00m@0: if ( dequeue || !gotoEnd ) {
indvd00m@0: jQuery.dequeue( this, type );
indvd00m@0: }
indvd00m@0: });
indvd00m@0: },
indvd00m@0: finish: function( type ) {
indvd00m@0: if ( type !== false ) {
indvd00m@0: type = type || "fx";
indvd00m@0: }
indvd00m@0: return this.each(function() {
indvd00m@0: var index,
indvd00m@0: data = jQuery._data( this ),
indvd00m@0: queue = data[ type + "queue" ],
indvd00m@0: hooks = data[ type + "queueHooks" ],
indvd00m@0: timers = jQuery.timers,
indvd00m@0: length = queue ? queue.length : 0;
indvd00m@0:
indvd00m@0: // enable finishing flag on private data
indvd00m@0: data.finish = true;
indvd00m@0:
indvd00m@0: // empty the queue first
indvd00m@0: jQuery.queue( this, type, [] );
indvd00m@0:
indvd00m@0: if ( hooks && hooks.stop ) {
indvd00m@0: hooks.stop.call( this, true );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // look for any active animations, and finish them
indvd00m@0: for ( index = timers.length; index--; ) {
indvd00m@0: if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
indvd00m@0: timers[ index ].anim.stop( true );
indvd00m@0: timers.splice( index, 1 );
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // look for any animations in the old queue and finish them
indvd00m@0: for ( index = 0; index < length; index++ ) {
indvd00m@0: if ( queue[ index ] && queue[ index ].finish ) {
indvd00m@0: queue[ index ].finish.call( this );
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // turn off finishing flag
indvd00m@0: delete data.finish;
indvd00m@0: });
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0: jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
indvd00m@0: var cssFn = jQuery.fn[ name ];
indvd00m@0: jQuery.fn[ name ] = function( speed, easing, callback ) {
indvd00m@0: return speed == null || typeof speed === "boolean" ?
indvd00m@0: cssFn.apply( this, arguments ) :
indvd00m@0: this.animate( genFx( name, true ), speed, easing, callback );
indvd00m@0: };
indvd00m@0: });
indvd00m@0:
indvd00m@0: // Generate shortcuts for custom animations
indvd00m@0: jQuery.each({
indvd00m@0: slideDown: genFx("show"),
indvd00m@0: slideUp: genFx("hide"),
indvd00m@0: slideToggle: genFx("toggle"),
indvd00m@0: fadeIn: { opacity: "show" },
indvd00m@0: fadeOut: { opacity: "hide" },
indvd00m@0: fadeToggle: { opacity: "toggle" }
indvd00m@0: }, function( name, props ) {
indvd00m@0: jQuery.fn[ name ] = function( speed, easing, callback ) {
indvd00m@0: return this.animate( props, speed, easing, callback );
indvd00m@0: };
indvd00m@0: });
indvd00m@0:
indvd00m@0: jQuery.timers = [];
indvd00m@0: jQuery.fx.tick = function() {
indvd00m@0: var timer,
indvd00m@0: timers = jQuery.timers,
indvd00m@0: i = 0;
indvd00m@0:
indvd00m@0: fxNow = jQuery.now();
indvd00m@0:
indvd00m@0: for ( ; i < timers.length; i++ ) {
indvd00m@0: timer = timers[ i ];
indvd00m@0: // Checks the timer has not already been removed
indvd00m@0: if ( !timer() && timers[ i ] === timer ) {
indvd00m@0: timers.splice( i--, 1 );
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( !timers.length ) {
indvd00m@0: jQuery.fx.stop();
indvd00m@0: }
indvd00m@0: fxNow = undefined;
indvd00m@0: };
indvd00m@0:
indvd00m@0: jQuery.fx.timer = function( timer ) {
indvd00m@0: jQuery.timers.push( timer );
indvd00m@0: if ( timer() ) {
indvd00m@0: jQuery.fx.start();
indvd00m@0: } else {
indvd00m@0: jQuery.timers.pop();
indvd00m@0: }
indvd00m@0: };
indvd00m@0:
indvd00m@0: jQuery.fx.interval = 13;
indvd00m@0:
indvd00m@0: jQuery.fx.start = function() {
indvd00m@0: if ( !timerId ) {
indvd00m@0: timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
indvd00m@0: }
indvd00m@0: };
indvd00m@0:
indvd00m@0: jQuery.fx.stop = function() {
indvd00m@0: clearInterval( timerId );
indvd00m@0: timerId = null;
indvd00m@0: };
indvd00m@0:
indvd00m@0: jQuery.fx.speeds = {
indvd00m@0: slow: 600,
indvd00m@0: fast: 200,
indvd00m@0: // Default speed
indvd00m@0: _default: 400
indvd00m@0: };
indvd00m@0:
indvd00m@0:
indvd00m@0: // Based off of the plugin by Clint Helfers, with permission.
indvd00m@0: // http://blindsignals.com/index.php/2009/07/jquery-delay/
indvd00m@0: jQuery.fn.delay = function( time, type ) {
indvd00m@0: time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
indvd00m@0: type = type || "fx";
indvd00m@0:
indvd00m@0: return this.queue( type, function( next, hooks ) {
indvd00m@0: var timeout = setTimeout( next, time );
indvd00m@0: hooks.stop = function() {
indvd00m@0: clearTimeout( timeout );
indvd00m@0: };
indvd00m@0: });
indvd00m@0: };
indvd00m@0:
indvd00m@0:
indvd00m@0: (function() {
indvd00m@0: // Minified: var a,b,c,d,e
indvd00m@0: var input, div, select, a, opt;
indvd00m@0:
indvd00m@0: // Setup
indvd00m@0: div = document.createElement( "div" );
indvd00m@0: div.setAttribute( "className", "t" );
indvd00m@0: div.innerHTML = " a";
indvd00m@0: a = div.getElementsByTagName("a")[ 0 ];
indvd00m@0:
indvd00m@0: // First batch of tests.
indvd00m@0: select = document.createElement("select");
indvd00m@0: opt = select.appendChild( document.createElement("option") );
indvd00m@0: input = div.getElementsByTagName("input")[ 0 ];
indvd00m@0:
indvd00m@0: a.style.cssText = "top:1px";
indvd00m@0:
indvd00m@0: // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
indvd00m@0: support.getSetAttribute = div.className !== "t";
indvd00m@0:
indvd00m@0: // Get the style information from getAttribute
indvd00m@0: // (IE uses .cssText instead)
indvd00m@0: support.style = /top/.test( a.getAttribute("style") );
indvd00m@0:
indvd00m@0: // Make sure that URLs aren't manipulated
indvd00m@0: // (IE normalizes it by default)
indvd00m@0: support.hrefNormalized = a.getAttribute("href") === "/a";
indvd00m@0:
indvd00m@0: // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
indvd00m@0: support.checkOn = !!input.value;
indvd00m@0:
indvd00m@0: // Make sure that a selected-by-default option has a working selected property.
indvd00m@0: // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
indvd00m@0: support.optSelected = opt.selected;
indvd00m@0:
indvd00m@0: // Tests for enctype support on a form (#6743)
indvd00m@0: support.enctype = !!document.createElement("form").enctype;
indvd00m@0:
indvd00m@0: // Make sure that the options inside disabled selects aren't marked as disabled
indvd00m@0: // (WebKit marks them as disabled)
indvd00m@0: select.disabled = true;
indvd00m@0: support.optDisabled = !opt.disabled;
indvd00m@0:
indvd00m@0: // Support: IE8 only
indvd00m@0: // Check if we can trust getAttribute("value")
indvd00m@0: input = document.createElement( "input" );
indvd00m@0: input.setAttribute( "value", "" );
indvd00m@0: support.input = input.getAttribute( "value" ) === "";
indvd00m@0:
indvd00m@0: // Check if an input maintains its value after becoming a radio
indvd00m@0: input.value = "t";
indvd00m@0: input.setAttribute( "type", "radio" );
indvd00m@0: support.radioValue = input.value === "t";
indvd00m@0: })();
indvd00m@0:
indvd00m@0:
indvd00m@0: var rreturn = /\r/g;
indvd00m@0:
indvd00m@0: jQuery.fn.extend({
indvd00m@0: val: function( value ) {
indvd00m@0: var hooks, ret, isFunction,
indvd00m@0: elem = this[0];
indvd00m@0:
indvd00m@0: if ( !arguments.length ) {
indvd00m@0: if ( elem ) {
indvd00m@0: hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
indvd00m@0:
indvd00m@0: if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
indvd00m@0: return ret;
indvd00m@0: }
indvd00m@0:
indvd00m@0: ret = elem.value;
indvd00m@0:
indvd00m@0: return typeof ret === "string" ?
indvd00m@0: // handle most common string cases
indvd00m@0: ret.replace(rreturn, "") :
indvd00m@0: // handle cases where value is null/undef or number
indvd00m@0: ret == null ? "" : ret;
indvd00m@0: }
indvd00m@0:
indvd00m@0: return;
indvd00m@0: }
indvd00m@0:
indvd00m@0: isFunction = jQuery.isFunction( value );
indvd00m@0:
indvd00m@0: return this.each(function( i ) {
indvd00m@0: var val;
indvd00m@0:
indvd00m@0: if ( this.nodeType !== 1 ) {
indvd00m@0: return;
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( isFunction ) {
indvd00m@0: val = value.call( this, i, jQuery( this ).val() );
indvd00m@0: } else {
indvd00m@0: val = value;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Treat null/undefined as ""; convert numbers to string
indvd00m@0: if ( val == null ) {
indvd00m@0: val = "";
indvd00m@0: } else if ( typeof val === "number" ) {
indvd00m@0: val += "";
indvd00m@0: } else if ( jQuery.isArray( val ) ) {
indvd00m@0: val = jQuery.map( val, function( value ) {
indvd00m@0: return value == null ? "" : value + "";
indvd00m@0: });
indvd00m@0: }
indvd00m@0:
indvd00m@0: hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
indvd00m@0:
indvd00m@0: // If set returns undefined, fall back to normal setting
indvd00m@0: if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
indvd00m@0: this.value = val;
indvd00m@0: }
indvd00m@0: });
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0: jQuery.extend({
indvd00m@0: valHooks: {
indvd00m@0: option: {
indvd00m@0: get: function( elem ) {
indvd00m@0: var val = jQuery.find.attr( elem, "value" );
indvd00m@0: return val != null ?
indvd00m@0: val :
indvd00m@0: // Support: IE10-11+
indvd00m@0: // option.text throws exceptions (#14686, #14858)
indvd00m@0: jQuery.trim( jQuery.text( elem ) );
indvd00m@0: }
indvd00m@0: },
indvd00m@0: select: {
indvd00m@0: get: function( elem ) {
indvd00m@0: var value, option,
indvd00m@0: options = elem.options,
indvd00m@0: index = elem.selectedIndex,
indvd00m@0: one = elem.type === "select-one" || index < 0,
indvd00m@0: values = one ? null : [],
indvd00m@0: max = one ? index + 1 : options.length,
indvd00m@0: i = index < 0 ?
indvd00m@0: max :
indvd00m@0: one ? index : 0;
indvd00m@0:
indvd00m@0: // Loop through all the selected options
indvd00m@0: for ( ; i < max; i++ ) {
indvd00m@0: option = options[ i ];
indvd00m@0:
indvd00m@0: // oldIE doesn't update selected after form reset (#2551)
indvd00m@0: if ( ( option.selected || i === index ) &&
indvd00m@0: // Don't return options that are disabled or in a disabled optgroup
indvd00m@0: ( support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
indvd00m@0: ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
indvd00m@0:
indvd00m@0: // Get the specific value for the option
indvd00m@0: value = jQuery( option ).val();
indvd00m@0:
indvd00m@0: // We don't need an array for one selects
indvd00m@0: if ( one ) {
indvd00m@0: return value;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Multi-Selects return an array
indvd00m@0: values.push( value );
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: return values;
indvd00m@0: },
indvd00m@0:
indvd00m@0: set: function( elem, value ) {
indvd00m@0: var optionSet, option,
indvd00m@0: options = elem.options,
indvd00m@0: values = jQuery.makeArray( value ),
indvd00m@0: i = options.length;
indvd00m@0:
indvd00m@0: while ( i-- ) {
indvd00m@0: option = options[ i ];
indvd00m@0:
indvd00m@0: if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) >= 0 ) {
indvd00m@0:
indvd00m@0: // Support: IE6
indvd00m@0: // When new option element is added to select box we need to
indvd00m@0: // force reflow of newly added node in order to workaround delay
indvd00m@0: // of initialization properties
indvd00m@0: try {
indvd00m@0: option.selected = optionSet = true;
indvd00m@0:
indvd00m@0: } catch ( _ ) {
indvd00m@0:
indvd00m@0: // Will be executed only in IE6
indvd00m@0: option.scrollHeight;
indvd00m@0: }
indvd00m@0:
indvd00m@0: } else {
indvd00m@0: option.selected = false;
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Force browsers to behave consistently when non-matching value is set
indvd00m@0: if ( !optionSet ) {
indvd00m@0: elem.selectedIndex = -1;
indvd00m@0: }
indvd00m@0:
indvd00m@0: return options;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0: // Radios and checkboxes getter/setter
indvd00m@0: jQuery.each([ "radio", "checkbox" ], function() {
indvd00m@0: jQuery.valHooks[ this ] = {
indvd00m@0: set: function( elem, value ) {
indvd00m@0: if ( jQuery.isArray( value ) ) {
indvd00m@0: return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
indvd00m@0: }
indvd00m@0: }
indvd00m@0: };
indvd00m@0: if ( !support.checkOn ) {
indvd00m@0: jQuery.valHooks[ this ].get = function( elem ) {
indvd00m@0: // Support: Webkit
indvd00m@0: // "" is returned instead of "on" if a value isn't specified
indvd00m@0: return elem.getAttribute("value") === null ? "on" : elem.value;
indvd00m@0: };
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0: var nodeHook, boolHook,
indvd00m@0: attrHandle = jQuery.expr.attrHandle,
indvd00m@0: ruseDefault = /^(?:checked|selected)$/i,
indvd00m@0: getSetAttribute = support.getSetAttribute,
indvd00m@0: getSetInput = support.input;
indvd00m@0:
indvd00m@0: jQuery.fn.extend({
indvd00m@0: attr: function( name, value ) {
indvd00m@0: return access( this, jQuery.attr, name, value, arguments.length > 1 );
indvd00m@0: },
indvd00m@0:
indvd00m@0: removeAttr: function( name ) {
indvd00m@0: return this.each(function() {
indvd00m@0: jQuery.removeAttr( this, name );
indvd00m@0: });
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0: jQuery.extend({
indvd00m@0: attr: function( elem, name, value ) {
indvd00m@0: var hooks, ret,
indvd00m@0: nType = elem.nodeType;
indvd00m@0:
indvd00m@0: // don't get/set attributes on text, comment and attribute nodes
indvd00m@0: if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
indvd00m@0: return;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Fallback to prop when attributes are not supported
indvd00m@0: if ( typeof elem.getAttribute === strundefined ) {
indvd00m@0: return jQuery.prop( elem, name, value );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // All attributes are lowercase
indvd00m@0: // Grab necessary hook if one is defined
indvd00m@0: if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
indvd00m@0: name = name.toLowerCase();
indvd00m@0: hooks = jQuery.attrHooks[ name ] ||
indvd00m@0: ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( value !== undefined ) {
indvd00m@0:
indvd00m@0: if ( value === null ) {
indvd00m@0: jQuery.removeAttr( elem, name );
indvd00m@0:
indvd00m@0: } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
indvd00m@0: return ret;
indvd00m@0:
indvd00m@0: } else {
indvd00m@0: elem.setAttribute( name, value + "" );
indvd00m@0: return value;
indvd00m@0: }
indvd00m@0:
indvd00m@0: } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
indvd00m@0: return ret;
indvd00m@0:
indvd00m@0: } else {
indvd00m@0: ret = jQuery.find.attr( elem, name );
indvd00m@0:
indvd00m@0: // Non-existent attributes return null, we normalize to undefined
indvd00m@0: return ret == null ?
indvd00m@0: undefined :
indvd00m@0: ret;
indvd00m@0: }
indvd00m@0: },
indvd00m@0:
indvd00m@0: removeAttr: function( elem, value ) {
indvd00m@0: var name, propName,
indvd00m@0: i = 0,
indvd00m@0: attrNames = value && value.match( rnotwhite );
indvd00m@0:
indvd00m@0: if ( attrNames && elem.nodeType === 1 ) {
indvd00m@0: while ( (name = attrNames[i++]) ) {
indvd00m@0: propName = jQuery.propFix[ name ] || name;
indvd00m@0:
indvd00m@0: // Boolean attributes get special treatment (#10870)
indvd00m@0: if ( jQuery.expr.match.bool.test( name ) ) {
indvd00m@0: // Set corresponding property to false
indvd00m@0: if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
indvd00m@0: elem[ propName ] = false;
indvd00m@0: // Support: IE<9
indvd00m@0: // Also clear defaultChecked/defaultSelected (if appropriate)
indvd00m@0: } else {
indvd00m@0: elem[ jQuery.camelCase( "default-" + name ) ] =
indvd00m@0: elem[ propName ] = false;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // See #9699 for explanation of this approach (setting first, then removal)
indvd00m@0: } else {
indvd00m@0: jQuery.attr( elem, name, "" );
indvd00m@0: }
indvd00m@0:
indvd00m@0: elem.removeAttribute( getSetAttribute ? name : propName );
indvd00m@0: }
indvd00m@0: }
indvd00m@0: },
indvd00m@0:
indvd00m@0: attrHooks: {
indvd00m@0: type: {
indvd00m@0: set: function( elem, value ) {
indvd00m@0: if ( !support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
indvd00m@0: // Setting the type on a radio button after the value resets the value in IE6-9
indvd00m@0: // Reset value to default in case type is set after value during creation
indvd00m@0: var val = elem.value;
indvd00m@0: elem.setAttribute( "type", value );
indvd00m@0: if ( val ) {
indvd00m@0: elem.value = val;
indvd00m@0: }
indvd00m@0: return value;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0: // Hook for boolean attributes
indvd00m@0: boolHook = {
indvd00m@0: set: function( elem, value, name ) {
indvd00m@0: if ( value === false ) {
indvd00m@0: // Remove boolean attributes when set to false
indvd00m@0: jQuery.removeAttr( elem, name );
indvd00m@0: } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
indvd00m@0: // IE<8 needs the *property* name
indvd00m@0: elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
indvd00m@0:
indvd00m@0: // Use defaultChecked and defaultSelected for oldIE
indvd00m@0: } else {
indvd00m@0: elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
indvd00m@0: }
indvd00m@0:
indvd00m@0: return name;
indvd00m@0: }
indvd00m@0: };
indvd00m@0:
indvd00m@0: // Retrieve booleans specially
indvd00m@0: jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
indvd00m@0:
indvd00m@0: var getter = attrHandle[ name ] || jQuery.find.attr;
indvd00m@0:
indvd00m@0: attrHandle[ name ] = getSetInput && getSetAttribute || !ruseDefault.test( name ) ?
indvd00m@0: function( elem, name, isXML ) {
indvd00m@0: var ret, handle;
indvd00m@0: if ( !isXML ) {
indvd00m@0: // Avoid an infinite loop by temporarily removing this function from the getter
indvd00m@0: handle = attrHandle[ name ];
indvd00m@0: attrHandle[ name ] = ret;
indvd00m@0: ret = getter( elem, name, isXML ) != null ?
indvd00m@0: name.toLowerCase() :
indvd00m@0: null;
indvd00m@0: attrHandle[ name ] = handle;
indvd00m@0: }
indvd00m@0: return ret;
indvd00m@0: } :
indvd00m@0: function( elem, name, isXML ) {
indvd00m@0: if ( !isXML ) {
indvd00m@0: return elem[ jQuery.camelCase( "default-" + name ) ] ?
indvd00m@0: name.toLowerCase() :
indvd00m@0: null;
indvd00m@0: }
indvd00m@0: };
indvd00m@0: });
indvd00m@0:
indvd00m@0: // fix oldIE attroperties
indvd00m@0: if ( !getSetInput || !getSetAttribute ) {
indvd00m@0: jQuery.attrHooks.value = {
indvd00m@0: set: function( elem, value, name ) {
indvd00m@0: if ( jQuery.nodeName( elem, "input" ) ) {
indvd00m@0: // Does not return so that setAttribute is also used
indvd00m@0: elem.defaultValue = value;
indvd00m@0: } else {
indvd00m@0: // Use nodeHook if defined (#1954); otherwise setAttribute is fine
indvd00m@0: return nodeHook && nodeHook.set( elem, value, name );
indvd00m@0: }
indvd00m@0: }
indvd00m@0: };
indvd00m@0: }
indvd00m@0:
indvd00m@0: // IE6/7 do not support getting/setting some attributes with get/setAttribute
indvd00m@0: if ( !getSetAttribute ) {
indvd00m@0:
indvd00m@0: // Use this for any attribute in IE6/7
indvd00m@0: // This fixes almost every IE6/7 issue
indvd00m@0: nodeHook = {
indvd00m@0: set: function( elem, value, name ) {
indvd00m@0: // Set the existing or create a new attribute node
indvd00m@0: var ret = elem.getAttributeNode( name );
indvd00m@0: if ( !ret ) {
indvd00m@0: elem.setAttributeNode(
indvd00m@0: (ret = elem.ownerDocument.createAttribute( name ))
indvd00m@0: );
indvd00m@0: }
indvd00m@0:
indvd00m@0: ret.value = value += "";
indvd00m@0:
indvd00m@0: // Break association with cloned elements by also using setAttribute (#9646)
indvd00m@0: if ( name === "value" || value === elem.getAttribute( name ) ) {
indvd00m@0: return value;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: };
indvd00m@0:
indvd00m@0: // Some attributes are constructed with empty-string values when not defined
indvd00m@0: attrHandle.id = attrHandle.name = attrHandle.coords =
indvd00m@0: function( elem, name, isXML ) {
indvd00m@0: var ret;
indvd00m@0: if ( !isXML ) {
indvd00m@0: return (ret = elem.getAttributeNode( name )) && ret.value !== "" ?
indvd00m@0: ret.value :
indvd00m@0: null;
indvd00m@0: }
indvd00m@0: };
indvd00m@0:
indvd00m@0: // Fixing value retrieval on a button requires this module
indvd00m@0: jQuery.valHooks.button = {
indvd00m@0: get: function( elem, name ) {
indvd00m@0: var ret = elem.getAttributeNode( name );
indvd00m@0: if ( ret && ret.specified ) {
indvd00m@0: return ret.value;
indvd00m@0: }
indvd00m@0: },
indvd00m@0: set: nodeHook.set
indvd00m@0: };
indvd00m@0:
indvd00m@0: // Set contenteditable to false on removals(#10429)
indvd00m@0: // Setting to empty string throws an error as an invalid value
indvd00m@0: jQuery.attrHooks.contenteditable = {
indvd00m@0: set: function( elem, value, name ) {
indvd00m@0: nodeHook.set( elem, value === "" ? false : value, name );
indvd00m@0: }
indvd00m@0: };
indvd00m@0:
indvd00m@0: // Set width and height to auto instead of 0 on empty string( Bug #8150 )
indvd00m@0: // This is for removals
indvd00m@0: jQuery.each([ "width", "height" ], function( i, name ) {
indvd00m@0: jQuery.attrHooks[ name ] = {
indvd00m@0: set: function( elem, value ) {
indvd00m@0: if ( value === "" ) {
indvd00m@0: elem.setAttribute( name, "auto" );
indvd00m@0: return value;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: };
indvd00m@0: });
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( !support.style ) {
indvd00m@0: jQuery.attrHooks.style = {
indvd00m@0: get: function( elem ) {
indvd00m@0: // Return undefined in the case of empty string
indvd00m@0: // Note: IE uppercases css property names, but if we were to .toLowerCase()
indvd00m@0: // .cssText, that would destroy case senstitivity in URL's, like in "background"
indvd00m@0: return elem.style.cssText || undefined;
indvd00m@0: },
indvd00m@0: set: function( elem, value ) {
indvd00m@0: return ( elem.style.cssText = value + "" );
indvd00m@0: }
indvd00m@0: };
indvd00m@0: }
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0: var rfocusable = /^(?:input|select|textarea|button|object)$/i,
indvd00m@0: rclickable = /^(?:a|area)$/i;
indvd00m@0:
indvd00m@0: jQuery.fn.extend({
indvd00m@0: prop: function( name, value ) {
indvd00m@0: return access( this, jQuery.prop, name, value, arguments.length > 1 );
indvd00m@0: },
indvd00m@0:
indvd00m@0: removeProp: function( name ) {
indvd00m@0: name = jQuery.propFix[ name ] || name;
indvd00m@0: return this.each(function() {
indvd00m@0: // try/catch handles cases where IE balks (such as removing a property on window)
indvd00m@0: try {
indvd00m@0: this[ name ] = undefined;
indvd00m@0: delete this[ name ];
indvd00m@0: } catch( e ) {}
indvd00m@0: });
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0: jQuery.extend({
indvd00m@0: propFix: {
indvd00m@0: "for": "htmlFor",
indvd00m@0: "class": "className"
indvd00m@0: },
indvd00m@0:
indvd00m@0: prop: function( elem, name, value ) {
indvd00m@0: var ret, hooks, notxml,
indvd00m@0: nType = elem.nodeType;
indvd00m@0:
indvd00m@0: // don't get/set properties on text, comment and attribute nodes
indvd00m@0: if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
indvd00m@0: return;
indvd00m@0: }
indvd00m@0:
indvd00m@0: notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
indvd00m@0:
indvd00m@0: if ( notxml ) {
indvd00m@0: // Fix name and attach hooks
indvd00m@0: name = jQuery.propFix[ name ] || name;
indvd00m@0: hooks = jQuery.propHooks[ name ];
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( value !== undefined ) {
indvd00m@0: return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
indvd00m@0: ret :
indvd00m@0: ( elem[ name ] = value );
indvd00m@0:
indvd00m@0: } else {
indvd00m@0: return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
indvd00m@0: ret :
indvd00m@0: elem[ name ];
indvd00m@0: }
indvd00m@0: },
indvd00m@0:
indvd00m@0: propHooks: {
indvd00m@0: tabIndex: {
indvd00m@0: get: function( elem ) {
indvd00m@0: // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
indvd00m@0: // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
indvd00m@0: // Use proper attribute retrieval(#12072)
indvd00m@0: var tabindex = jQuery.find.attr( elem, "tabindex" );
indvd00m@0:
indvd00m@0: return tabindex ?
indvd00m@0: parseInt( tabindex, 10 ) :
indvd00m@0: rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
indvd00m@0: 0 :
indvd00m@0: -1;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0: // Some attributes require a special call on IE
indvd00m@0: // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
indvd00m@0: if ( !support.hrefNormalized ) {
indvd00m@0: // href/src property should get the full normalized URL (#10299/#12915)
indvd00m@0: jQuery.each([ "href", "src" ], function( i, name ) {
indvd00m@0: jQuery.propHooks[ name ] = {
indvd00m@0: get: function( elem ) {
indvd00m@0: return elem.getAttribute( name, 4 );
indvd00m@0: }
indvd00m@0: };
indvd00m@0: });
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Support: Safari, IE9+
indvd00m@0: // mis-reports the default selected property of an option
indvd00m@0: // Accessing the parent's selectedIndex property fixes it
indvd00m@0: if ( !support.optSelected ) {
indvd00m@0: jQuery.propHooks.selected = {
indvd00m@0: get: function( elem ) {
indvd00m@0: var parent = elem.parentNode;
indvd00m@0:
indvd00m@0: if ( parent ) {
indvd00m@0: parent.selectedIndex;
indvd00m@0:
indvd00m@0: // Make sure that it also works with optgroups, see #5701
indvd00m@0: if ( parent.parentNode ) {
indvd00m@0: parent.parentNode.selectedIndex;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: return null;
indvd00m@0: }
indvd00m@0: };
indvd00m@0: }
indvd00m@0:
indvd00m@0: jQuery.each([
indvd00m@0: "tabIndex",
indvd00m@0: "readOnly",
indvd00m@0: "maxLength",
indvd00m@0: "cellSpacing",
indvd00m@0: "cellPadding",
indvd00m@0: "rowSpan",
indvd00m@0: "colSpan",
indvd00m@0: "useMap",
indvd00m@0: "frameBorder",
indvd00m@0: "contentEditable"
indvd00m@0: ], function() {
indvd00m@0: jQuery.propFix[ this.toLowerCase() ] = this;
indvd00m@0: });
indvd00m@0:
indvd00m@0: // IE6/7 call enctype encoding
indvd00m@0: if ( !support.enctype ) {
indvd00m@0: jQuery.propFix.enctype = "encoding";
indvd00m@0: }
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0: var rclass = /[\t\r\n\f]/g;
indvd00m@0:
indvd00m@0: jQuery.fn.extend({
indvd00m@0: addClass: function( value ) {
indvd00m@0: var classes, elem, cur, clazz, j, finalValue,
indvd00m@0: i = 0,
indvd00m@0: len = this.length,
indvd00m@0: proceed = typeof value === "string" && value;
indvd00m@0:
indvd00m@0: if ( jQuery.isFunction( value ) ) {
indvd00m@0: return this.each(function( j ) {
indvd00m@0: jQuery( this ).addClass( value.call( this, j, this.className ) );
indvd00m@0: });
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( proceed ) {
indvd00m@0: // The disjunction here is for better compressibility (see removeClass)
indvd00m@0: classes = ( value || "" ).match( rnotwhite ) || [];
indvd00m@0:
indvd00m@0: for ( ; i < len; i++ ) {
indvd00m@0: elem = this[ i ];
indvd00m@0: cur = elem.nodeType === 1 && ( elem.className ?
indvd00m@0: ( " " + elem.className + " " ).replace( rclass, " " ) :
indvd00m@0: " "
indvd00m@0: );
indvd00m@0:
indvd00m@0: if ( cur ) {
indvd00m@0: j = 0;
indvd00m@0: while ( (clazz = classes[j++]) ) {
indvd00m@0: if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
indvd00m@0: cur += clazz + " ";
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // only assign if different to avoid unneeded rendering.
indvd00m@0: finalValue = jQuery.trim( cur );
indvd00m@0: if ( elem.className !== finalValue ) {
indvd00m@0: elem.className = finalValue;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: return this;
indvd00m@0: },
indvd00m@0:
indvd00m@0: removeClass: function( value ) {
indvd00m@0: var classes, elem, cur, clazz, j, finalValue,
indvd00m@0: i = 0,
indvd00m@0: len = this.length,
indvd00m@0: proceed = arguments.length === 0 || typeof value === "string" && value;
indvd00m@0:
indvd00m@0: if ( jQuery.isFunction( value ) ) {
indvd00m@0: return this.each(function( j ) {
indvd00m@0: jQuery( this ).removeClass( value.call( this, j, this.className ) );
indvd00m@0: });
indvd00m@0: }
indvd00m@0: if ( proceed ) {
indvd00m@0: classes = ( value || "" ).match( rnotwhite ) || [];
indvd00m@0:
indvd00m@0: for ( ; i < len; i++ ) {
indvd00m@0: elem = this[ i ];
indvd00m@0: // This expression is here for better compressibility (see addClass)
indvd00m@0: cur = elem.nodeType === 1 && ( elem.className ?
indvd00m@0: ( " " + elem.className + " " ).replace( rclass, " " ) :
indvd00m@0: ""
indvd00m@0: );
indvd00m@0:
indvd00m@0: if ( cur ) {
indvd00m@0: j = 0;
indvd00m@0: while ( (clazz = classes[j++]) ) {
indvd00m@0: // Remove *all* instances
indvd00m@0: while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
indvd00m@0: cur = cur.replace( " " + clazz + " ", " " );
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // only assign if different to avoid unneeded rendering.
indvd00m@0: finalValue = value ? jQuery.trim( cur ) : "";
indvd00m@0: if ( elem.className !== finalValue ) {
indvd00m@0: elem.className = finalValue;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: return this;
indvd00m@0: },
indvd00m@0:
indvd00m@0: toggleClass: function( value, stateVal ) {
indvd00m@0: var type = typeof value;
indvd00m@0:
indvd00m@0: if ( typeof stateVal === "boolean" && type === "string" ) {
indvd00m@0: return stateVal ? this.addClass( value ) : this.removeClass( value );
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( jQuery.isFunction( value ) ) {
indvd00m@0: return this.each(function( i ) {
indvd00m@0: jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
indvd00m@0: });
indvd00m@0: }
indvd00m@0:
indvd00m@0: return this.each(function() {
indvd00m@0: if ( type === "string" ) {
indvd00m@0: // toggle individual class names
indvd00m@0: var className,
indvd00m@0: i = 0,
indvd00m@0: self = jQuery( this ),
indvd00m@0: classNames = value.match( rnotwhite ) || [];
indvd00m@0:
indvd00m@0: while ( (className = classNames[ i++ ]) ) {
indvd00m@0: // check each className given, space separated list
indvd00m@0: if ( self.hasClass( className ) ) {
indvd00m@0: self.removeClass( className );
indvd00m@0: } else {
indvd00m@0: self.addClass( className );
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Toggle whole class name
indvd00m@0: } else if ( type === strundefined || type === "boolean" ) {
indvd00m@0: if ( this.className ) {
indvd00m@0: // store className if set
indvd00m@0: jQuery._data( this, "__className__", this.className );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // If the element has a class name or if we're passed "false",
indvd00m@0: // then remove the whole classname (if there was one, the above saved it).
indvd00m@0: // Otherwise bring back whatever was previously saved (if anything),
indvd00m@0: // falling back to the empty string if nothing was stored.
indvd00m@0: this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
indvd00m@0: }
indvd00m@0: });
indvd00m@0: },
indvd00m@0:
indvd00m@0: hasClass: function( selector ) {
indvd00m@0: var className = " " + selector + " ",
indvd00m@0: i = 0,
indvd00m@0: l = this.length;
indvd00m@0: for ( ; i < l; i++ ) {
indvd00m@0: if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
indvd00m@0: return true;
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: return false;
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0: // Return jQuery for attributes-only inclusion
indvd00m@0:
indvd00m@0:
indvd00m@0: jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
indvd00m@0: "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
indvd00m@0: "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
indvd00m@0:
indvd00m@0: // Handle event binding
indvd00m@0: jQuery.fn[ name ] = function( data, fn ) {
indvd00m@0: return arguments.length > 0 ?
indvd00m@0: this.on( name, null, data, fn ) :
indvd00m@0: this.trigger( name );
indvd00m@0: };
indvd00m@0: });
indvd00m@0:
indvd00m@0: jQuery.fn.extend({
indvd00m@0: hover: function( fnOver, fnOut ) {
indvd00m@0: return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
indvd00m@0: },
indvd00m@0:
indvd00m@0: bind: function( types, data, fn ) {
indvd00m@0: return this.on( types, null, data, fn );
indvd00m@0: },
indvd00m@0: unbind: function( types, fn ) {
indvd00m@0: return this.off( types, null, fn );
indvd00m@0: },
indvd00m@0:
indvd00m@0: delegate: function( selector, types, data, fn ) {
indvd00m@0: return this.on( types, selector, data, fn );
indvd00m@0: },
indvd00m@0: undelegate: function( selector, types, fn ) {
indvd00m@0: // ( namespace ) or ( selector, types [, fn] )
indvd00m@0: return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0:
indvd00m@0: var nonce = jQuery.now();
indvd00m@0:
indvd00m@0: var rquery = (/\?/);
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0: var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;
indvd00m@0:
indvd00m@0: jQuery.parseJSON = function( data ) {
indvd00m@0: // Attempt to parse using the native JSON parser first
indvd00m@0: if ( window.JSON && window.JSON.parse ) {
indvd00m@0: // Support: Android 2.3
indvd00m@0: // Workaround failure to string-cast null input
indvd00m@0: return window.JSON.parse( data + "" );
indvd00m@0: }
indvd00m@0:
indvd00m@0: var requireNonComma,
indvd00m@0: depth = null,
indvd00m@0: str = jQuery.trim( data + "" );
indvd00m@0:
indvd00m@0: // Guard against invalid (and possibly dangerous) input by ensuring that nothing remains
indvd00m@0: // after removing valid tokens
indvd00m@0: return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) {
indvd00m@0:
indvd00m@0: // Force termination if we see a misplaced comma
indvd00m@0: if ( requireNonComma && comma ) {
indvd00m@0: depth = 0;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Perform no more replacements after returning to outermost depth
indvd00m@0: if ( depth === 0 ) {
indvd00m@0: return token;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Commas must not follow "[", "{", or ","
indvd00m@0: requireNonComma = open || comma;
indvd00m@0:
indvd00m@0: // Determine new depth
indvd00m@0: // array/object open ("[" or "{"): depth += true - false (increment)
indvd00m@0: // array/object close ("]" or "}"): depth += false - true (decrement)
indvd00m@0: // other cases ("," or primitive): depth += true - true (numeric cast)
indvd00m@0: depth += !close - !open;
indvd00m@0:
indvd00m@0: // Remove this token
indvd00m@0: return "";
indvd00m@0: }) ) ?
indvd00m@0: ( Function( "return " + str ) )() :
indvd00m@0: jQuery.error( "Invalid JSON: " + data );
indvd00m@0: };
indvd00m@0:
indvd00m@0:
indvd00m@0: // Cross-browser xml parsing
indvd00m@0: jQuery.parseXML = function( data ) {
indvd00m@0: var xml, tmp;
indvd00m@0: if ( !data || typeof data !== "string" ) {
indvd00m@0: return null;
indvd00m@0: }
indvd00m@0: try {
indvd00m@0: if ( window.DOMParser ) { // Standard
indvd00m@0: tmp = new DOMParser();
indvd00m@0: xml = tmp.parseFromString( data, "text/xml" );
indvd00m@0: } else { // IE
indvd00m@0: xml = new ActiveXObject( "Microsoft.XMLDOM" );
indvd00m@0: xml.async = "false";
indvd00m@0: xml.loadXML( data );
indvd00m@0: }
indvd00m@0: } catch( e ) {
indvd00m@0: xml = undefined;
indvd00m@0: }
indvd00m@0: if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
indvd00m@0: jQuery.error( "Invalid XML: " + data );
indvd00m@0: }
indvd00m@0: return xml;
indvd00m@0: };
indvd00m@0:
indvd00m@0:
indvd00m@0: var
indvd00m@0: // Document location
indvd00m@0: ajaxLocParts,
indvd00m@0: ajaxLocation,
indvd00m@0:
indvd00m@0: rhash = /#.*$/,
indvd00m@0: rts = /([?&])_=[^&]*/,
indvd00m@0: rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
indvd00m@0: // #7653, #8125, #8152: local protocol detection
indvd00m@0: rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
indvd00m@0: rnoContent = /^(?:GET|HEAD)$/,
indvd00m@0: rprotocol = /^\/\//,
indvd00m@0: rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
indvd00m@0:
indvd00m@0: /* Prefilters
indvd00m@0: * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
indvd00m@0: * 2) These are called:
indvd00m@0: * - BEFORE asking for a transport
indvd00m@0: * - AFTER param serialization (s.data is a string if s.processData is true)
indvd00m@0: * 3) key is the dataType
indvd00m@0: * 4) the catchall symbol "*" can be used
indvd00m@0: * 5) execution will start with transport dataType and THEN continue down to "*" if needed
indvd00m@0: */
indvd00m@0: prefilters = {},
indvd00m@0:
indvd00m@0: /* Transports bindings
indvd00m@0: * 1) key is the dataType
indvd00m@0: * 2) the catchall symbol "*" can be used
indvd00m@0: * 3) selection will start with transport dataType and THEN go to "*" if needed
indvd00m@0: */
indvd00m@0: transports = {},
indvd00m@0:
indvd00m@0: // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
indvd00m@0: allTypes = "*/".concat("*");
indvd00m@0:
indvd00m@0: // #8138, IE may throw an exception when accessing
indvd00m@0: // a field from window.location if document.domain has been set
indvd00m@0: try {
indvd00m@0: ajaxLocation = location.href;
indvd00m@0: } catch( e ) {
indvd00m@0: // Use the href attribute of an A element
indvd00m@0: // since IE will modify it given document.location
indvd00m@0: ajaxLocation = document.createElement( "a" );
indvd00m@0: ajaxLocation.href = "";
indvd00m@0: ajaxLocation = ajaxLocation.href;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Segment location into parts
indvd00m@0: ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
indvd00m@0:
indvd00m@0: // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
indvd00m@0: function addToPrefiltersOrTransports( structure ) {
indvd00m@0:
indvd00m@0: // dataTypeExpression is optional and defaults to "*"
indvd00m@0: return function( dataTypeExpression, func ) {
indvd00m@0:
indvd00m@0: if ( typeof dataTypeExpression !== "string" ) {
indvd00m@0: func = dataTypeExpression;
indvd00m@0: dataTypeExpression = "*";
indvd00m@0: }
indvd00m@0:
indvd00m@0: var dataType,
indvd00m@0: i = 0,
indvd00m@0: dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
indvd00m@0:
indvd00m@0: if ( jQuery.isFunction( func ) ) {
indvd00m@0: // For each dataType in the dataTypeExpression
indvd00m@0: while ( (dataType = dataTypes[i++]) ) {
indvd00m@0: // Prepend if requested
indvd00m@0: if ( dataType.charAt( 0 ) === "+" ) {
indvd00m@0: dataType = dataType.slice( 1 ) || "*";
indvd00m@0: (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
indvd00m@0:
indvd00m@0: // Otherwise append
indvd00m@0: } else {
indvd00m@0: (structure[ dataType ] = structure[ dataType ] || []).push( func );
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0: };
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Base inspection function for prefilters and transports
indvd00m@0: function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
indvd00m@0:
indvd00m@0: var inspected = {},
indvd00m@0: seekingTransport = ( structure === transports );
indvd00m@0:
indvd00m@0: function inspect( dataType ) {
indvd00m@0: var selected;
indvd00m@0: inspected[ dataType ] = true;
indvd00m@0: jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
indvd00m@0: var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
indvd00m@0: if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
indvd00m@0: options.dataTypes.unshift( dataTypeOrTransport );
indvd00m@0: inspect( dataTypeOrTransport );
indvd00m@0: return false;
indvd00m@0: } else if ( seekingTransport ) {
indvd00m@0: return !( selected = dataTypeOrTransport );
indvd00m@0: }
indvd00m@0: });
indvd00m@0: return selected;
indvd00m@0: }
indvd00m@0:
indvd00m@0: return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // A special extend for ajax options
indvd00m@0: // that takes "flat" options (not to be deep extended)
indvd00m@0: // Fixes #9887
indvd00m@0: function ajaxExtend( target, src ) {
indvd00m@0: var deep, key,
indvd00m@0: flatOptions = jQuery.ajaxSettings.flatOptions || {};
indvd00m@0:
indvd00m@0: for ( key in src ) {
indvd00m@0: if ( src[ key ] !== undefined ) {
indvd00m@0: ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
indvd00m@0: }
indvd00m@0: }
indvd00m@0: if ( deep ) {
indvd00m@0: jQuery.extend( true, target, deep );
indvd00m@0: }
indvd00m@0:
indvd00m@0: return target;
indvd00m@0: }
indvd00m@0:
indvd00m@0: /* Handles responses to an ajax request:
indvd00m@0: * - finds the right dataType (mediates between content-type and expected dataType)
indvd00m@0: * - returns the corresponding response
indvd00m@0: */
indvd00m@0: function ajaxHandleResponses( s, jqXHR, responses ) {
indvd00m@0: var firstDataType, ct, finalDataType, type,
indvd00m@0: contents = s.contents,
indvd00m@0: dataTypes = s.dataTypes;
indvd00m@0:
indvd00m@0: // Remove auto dataType and get content-type in the process
indvd00m@0: while ( dataTypes[ 0 ] === "*" ) {
indvd00m@0: dataTypes.shift();
indvd00m@0: if ( ct === undefined ) {
indvd00m@0: ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Check if we're dealing with a known content-type
indvd00m@0: if ( ct ) {
indvd00m@0: for ( type in contents ) {
indvd00m@0: if ( contents[ type ] && contents[ type ].test( ct ) ) {
indvd00m@0: dataTypes.unshift( type );
indvd00m@0: break;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Check to see if we have a response for the expected dataType
indvd00m@0: if ( dataTypes[ 0 ] in responses ) {
indvd00m@0: finalDataType = dataTypes[ 0 ];
indvd00m@0: } else {
indvd00m@0: // Try convertible dataTypes
indvd00m@0: for ( type in responses ) {
indvd00m@0: if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
indvd00m@0: finalDataType = type;
indvd00m@0: break;
indvd00m@0: }
indvd00m@0: if ( !firstDataType ) {
indvd00m@0: firstDataType = type;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: // Or just use first one
indvd00m@0: finalDataType = finalDataType || firstDataType;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // If we found a dataType
indvd00m@0: // We add the dataType to the list if needed
indvd00m@0: // and return the corresponding response
indvd00m@0: if ( finalDataType ) {
indvd00m@0: if ( finalDataType !== dataTypes[ 0 ] ) {
indvd00m@0: dataTypes.unshift( finalDataType );
indvd00m@0: }
indvd00m@0: return responses[ finalDataType ];
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: /* Chain conversions given the request and the original response
indvd00m@0: * Also sets the responseXXX fields on the jqXHR instance
indvd00m@0: */
indvd00m@0: function ajaxConvert( s, response, jqXHR, isSuccess ) {
indvd00m@0: var conv2, current, conv, tmp, prev,
indvd00m@0: converters = {},
indvd00m@0: // Work with a copy of dataTypes in case we need to modify it for conversion
indvd00m@0: dataTypes = s.dataTypes.slice();
indvd00m@0:
indvd00m@0: // Create converters map with lowercased keys
indvd00m@0: if ( dataTypes[ 1 ] ) {
indvd00m@0: for ( conv in s.converters ) {
indvd00m@0: converters[ conv.toLowerCase() ] = s.converters[ conv ];
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: current = dataTypes.shift();
indvd00m@0:
indvd00m@0: // Convert to each sequential dataType
indvd00m@0: while ( current ) {
indvd00m@0:
indvd00m@0: if ( s.responseFields[ current ] ) {
indvd00m@0: jqXHR[ s.responseFields[ current ] ] = response;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Apply the dataFilter if provided
indvd00m@0: if ( !prev && isSuccess && s.dataFilter ) {
indvd00m@0: response = s.dataFilter( response, s.dataType );
indvd00m@0: }
indvd00m@0:
indvd00m@0: prev = current;
indvd00m@0: current = dataTypes.shift();
indvd00m@0:
indvd00m@0: if ( current ) {
indvd00m@0:
indvd00m@0: // There's only work to do if current dataType is non-auto
indvd00m@0: if ( current === "*" ) {
indvd00m@0:
indvd00m@0: current = prev;
indvd00m@0:
indvd00m@0: // Convert response if prev dataType is non-auto and differs from current
indvd00m@0: } else if ( prev !== "*" && prev !== current ) {
indvd00m@0:
indvd00m@0: // Seek a direct converter
indvd00m@0: conv = converters[ prev + " " + current ] || converters[ "* " + current ];
indvd00m@0:
indvd00m@0: // If none found, seek a pair
indvd00m@0: if ( !conv ) {
indvd00m@0: for ( conv2 in converters ) {
indvd00m@0:
indvd00m@0: // If conv2 outputs current
indvd00m@0: tmp = conv2.split( " " );
indvd00m@0: if ( tmp[ 1 ] === current ) {
indvd00m@0:
indvd00m@0: // If prev can be converted to accepted input
indvd00m@0: conv = converters[ prev + " " + tmp[ 0 ] ] ||
indvd00m@0: converters[ "* " + tmp[ 0 ] ];
indvd00m@0: if ( conv ) {
indvd00m@0: // Condense equivalence converters
indvd00m@0: if ( conv === true ) {
indvd00m@0: conv = converters[ conv2 ];
indvd00m@0:
indvd00m@0: // Otherwise, insert the intermediate dataType
indvd00m@0: } else if ( converters[ conv2 ] !== true ) {
indvd00m@0: current = tmp[ 0 ];
indvd00m@0: dataTypes.unshift( tmp[ 1 ] );
indvd00m@0: }
indvd00m@0: break;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Apply converter (if not an equivalence)
indvd00m@0: if ( conv !== true ) {
indvd00m@0:
indvd00m@0: // Unless errors are allowed to bubble, catch and return them
indvd00m@0: if ( conv && s[ "throws" ] ) {
indvd00m@0: response = conv( response );
indvd00m@0: } else {
indvd00m@0: try {
indvd00m@0: response = conv( response );
indvd00m@0: } catch ( e ) {
indvd00m@0: return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: return { state: "success", data: response };
indvd00m@0: }
indvd00m@0:
indvd00m@0: jQuery.extend({
indvd00m@0:
indvd00m@0: // Counter for holding the number of active queries
indvd00m@0: active: 0,
indvd00m@0:
indvd00m@0: // Last-Modified header cache for next request
indvd00m@0: lastModified: {},
indvd00m@0: etag: {},
indvd00m@0:
indvd00m@0: ajaxSettings: {
indvd00m@0: url: ajaxLocation,
indvd00m@0: type: "GET",
indvd00m@0: isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
indvd00m@0: global: true,
indvd00m@0: processData: true,
indvd00m@0: async: true,
indvd00m@0: contentType: "application/x-www-form-urlencoded; charset=UTF-8",
indvd00m@0: /*
indvd00m@0: timeout: 0,
indvd00m@0: data: null,
indvd00m@0: dataType: null,
indvd00m@0: username: null,
indvd00m@0: password: null,
indvd00m@0: cache: null,
indvd00m@0: throws: false,
indvd00m@0: traditional: false,
indvd00m@0: headers: {},
indvd00m@0: */
indvd00m@0:
indvd00m@0: accepts: {
indvd00m@0: "*": allTypes,
indvd00m@0: text: "text/plain",
indvd00m@0: html: "text/html",
indvd00m@0: xml: "application/xml, text/xml",
indvd00m@0: json: "application/json, text/javascript"
indvd00m@0: },
indvd00m@0:
indvd00m@0: contents: {
indvd00m@0: xml: /xml/,
indvd00m@0: html: /html/,
indvd00m@0: json: /json/
indvd00m@0: },
indvd00m@0:
indvd00m@0: responseFields: {
indvd00m@0: xml: "responseXML",
indvd00m@0: text: "responseText",
indvd00m@0: json: "responseJSON"
indvd00m@0: },
indvd00m@0:
indvd00m@0: // Data converters
indvd00m@0: // Keys separate source (or catchall "*") and destination types with a single space
indvd00m@0: converters: {
indvd00m@0:
indvd00m@0: // Convert anything to text
indvd00m@0: "* text": String,
indvd00m@0:
indvd00m@0: // Text to html (true = no transformation)
indvd00m@0: "text html": true,
indvd00m@0:
indvd00m@0: // Evaluate text as a json expression
indvd00m@0: "text json": jQuery.parseJSON,
indvd00m@0:
indvd00m@0: // Parse text as xml
indvd00m@0: "text xml": jQuery.parseXML
indvd00m@0: },
indvd00m@0:
indvd00m@0: // For options that shouldn't be deep extended:
indvd00m@0: // you can add your own custom options here if
indvd00m@0: // and when you create one that shouldn't be
indvd00m@0: // deep extended (see ajaxExtend)
indvd00m@0: flatOptions: {
indvd00m@0: url: true,
indvd00m@0: context: true
indvd00m@0: }
indvd00m@0: },
indvd00m@0:
indvd00m@0: // Creates a full fledged settings object into target
indvd00m@0: // with both ajaxSettings and settings fields.
indvd00m@0: // If target is omitted, writes into ajaxSettings.
indvd00m@0: ajaxSetup: function( target, settings ) {
indvd00m@0: return settings ?
indvd00m@0:
indvd00m@0: // Building a settings object
indvd00m@0: ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
indvd00m@0:
indvd00m@0: // Extending ajaxSettings
indvd00m@0: ajaxExtend( jQuery.ajaxSettings, target );
indvd00m@0: },
indvd00m@0:
indvd00m@0: ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
indvd00m@0: ajaxTransport: addToPrefiltersOrTransports( transports ),
indvd00m@0:
indvd00m@0: // Main method
indvd00m@0: ajax: function( url, options ) {
indvd00m@0:
indvd00m@0: // If url is an object, simulate pre-1.5 signature
indvd00m@0: if ( typeof url === "object" ) {
indvd00m@0: options = url;
indvd00m@0: url = undefined;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Force options to be an object
indvd00m@0: options = options || {};
indvd00m@0:
indvd00m@0: var // Cross-domain detection vars
indvd00m@0: parts,
indvd00m@0: // Loop variable
indvd00m@0: i,
indvd00m@0: // URL without anti-cache param
indvd00m@0: cacheURL,
indvd00m@0: // Response headers as string
indvd00m@0: responseHeadersString,
indvd00m@0: // timeout handle
indvd00m@0: timeoutTimer,
indvd00m@0:
indvd00m@0: // To know if global events are to be dispatched
indvd00m@0: fireGlobals,
indvd00m@0:
indvd00m@0: transport,
indvd00m@0: // Response headers
indvd00m@0: responseHeaders,
indvd00m@0: // Create the final options object
indvd00m@0: s = jQuery.ajaxSetup( {}, options ),
indvd00m@0: // Callbacks context
indvd00m@0: callbackContext = s.context || s,
indvd00m@0: // Context for global events is callbackContext if it is a DOM node or jQuery collection
indvd00m@0: globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
indvd00m@0: jQuery( callbackContext ) :
indvd00m@0: jQuery.event,
indvd00m@0: // Deferreds
indvd00m@0: deferred = jQuery.Deferred(),
indvd00m@0: completeDeferred = jQuery.Callbacks("once memory"),
indvd00m@0: // Status-dependent callbacks
indvd00m@0: statusCode = s.statusCode || {},
indvd00m@0: // Headers (they are sent all at once)
indvd00m@0: requestHeaders = {},
indvd00m@0: requestHeadersNames = {},
indvd00m@0: // The jqXHR state
indvd00m@0: state = 0,
indvd00m@0: // Default abort message
indvd00m@0: strAbort = "canceled",
indvd00m@0: // Fake xhr
indvd00m@0: jqXHR = {
indvd00m@0: readyState: 0,
indvd00m@0:
indvd00m@0: // Builds headers hashtable if needed
indvd00m@0: getResponseHeader: function( key ) {
indvd00m@0: var match;
indvd00m@0: if ( state === 2 ) {
indvd00m@0: if ( !responseHeaders ) {
indvd00m@0: responseHeaders = {};
indvd00m@0: while ( (match = rheaders.exec( responseHeadersString )) ) {
indvd00m@0: responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
indvd00m@0: }
indvd00m@0: }
indvd00m@0: match = responseHeaders[ key.toLowerCase() ];
indvd00m@0: }
indvd00m@0: return match == null ? null : match;
indvd00m@0: },
indvd00m@0:
indvd00m@0: // Raw string
indvd00m@0: getAllResponseHeaders: function() {
indvd00m@0: return state === 2 ? responseHeadersString : null;
indvd00m@0: },
indvd00m@0:
indvd00m@0: // Caches the header
indvd00m@0: setRequestHeader: function( name, value ) {
indvd00m@0: var lname = name.toLowerCase();
indvd00m@0: if ( !state ) {
indvd00m@0: name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
indvd00m@0: requestHeaders[ name ] = value;
indvd00m@0: }
indvd00m@0: return this;
indvd00m@0: },
indvd00m@0:
indvd00m@0: // Overrides response content-type header
indvd00m@0: overrideMimeType: function( type ) {
indvd00m@0: if ( !state ) {
indvd00m@0: s.mimeType = type;
indvd00m@0: }
indvd00m@0: return this;
indvd00m@0: },
indvd00m@0:
indvd00m@0: // Status-dependent callbacks
indvd00m@0: statusCode: function( map ) {
indvd00m@0: var code;
indvd00m@0: if ( map ) {
indvd00m@0: if ( state < 2 ) {
indvd00m@0: for ( code in map ) {
indvd00m@0: // Lazy-add the new callback in a way that preserves old ones
indvd00m@0: statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
indvd00m@0: }
indvd00m@0: } else {
indvd00m@0: // Execute the appropriate callbacks
indvd00m@0: jqXHR.always( map[ jqXHR.status ] );
indvd00m@0: }
indvd00m@0: }
indvd00m@0: return this;
indvd00m@0: },
indvd00m@0:
indvd00m@0: // Cancel the request
indvd00m@0: abort: function( statusText ) {
indvd00m@0: var finalText = statusText || strAbort;
indvd00m@0: if ( transport ) {
indvd00m@0: transport.abort( finalText );
indvd00m@0: }
indvd00m@0: done( 0, finalText );
indvd00m@0: return this;
indvd00m@0: }
indvd00m@0: };
indvd00m@0:
indvd00m@0: // Attach deferreds
indvd00m@0: deferred.promise( jqXHR ).complete = completeDeferred.add;
indvd00m@0: jqXHR.success = jqXHR.done;
indvd00m@0: jqXHR.error = jqXHR.fail;
indvd00m@0:
indvd00m@0: // Remove hash character (#7531: and string promotion)
indvd00m@0: // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
indvd00m@0: // Handle falsy url in the settings object (#10093: consistency with old signature)
indvd00m@0: // We also use the url parameter if available
indvd00m@0: s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
indvd00m@0:
indvd00m@0: // Alias method option to type as per ticket #12004
indvd00m@0: s.type = options.method || options.type || s.method || s.type;
indvd00m@0:
indvd00m@0: // Extract dataTypes list
indvd00m@0: s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
indvd00m@0:
indvd00m@0: // A cross-domain request is in order when we have a protocol:host:port mismatch
indvd00m@0: if ( s.crossDomain == null ) {
indvd00m@0: parts = rurl.exec( s.url.toLowerCase() );
indvd00m@0: s.crossDomain = !!( parts &&
indvd00m@0: ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
indvd00m@0: ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
indvd00m@0: ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
indvd00m@0: );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Convert data if not already a string
indvd00m@0: if ( s.data && s.processData && typeof s.data !== "string" ) {
indvd00m@0: s.data = jQuery.param( s.data, s.traditional );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Apply prefilters
indvd00m@0: inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
indvd00m@0:
indvd00m@0: // If request was aborted inside a prefilter, stop there
indvd00m@0: if ( state === 2 ) {
indvd00m@0: return jqXHR;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // We can fire global events as of now if asked to
indvd00m@0: // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
indvd00m@0: fireGlobals = jQuery.event && s.global;
indvd00m@0:
indvd00m@0: // Watch for a new set of requests
indvd00m@0: if ( fireGlobals && jQuery.active++ === 0 ) {
indvd00m@0: jQuery.event.trigger("ajaxStart");
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Uppercase the type
indvd00m@0: s.type = s.type.toUpperCase();
indvd00m@0:
indvd00m@0: // Determine if request has content
indvd00m@0: s.hasContent = !rnoContent.test( s.type );
indvd00m@0:
indvd00m@0: // Save the URL in case we're toying with the If-Modified-Since
indvd00m@0: // and/or If-None-Match header later on
indvd00m@0: cacheURL = s.url;
indvd00m@0:
indvd00m@0: // More options handling for requests with no content
indvd00m@0: if ( !s.hasContent ) {
indvd00m@0:
indvd00m@0: // If data is available, append data to url
indvd00m@0: if ( s.data ) {
indvd00m@0: cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
indvd00m@0: // #9682: remove data so that it's not used in an eventual retry
indvd00m@0: delete s.data;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Add anti-cache in url if needed
indvd00m@0: if ( s.cache === false ) {
indvd00m@0: s.url = rts.test( cacheURL ) ?
indvd00m@0:
indvd00m@0: // If there is already a '_' parameter, set its value
indvd00m@0: cacheURL.replace( rts, "$1_=" + nonce++ ) :
indvd00m@0:
indvd00m@0: // Otherwise add one to the end
indvd00m@0: cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
indvd00m@0: if ( s.ifModified ) {
indvd00m@0: if ( jQuery.lastModified[ cacheURL ] ) {
indvd00m@0: jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
indvd00m@0: }
indvd00m@0: if ( jQuery.etag[ cacheURL ] ) {
indvd00m@0: jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Set the correct header, if data is being sent
indvd00m@0: if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
indvd00m@0: jqXHR.setRequestHeader( "Content-Type", s.contentType );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Set the Accepts header for the server, depending on the dataType
indvd00m@0: jqXHR.setRequestHeader(
indvd00m@0: "Accept",
indvd00m@0: s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
indvd00m@0: s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
indvd00m@0: s.accepts[ "*" ]
indvd00m@0: );
indvd00m@0:
indvd00m@0: // Check for headers option
indvd00m@0: for ( i in s.headers ) {
indvd00m@0: jqXHR.setRequestHeader( i, s.headers[ i ] );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Allow custom headers/mimetypes and early abort
indvd00m@0: if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
indvd00m@0: // Abort if not done already and return
indvd00m@0: return jqXHR.abort();
indvd00m@0: }
indvd00m@0:
indvd00m@0: // aborting is no longer a cancellation
indvd00m@0: strAbort = "abort";
indvd00m@0:
indvd00m@0: // Install callbacks on deferreds
indvd00m@0: for ( i in { success: 1, error: 1, complete: 1 } ) {
indvd00m@0: jqXHR[ i ]( s[ i ] );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Get transport
indvd00m@0: transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
indvd00m@0:
indvd00m@0: // If no transport, we auto-abort
indvd00m@0: if ( !transport ) {
indvd00m@0: done( -1, "No Transport" );
indvd00m@0: } else {
indvd00m@0: jqXHR.readyState = 1;
indvd00m@0:
indvd00m@0: // Send global event
indvd00m@0: if ( fireGlobals ) {
indvd00m@0: globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
indvd00m@0: }
indvd00m@0: // Timeout
indvd00m@0: if ( s.async && s.timeout > 0 ) {
indvd00m@0: timeoutTimer = setTimeout(function() {
indvd00m@0: jqXHR.abort("timeout");
indvd00m@0: }, s.timeout );
indvd00m@0: }
indvd00m@0:
indvd00m@0: try {
indvd00m@0: state = 1;
indvd00m@0: transport.send( requestHeaders, done );
indvd00m@0: } catch ( e ) {
indvd00m@0: // Propagate exception as error if not done
indvd00m@0: if ( state < 2 ) {
indvd00m@0: done( -1, e );
indvd00m@0: // Simply rethrow otherwise
indvd00m@0: } else {
indvd00m@0: throw e;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Callback for when everything is done
indvd00m@0: function done( status, nativeStatusText, responses, headers ) {
indvd00m@0: var isSuccess, success, error, response, modified,
indvd00m@0: statusText = nativeStatusText;
indvd00m@0:
indvd00m@0: // Called once
indvd00m@0: if ( state === 2 ) {
indvd00m@0: return;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // State is "done" now
indvd00m@0: state = 2;
indvd00m@0:
indvd00m@0: // Clear timeout if it exists
indvd00m@0: if ( timeoutTimer ) {
indvd00m@0: clearTimeout( timeoutTimer );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Dereference transport for early garbage collection
indvd00m@0: // (no matter how long the jqXHR object will be used)
indvd00m@0: transport = undefined;
indvd00m@0:
indvd00m@0: // Cache response headers
indvd00m@0: responseHeadersString = headers || "";
indvd00m@0:
indvd00m@0: // Set readyState
indvd00m@0: jqXHR.readyState = status > 0 ? 4 : 0;
indvd00m@0:
indvd00m@0: // Determine if successful
indvd00m@0: isSuccess = status >= 200 && status < 300 || status === 304;
indvd00m@0:
indvd00m@0: // Get response data
indvd00m@0: if ( responses ) {
indvd00m@0: response = ajaxHandleResponses( s, jqXHR, responses );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Convert no matter what (that way responseXXX fields are always set)
indvd00m@0: response = ajaxConvert( s, response, jqXHR, isSuccess );
indvd00m@0:
indvd00m@0: // If successful, handle type chaining
indvd00m@0: if ( isSuccess ) {
indvd00m@0:
indvd00m@0: // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
indvd00m@0: if ( s.ifModified ) {
indvd00m@0: modified = jqXHR.getResponseHeader("Last-Modified");
indvd00m@0: if ( modified ) {
indvd00m@0: jQuery.lastModified[ cacheURL ] = modified;
indvd00m@0: }
indvd00m@0: modified = jqXHR.getResponseHeader("etag");
indvd00m@0: if ( modified ) {
indvd00m@0: jQuery.etag[ cacheURL ] = modified;
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // if no content
indvd00m@0: if ( status === 204 || s.type === "HEAD" ) {
indvd00m@0: statusText = "nocontent";
indvd00m@0:
indvd00m@0: // if not modified
indvd00m@0: } else if ( status === 304 ) {
indvd00m@0: statusText = "notmodified";
indvd00m@0:
indvd00m@0: // If we have data, let's convert it
indvd00m@0: } else {
indvd00m@0: statusText = response.state;
indvd00m@0: success = response.data;
indvd00m@0: error = response.error;
indvd00m@0: isSuccess = !error;
indvd00m@0: }
indvd00m@0: } else {
indvd00m@0: // We extract error from statusText
indvd00m@0: // then normalize statusText and status for non-aborts
indvd00m@0: error = statusText;
indvd00m@0: if ( status || !statusText ) {
indvd00m@0: statusText = "error";
indvd00m@0: if ( status < 0 ) {
indvd00m@0: status = 0;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Set data for the fake xhr object
indvd00m@0: jqXHR.status = status;
indvd00m@0: jqXHR.statusText = ( nativeStatusText || statusText ) + "";
indvd00m@0:
indvd00m@0: // Success/Error
indvd00m@0: if ( isSuccess ) {
indvd00m@0: deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
indvd00m@0: } else {
indvd00m@0: deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Status-dependent callbacks
indvd00m@0: jqXHR.statusCode( statusCode );
indvd00m@0: statusCode = undefined;
indvd00m@0:
indvd00m@0: if ( fireGlobals ) {
indvd00m@0: globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
indvd00m@0: [ jqXHR, s, isSuccess ? success : error ] );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Complete
indvd00m@0: completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
indvd00m@0:
indvd00m@0: if ( fireGlobals ) {
indvd00m@0: globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
indvd00m@0: // Handle the global AJAX counter
indvd00m@0: if ( !( --jQuery.active ) ) {
indvd00m@0: jQuery.event.trigger("ajaxStop");
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: return jqXHR;
indvd00m@0: },
indvd00m@0:
indvd00m@0: getJSON: function( url, data, callback ) {
indvd00m@0: return jQuery.get( url, data, callback, "json" );
indvd00m@0: },
indvd00m@0:
indvd00m@0: getScript: function( url, callback ) {
indvd00m@0: return jQuery.get( url, undefined, callback, "script" );
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0: jQuery.each( [ "get", "post" ], function( i, method ) {
indvd00m@0: jQuery[ method ] = function( url, data, callback, type ) {
indvd00m@0: // shift arguments if data argument was omitted
indvd00m@0: if ( jQuery.isFunction( data ) ) {
indvd00m@0: type = type || callback;
indvd00m@0: callback = data;
indvd00m@0: data = undefined;
indvd00m@0: }
indvd00m@0:
indvd00m@0: return jQuery.ajax({
indvd00m@0: url: url,
indvd00m@0: type: method,
indvd00m@0: dataType: type,
indvd00m@0: data: data,
indvd00m@0: success: callback
indvd00m@0: });
indvd00m@0: };
indvd00m@0: });
indvd00m@0:
indvd00m@0:
indvd00m@0: jQuery._evalUrl = function( url ) {
indvd00m@0: return jQuery.ajax({
indvd00m@0: url: url,
indvd00m@0: type: "GET",
indvd00m@0: dataType: "script",
indvd00m@0: async: false,
indvd00m@0: global: false,
indvd00m@0: "throws": true
indvd00m@0: });
indvd00m@0: };
indvd00m@0:
indvd00m@0:
indvd00m@0: jQuery.fn.extend({
indvd00m@0: wrapAll: function( html ) {
indvd00m@0: if ( jQuery.isFunction( html ) ) {
indvd00m@0: return this.each(function(i) {
indvd00m@0: jQuery(this).wrapAll( html.call(this, i) );
indvd00m@0: });
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( this[0] ) {
indvd00m@0: // The elements to wrap the target around
indvd00m@0: var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
indvd00m@0:
indvd00m@0: if ( this[0].parentNode ) {
indvd00m@0: wrap.insertBefore( this[0] );
indvd00m@0: }
indvd00m@0:
indvd00m@0: wrap.map(function() {
indvd00m@0: var elem = this;
indvd00m@0:
indvd00m@0: while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
indvd00m@0: elem = elem.firstChild;
indvd00m@0: }
indvd00m@0:
indvd00m@0: return elem;
indvd00m@0: }).append( this );
indvd00m@0: }
indvd00m@0:
indvd00m@0: return this;
indvd00m@0: },
indvd00m@0:
indvd00m@0: wrapInner: function( html ) {
indvd00m@0: if ( jQuery.isFunction( html ) ) {
indvd00m@0: return this.each(function(i) {
indvd00m@0: jQuery(this).wrapInner( html.call(this, i) );
indvd00m@0: });
indvd00m@0: }
indvd00m@0:
indvd00m@0: return this.each(function() {
indvd00m@0: var self = jQuery( this ),
indvd00m@0: contents = self.contents();
indvd00m@0:
indvd00m@0: if ( contents.length ) {
indvd00m@0: contents.wrapAll( html );
indvd00m@0:
indvd00m@0: } else {
indvd00m@0: self.append( html );
indvd00m@0: }
indvd00m@0: });
indvd00m@0: },
indvd00m@0:
indvd00m@0: wrap: function( html ) {
indvd00m@0: var isFunction = jQuery.isFunction( html );
indvd00m@0:
indvd00m@0: return this.each(function(i) {
indvd00m@0: jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
indvd00m@0: });
indvd00m@0: },
indvd00m@0:
indvd00m@0: unwrap: function() {
indvd00m@0: return this.parent().each(function() {
indvd00m@0: if ( !jQuery.nodeName( this, "body" ) ) {
indvd00m@0: jQuery( this ).replaceWith( this.childNodes );
indvd00m@0: }
indvd00m@0: }).end();
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0:
indvd00m@0: jQuery.expr.filters.hidden = function( elem ) {
indvd00m@0: // Support: Opera <= 12.12
indvd00m@0: // Opera reports offsetWidths and offsetHeights less than zero on some elements
indvd00m@0: return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||
indvd00m@0: (!support.reliableHiddenOffsets() &&
indvd00m@0: ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
indvd00m@0: };
indvd00m@0:
indvd00m@0: jQuery.expr.filters.visible = function( elem ) {
indvd00m@0: return !jQuery.expr.filters.hidden( elem );
indvd00m@0: };
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0: var r20 = /%20/g,
indvd00m@0: rbracket = /\[\]$/,
indvd00m@0: rCRLF = /\r?\n/g,
indvd00m@0: rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
indvd00m@0: rsubmittable = /^(?:input|select|textarea|keygen)/i;
indvd00m@0:
indvd00m@0: function buildParams( prefix, obj, traditional, add ) {
indvd00m@0: var name;
indvd00m@0:
indvd00m@0: if ( jQuery.isArray( obj ) ) {
indvd00m@0: // Serialize array item.
indvd00m@0: jQuery.each( obj, function( i, v ) {
indvd00m@0: if ( traditional || rbracket.test( prefix ) ) {
indvd00m@0: // Treat each array item as a scalar.
indvd00m@0: add( prefix, v );
indvd00m@0:
indvd00m@0: } else {
indvd00m@0: // Item is non-scalar (array or object), encode its numeric index.
indvd00m@0: buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0: } else if ( !traditional && jQuery.type( obj ) === "object" ) {
indvd00m@0: // Serialize object item.
indvd00m@0: for ( name in obj ) {
indvd00m@0: buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
indvd00m@0: }
indvd00m@0:
indvd00m@0: } else {
indvd00m@0: // Serialize scalar item.
indvd00m@0: add( prefix, obj );
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Serialize an array of form elements or a set of
indvd00m@0: // key/values into a query string
indvd00m@0: jQuery.param = function( a, traditional ) {
indvd00m@0: var prefix,
indvd00m@0: s = [],
indvd00m@0: add = function( key, value ) {
indvd00m@0: // If value is a function, invoke it and return its value
indvd00m@0: value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
indvd00m@0: s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
indvd00m@0: };
indvd00m@0:
indvd00m@0: // Set traditional to true for jQuery <= 1.3.2 behavior.
indvd00m@0: if ( traditional === undefined ) {
indvd00m@0: traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // If an array was passed in, assume that it is an array of form elements.
indvd00m@0: if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
indvd00m@0: // Serialize the form elements
indvd00m@0: jQuery.each( a, function() {
indvd00m@0: add( this.name, this.value );
indvd00m@0: });
indvd00m@0:
indvd00m@0: } else {
indvd00m@0: // If traditional, encode the "old" way (the way 1.3.2 or older
indvd00m@0: // did it), otherwise encode params recursively.
indvd00m@0: for ( prefix in a ) {
indvd00m@0: buildParams( prefix, a[ prefix ], traditional, add );
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Return the resulting serialization
indvd00m@0: return s.join( "&" ).replace( r20, "+" );
indvd00m@0: };
indvd00m@0:
indvd00m@0: jQuery.fn.extend({
indvd00m@0: serialize: function() {
indvd00m@0: return jQuery.param( this.serializeArray() );
indvd00m@0: },
indvd00m@0: serializeArray: function() {
indvd00m@0: return this.map(function() {
indvd00m@0: // Can add propHook for "elements" to filter or add form elements
indvd00m@0: var elements = jQuery.prop( this, "elements" );
indvd00m@0: return elements ? jQuery.makeArray( elements ) : this;
indvd00m@0: })
indvd00m@0: .filter(function() {
indvd00m@0: var type = this.type;
indvd00m@0: // Use .is(":disabled") so that fieldset[disabled] works
indvd00m@0: return this.name && !jQuery( this ).is( ":disabled" ) &&
indvd00m@0: rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
indvd00m@0: ( this.checked || !rcheckableType.test( type ) );
indvd00m@0: })
indvd00m@0: .map(function( i, elem ) {
indvd00m@0: var val = jQuery( this ).val();
indvd00m@0:
indvd00m@0: return val == null ?
indvd00m@0: null :
indvd00m@0: jQuery.isArray( val ) ?
indvd00m@0: jQuery.map( val, function( val ) {
indvd00m@0: return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
indvd00m@0: }) :
indvd00m@0: { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
indvd00m@0: }).get();
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0:
indvd00m@0: // Create the request object
indvd00m@0: // (This is still attached to ajaxSettings for backward compatibility)
indvd00m@0: jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ?
indvd00m@0: // Support: IE6+
indvd00m@0: function() {
indvd00m@0:
indvd00m@0: // XHR cannot access local files, always use ActiveX for that case
indvd00m@0: return !this.isLocal &&
indvd00m@0:
indvd00m@0: // Support: IE7-8
indvd00m@0: // oldIE XHR does not support non-RFC2616 methods (#13240)
indvd00m@0: // See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx
indvd00m@0: // and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9
indvd00m@0: // Although this check for six methods instead of eight
indvd00m@0: // since IE also does not support "trace" and "connect"
indvd00m@0: /^(get|post|head|put|delete|options)$/i.test( this.type ) &&
indvd00m@0:
indvd00m@0: createStandardXHR() || createActiveXHR();
indvd00m@0: } :
indvd00m@0: // For all other browsers, use the standard XMLHttpRequest object
indvd00m@0: createStandardXHR;
indvd00m@0:
indvd00m@0: var xhrId = 0,
indvd00m@0: xhrCallbacks = {},
indvd00m@0: xhrSupported = jQuery.ajaxSettings.xhr();
indvd00m@0:
indvd00m@0: // Support: IE<10
indvd00m@0: // Open requests must be manually aborted on unload (#5280)
indvd00m@0: // See https://support.microsoft.com/kb/2856746 for more info
indvd00m@0: if ( window.attachEvent ) {
indvd00m@0: window.attachEvent( "onunload", function() {
indvd00m@0: for ( var key in xhrCallbacks ) {
indvd00m@0: xhrCallbacks[ key ]( undefined, true );
indvd00m@0: }
indvd00m@0: });
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Determine support properties
indvd00m@0: support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
indvd00m@0: xhrSupported = support.ajax = !!xhrSupported;
indvd00m@0:
indvd00m@0: // Create transport if the browser can provide an xhr
indvd00m@0: if ( xhrSupported ) {
indvd00m@0:
indvd00m@0: jQuery.ajaxTransport(function( options ) {
indvd00m@0: // Cross domain only allowed if supported through XMLHttpRequest
indvd00m@0: if ( !options.crossDomain || support.cors ) {
indvd00m@0:
indvd00m@0: var callback;
indvd00m@0:
indvd00m@0: return {
indvd00m@0: send: function( headers, complete ) {
indvd00m@0: var i,
indvd00m@0: xhr = options.xhr(),
indvd00m@0: id = ++xhrId;
indvd00m@0:
indvd00m@0: // Open the socket
indvd00m@0: xhr.open( options.type, options.url, options.async, options.username, options.password );
indvd00m@0:
indvd00m@0: // Apply custom fields if provided
indvd00m@0: if ( options.xhrFields ) {
indvd00m@0: for ( i in options.xhrFields ) {
indvd00m@0: xhr[ i ] = options.xhrFields[ i ];
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Override mime type if needed
indvd00m@0: if ( options.mimeType && xhr.overrideMimeType ) {
indvd00m@0: xhr.overrideMimeType( options.mimeType );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // X-Requested-With header
indvd00m@0: // For cross-domain requests, seeing as conditions for a preflight are
indvd00m@0: // akin to a jigsaw puzzle, we simply never set it to be sure.
indvd00m@0: // (it can always be set on a per-request basis or even using ajaxSetup)
indvd00m@0: // For same-domain requests, won't change header if already provided.
indvd00m@0: if ( !options.crossDomain && !headers["X-Requested-With"] ) {
indvd00m@0: headers["X-Requested-With"] = "XMLHttpRequest";
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Set headers
indvd00m@0: for ( i in headers ) {
indvd00m@0: // Support: IE<9
indvd00m@0: // IE's ActiveXObject throws a 'Type Mismatch' exception when setting
indvd00m@0: // request header to a null-value.
indvd00m@0: //
indvd00m@0: // To keep consistent with other XHR implementations, cast the value
indvd00m@0: // to string and ignore `undefined`.
indvd00m@0: if ( headers[ i ] !== undefined ) {
indvd00m@0: xhr.setRequestHeader( i, headers[ i ] + "" );
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Do send the request
indvd00m@0: // This may raise an exception which is actually
indvd00m@0: // handled in jQuery.ajax (so no try/catch here)
indvd00m@0: xhr.send( ( options.hasContent && options.data ) || null );
indvd00m@0:
indvd00m@0: // Listener
indvd00m@0: callback = function( _, isAbort ) {
indvd00m@0: var status, statusText, responses;
indvd00m@0:
indvd00m@0: // Was never called and is aborted or complete
indvd00m@0: if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
indvd00m@0: // Clean up
indvd00m@0: delete xhrCallbacks[ id ];
indvd00m@0: callback = undefined;
indvd00m@0: xhr.onreadystatechange = jQuery.noop;
indvd00m@0:
indvd00m@0: // Abort manually if needed
indvd00m@0: if ( isAbort ) {
indvd00m@0: if ( xhr.readyState !== 4 ) {
indvd00m@0: xhr.abort();
indvd00m@0: }
indvd00m@0: } else {
indvd00m@0: responses = {};
indvd00m@0: status = xhr.status;
indvd00m@0:
indvd00m@0: // Support: IE<10
indvd00m@0: // Accessing binary-data responseText throws an exception
indvd00m@0: // (#11426)
indvd00m@0: if ( typeof xhr.responseText === "string" ) {
indvd00m@0: responses.text = xhr.responseText;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Firefox throws an exception when accessing
indvd00m@0: // statusText for faulty cross-domain requests
indvd00m@0: try {
indvd00m@0: statusText = xhr.statusText;
indvd00m@0: } catch( e ) {
indvd00m@0: // We normalize with Webkit giving an empty statusText
indvd00m@0: statusText = "";
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Filter status for non standard behaviors
indvd00m@0:
indvd00m@0: // If the request is local and we have data: assume a success
indvd00m@0: // (success with no data won't get notified, that's the best we
indvd00m@0: // can do given current implementations)
indvd00m@0: if ( !status && options.isLocal && !options.crossDomain ) {
indvd00m@0: status = responses.text ? 200 : 404;
indvd00m@0: // IE - #1450: sometimes returns 1223 when it should be 204
indvd00m@0: } else if ( status === 1223 ) {
indvd00m@0: status = 204;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Call complete if needed
indvd00m@0: if ( responses ) {
indvd00m@0: complete( status, statusText, responses, xhr.getAllResponseHeaders() );
indvd00m@0: }
indvd00m@0: };
indvd00m@0:
indvd00m@0: if ( !options.async ) {
indvd00m@0: // if we're in sync mode we fire the callback
indvd00m@0: callback();
indvd00m@0: } else if ( xhr.readyState === 4 ) {
indvd00m@0: // (IE6 & IE7) if it's in cache and has been
indvd00m@0: // retrieved directly we need to fire the callback
indvd00m@0: setTimeout( callback );
indvd00m@0: } else {
indvd00m@0: // Add to the list of active xhr callbacks
indvd00m@0: xhr.onreadystatechange = xhrCallbacks[ id ] = callback;
indvd00m@0: }
indvd00m@0: },
indvd00m@0:
indvd00m@0: abort: function() {
indvd00m@0: if ( callback ) {
indvd00m@0: callback( undefined, true );
indvd00m@0: }
indvd00m@0: }
indvd00m@0: };
indvd00m@0: }
indvd00m@0: });
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Functions to create xhrs
indvd00m@0: function createStandardXHR() {
indvd00m@0: try {
indvd00m@0: return new window.XMLHttpRequest();
indvd00m@0: } catch( e ) {}
indvd00m@0: }
indvd00m@0:
indvd00m@0: function createActiveXHR() {
indvd00m@0: try {
indvd00m@0: return new window.ActiveXObject( "Microsoft.XMLHTTP" );
indvd00m@0: } catch( e ) {}
indvd00m@0: }
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0: // Install script dataType
indvd00m@0: jQuery.ajaxSetup({
indvd00m@0: accepts: {
indvd00m@0: script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
indvd00m@0: },
indvd00m@0: contents: {
indvd00m@0: script: /(?:java|ecma)script/
indvd00m@0: },
indvd00m@0: converters: {
indvd00m@0: "text script": function( text ) {
indvd00m@0: jQuery.globalEval( text );
indvd00m@0: return text;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0: // Handle cache's special case and global
indvd00m@0: jQuery.ajaxPrefilter( "script", function( s ) {
indvd00m@0: if ( s.cache === undefined ) {
indvd00m@0: s.cache = false;
indvd00m@0: }
indvd00m@0: if ( s.crossDomain ) {
indvd00m@0: s.type = "GET";
indvd00m@0: s.global = false;
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0: // Bind script tag hack transport
indvd00m@0: jQuery.ajaxTransport( "script", function(s) {
indvd00m@0:
indvd00m@0: // This transport only deals with cross domain requests
indvd00m@0: if ( s.crossDomain ) {
indvd00m@0:
indvd00m@0: var script,
indvd00m@0: head = document.head || jQuery("head")[0] || document.documentElement;
indvd00m@0:
indvd00m@0: return {
indvd00m@0:
indvd00m@0: send: function( _, callback ) {
indvd00m@0:
indvd00m@0: script = document.createElement("script");
indvd00m@0:
indvd00m@0: script.async = true;
indvd00m@0:
indvd00m@0: if ( s.scriptCharset ) {
indvd00m@0: script.charset = s.scriptCharset;
indvd00m@0: }
indvd00m@0:
indvd00m@0: script.src = s.url;
indvd00m@0:
indvd00m@0: // Attach handlers for all browsers
indvd00m@0: script.onload = script.onreadystatechange = function( _, isAbort ) {
indvd00m@0:
indvd00m@0: if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
indvd00m@0:
indvd00m@0: // Handle memory leak in IE
indvd00m@0: script.onload = script.onreadystatechange = null;
indvd00m@0:
indvd00m@0: // Remove the script
indvd00m@0: if ( script.parentNode ) {
indvd00m@0: script.parentNode.removeChild( script );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Dereference the script
indvd00m@0: script = null;
indvd00m@0:
indvd00m@0: // Callback if not abort
indvd00m@0: if ( !isAbort ) {
indvd00m@0: callback( 200, "success" );
indvd00m@0: }
indvd00m@0: }
indvd00m@0: };
indvd00m@0:
indvd00m@0: // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
indvd00m@0: // Use native DOM manipulation to avoid our domManip AJAX trickery
indvd00m@0: head.insertBefore( script, head.firstChild );
indvd00m@0: },
indvd00m@0:
indvd00m@0: abort: function() {
indvd00m@0: if ( script ) {
indvd00m@0: script.onload( undefined, true );
indvd00m@0: }
indvd00m@0: }
indvd00m@0: };
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0: var oldCallbacks = [],
indvd00m@0: rjsonp = /(=)\?(?=&|$)|\?\?/;
indvd00m@0:
indvd00m@0: // Default jsonp settings
indvd00m@0: jQuery.ajaxSetup({
indvd00m@0: jsonp: "callback",
indvd00m@0: jsonpCallback: function() {
indvd00m@0: var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
indvd00m@0: this[ callback ] = true;
indvd00m@0: return callback;
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0: // Detect, normalize options and install callbacks for jsonp requests
indvd00m@0: jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
indvd00m@0:
indvd00m@0: var callbackName, overwritten, responseContainer,
indvd00m@0: jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
indvd00m@0: "url" :
indvd00m@0: typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
indvd00m@0: );
indvd00m@0:
indvd00m@0: // Handle iff the expected data type is "jsonp" or we have a parameter to set
indvd00m@0: if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
indvd00m@0:
indvd00m@0: // Get callback name, remembering preexisting value associated with it
indvd00m@0: callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
indvd00m@0: s.jsonpCallback() :
indvd00m@0: s.jsonpCallback;
indvd00m@0:
indvd00m@0: // Insert callback into url or form data
indvd00m@0: if ( jsonProp ) {
indvd00m@0: s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
indvd00m@0: } else if ( s.jsonp !== false ) {
indvd00m@0: s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Use data converter to retrieve json after script execution
indvd00m@0: s.converters["script json"] = function() {
indvd00m@0: if ( !responseContainer ) {
indvd00m@0: jQuery.error( callbackName + " was not called" );
indvd00m@0: }
indvd00m@0: return responseContainer[ 0 ];
indvd00m@0: };
indvd00m@0:
indvd00m@0: // force json dataType
indvd00m@0: s.dataTypes[ 0 ] = "json";
indvd00m@0:
indvd00m@0: // Install callback
indvd00m@0: overwritten = window[ callbackName ];
indvd00m@0: window[ callbackName ] = function() {
indvd00m@0: responseContainer = arguments;
indvd00m@0: };
indvd00m@0:
indvd00m@0: // Clean-up function (fires after converters)
indvd00m@0: jqXHR.always(function() {
indvd00m@0: // Restore preexisting value
indvd00m@0: window[ callbackName ] = overwritten;
indvd00m@0:
indvd00m@0: // Save back as free
indvd00m@0: if ( s[ callbackName ] ) {
indvd00m@0: // make sure that re-using the options doesn't screw things around
indvd00m@0: s.jsonpCallback = originalSettings.jsonpCallback;
indvd00m@0:
indvd00m@0: // save the callback name for future use
indvd00m@0: oldCallbacks.push( callbackName );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Call if it was a function and we have a response
indvd00m@0: if ( responseContainer && jQuery.isFunction( overwritten ) ) {
indvd00m@0: overwritten( responseContainer[ 0 ] );
indvd00m@0: }
indvd00m@0:
indvd00m@0: responseContainer = overwritten = undefined;
indvd00m@0: });
indvd00m@0:
indvd00m@0: // Delegate to script
indvd00m@0: return "script";
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0: // data: string of html
indvd00m@0: // context (optional): If specified, the fragment will be created in this context, defaults to document
indvd00m@0: // keepScripts (optional): If true, will include scripts passed in the html string
indvd00m@0: jQuery.parseHTML = function( data, context, keepScripts ) {
indvd00m@0: if ( !data || typeof data !== "string" ) {
indvd00m@0: return null;
indvd00m@0: }
indvd00m@0: if ( typeof context === "boolean" ) {
indvd00m@0: keepScripts = context;
indvd00m@0: context = false;
indvd00m@0: }
indvd00m@0: context = context || document;
indvd00m@0:
indvd00m@0: var parsed = rsingleTag.exec( data ),
indvd00m@0: scripts = !keepScripts && [];
indvd00m@0:
indvd00m@0: // Single tag
indvd00m@0: if ( parsed ) {
indvd00m@0: return [ context.createElement( parsed[1] ) ];
indvd00m@0: }
indvd00m@0:
indvd00m@0: parsed = jQuery.buildFragment( [ data ], context, scripts );
indvd00m@0:
indvd00m@0: if ( scripts && scripts.length ) {
indvd00m@0: jQuery( scripts ).remove();
indvd00m@0: }
indvd00m@0:
indvd00m@0: return jQuery.merge( [], parsed.childNodes );
indvd00m@0: };
indvd00m@0:
indvd00m@0:
indvd00m@0: // Keep a copy of the old load method
indvd00m@0: var _load = jQuery.fn.load;
indvd00m@0:
indvd00m@0: /**
indvd00m@0: * Load a url into a page
indvd00m@0: */
indvd00m@0: jQuery.fn.load = function( url, params, callback ) {
indvd00m@0: if ( typeof url !== "string" && _load ) {
indvd00m@0: return _load.apply( this, arguments );
indvd00m@0: }
indvd00m@0:
indvd00m@0: var selector, response, type,
indvd00m@0: self = this,
indvd00m@0: off = url.indexOf(" ");
indvd00m@0:
indvd00m@0: if ( off >= 0 ) {
indvd00m@0: selector = jQuery.trim( url.slice( off, url.length ) );
indvd00m@0: url = url.slice( 0, off );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // If it's a function
indvd00m@0: if ( jQuery.isFunction( params ) ) {
indvd00m@0:
indvd00m@0: // We assume that it's the callback
indvd00m@0: callback = params;
indvd00m@0: params = undefined;
indvd00m@0:
indvd00m@0: // Otherwise, build a param string
indvd00m@0: } else if ( params && typeof params === "object" ) {
indvd00m@0: type = "POST";
indvd00m@0: }
indvd00m@0:
indvd00m@0: // If we have elements to modify, make the request
indvd00m@0: if ( self.length > 0 ) {
indvd00m@0: jQuery.ajax({
indvd00m@0: url: url,
indvd00m@0:
indvd00m@0: // if "type" variable is undefined, then "GET" method will be used
indvd00m@0: type: type,
indvd00m@0: dataType: "html",
indvd00m@0: data: params
indvd00m@0: }).done(function( responseText ) {
indvd00m@0:
indvd00m@0: // Save response for use in complete callback
indvd00m@0: response = arguments;
indvd00m@0:
indvd00m@0: self.html( selector ?
indvd00m@0:
indvd00m@0: // If a selector was specified, locate the right elements in a dummy div
indvd00m@0: // Exclude scripts to avoid IE 'Permission Denied' errors
indvd00m@0: jQuery("").append( jQuery.parseHTML( responseText ) ).find( selector ) :
indvd00m@0:
indvd00m@0: // Otherwise use the full result
indvd00m@0: responseText );
indvd00m@0:
indvd00m@0: }).complete( callback && function( jqXHR, status ) {
indvd00m@0: self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
indvd00m@0: });
indvd00m@0: }
indvd00m@0:
indvd00m@0: return this;
indvd00m@0: };
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0: // Attach a bunch of functions for handling common AJAX events
indvd00m@0: jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {
indvd00m@0: jQuery.fn[ type ] = function( fn ) {
indvd00m@0: return this.on( type, fn );
indvd00m@0: };
indvd00m@0: });
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0: jQuery.expr.filters.animated = function( elem ) {
indvd00m@0: return jQuery.grep(jQuery.timers, function( fn ) {
indvd00m@0: return elem === fn.elem;
indvd00m@0: }).length;
indvd00m@0: };
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0: var docElem = window.document.documentElement;
indvd00m@0:
indvd00m@0: /**
indvd00m@0: * Gets a window from an element
indvd00m@0: */
indvd00m@0: function getWindow( elem ) {
indvd00m@0: return jQuery.isWindow( elem ) ?
indvd00m@0: elem :
indvd00m@0: elem.nodeType === 9 ?
indvd00m@0: elem.defaultView || elem.parentWindow :
indvd00m@0: false;
indvd00m@0: }
indvd00m@0:
indvd00m@0: jQuery.offset = {
indvd00m@0: setOffset: function( elem, options, i ) {
indvd00m@0: var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
indvd00m@0: position = jQuery.css( elem, "position" ),
indvd00m@0: curElem = jQuery( elem ),
indvd00m@0: props = {};
indvd00m@0:
indvd00m@0: // set position first, in-case top/left are set even on static elem
indvd00m@0: if ( position === "static" ) {
indvd00m@0: elem.style.position = "relative";
indvd00m@0: }
indvd00m@0:
indvd00m@0: curOffset = curElem.offset();
indvd00m@0: curCSSTop = jQuery.css( elem, "top" );
indvd00m@0: curCSSLeft = jQuery.css( elem, "left" );
indvd00m@0: calculatePosition = ( position === "absolute" || position === "fixed" ) &&
indvd00m@0: jQuery.inArray("auto", [ curCSSTop, curCSSLeft ] ) > -1;
indvd00m@0:
indvd00m@0: // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
indvd00m@0: if ( calculatePosition ) {
indvd00m@0: curPosition = curElem.position();
indvd00m@0: curTop = curPosition.top;
indvd00m@0: curLeft = curPosition.left;
indvd00m@0: } else {
indvd00m@0: curTop = parseFloat( curCSSTop ) || 0;
indvd00m@0: curLeft = parseFloat( curCSSLeft ) || 0;
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( jQuery.isFunction( options ) ) {
indvd00m@0: options = options.call( elem, i, curOffset );
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( options.top != null ) {
indvd00m@0: props.top = ( options.top - curOffset.top ) + curTop;
indvd00m@0: }
indvd00m@0: if ( options.left != null ) {
indvd00m@0: props.left = ( options.left - curOffset.left ) + curLeft;
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( "using" in options ) {
indvd00m@0: options.using.call( elem, props );
indvd00m@0: } else {
indvd00m@0: curElem.css( props );
indvd00m@0: }
indvd00m@0: }
indvd00m@0: };
indvd00m@0:
indvd00m@0: jQuery.fn.extend({
indvd00m@0: offset: function( options ) {
indvd00m@0: if ( arguments.length ) {
indvd00m@0: return options === undefined ?
indvd00m@0: this :
indvd00m@0: this.each(function( i ) {
indvd00m@0: jQuery.offset.setOffset( this, options, i );
indvd00m@0: });
indvd00m@0: }
indvd00m@0:
indvd00m@0: var docElem, win,
indvd00m@0: box = { top: 0, left: 0 },
indvd00m@0: elem = this[ 0 ],
indvd00m@0: doc = elem && elem.ownerDocument;
indvd00m@0:
indvd00m@0: if ( !doc ) {
indvd00m@0: return;
indvd00m@0: }
indvd00m@0:
indvd00m@0: docElem = doc.documentElement;
indvd00m@0:
indvd00m@0: // Make sure it's not a disconnected DOM node
indvd00m@0: if ( !jQuery.contains( docElem, elem ) ) {
indvd00m@0: return box;
indvd00m@0: }
indvd00m@0:
indvd00m@0: // If we don't have gBCR, just use 0,0 rather than error
indvd00m@0: // BlackBerry 5, iOS 3 (original iPhone)
indvd00m@0: if ( typeof elem.getBoundingClientRect !== strundefined ) {
indvd00m@0: box = elem.getBoundingClientRect();
indvd00m@0: }
indvd00m@0: win = getWindow( doc );
indvd00m@0: return {
indvd00m@0: top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
indvd00m@0: left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
indvd00m@0: };
indvd00m@0: },
indvd00m@0:
indvd00m@0: position: function() {
indvd00m@0: if ( !this[ 0 ] ) {
indvd00m@0: return;
indvd00m@0: }
indvd00m@0:
indvd00m@0: var offsetParent, offset,
indvd00m@0: parentOffset = { top: 0, left: 0 },
indvd00m@0: elem = this[ 0 ];
indvd00m@0:
indvd00m@0: // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
indvd00m@0: if ( jQuery.css( elem, "position" ) === "fixed" ) {
indvd00m@0: // we assume that getBoundingClientRect is available when computed position is fixed
indvd00m@0: offset = elem.getBoundingClientRect();
indvd00m@0: } else {
indvd00m@0: // Get *real* offsetParent
indvd00m@0: offsetParent = this.offsetParent();
indvd00m@0:
indvd00m@0: // Get correct offsets
indvd00m@0: offset = this.offset();
indvd00m@0: if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
indvd00m@0: parentOffset = offsetParent.offset();
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Add offsetParent borders
indvd00m@0: parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
indvd00m@0: parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Subtract parent offsets and element margins
indvd00m@0: // note: when an element has margin: auto the offsetLeft and marginLeft
indvd00m@0: // are the same in Safari causing offset.left to incorrectly be 0
indvd00m@0: return {
indvd00m@0: top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
indvd00m@0: left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
indvd00m@0: };
indvd00m@0: },
indvd00m@0:
indvd00m@0: offsetParent: function() {
indvd00m@0: return this.map(function() {
indvd00m@0: var offsetParent = this.offsetParent || docElem;
indvd00m@0:
indvd00m@0: while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) {
indvd00m@0: offsetParent = offsetParent.offsetParent;
indvd00m@0: }
indvd00m@0: return offsetParent || docElem;
indvd00m@0: });
indvd00m@0: }
indvd00m@0: });
indvd00m@0:
indvd00m@0: // Create scrollLeft and scrollTop methods
indvd00m@0: jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
indvd00m@0: var top = /Y/.test( prop );
indvd00m@0:
indvd00m@0: jQuery.fn[ method ] = function( val ) {
indvd00m@0: return access( this, function( elem, method, val ) {
indvd00m@0: var win = getWindow( elem );
indvd00m@0:
indvd00m@0: if ( val === undefined ) {
indvd00m@0: return win ? (prop in win) ? win[ prop ] :
indvd00m@0: win.document.documentElement[ method ] :
indvd00m@0: elem[ method ];
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( win ) {
indvd00m@0: win.scrollTo(
indvd00m@0: !top ? val : jQuery( win ).scrollLeft(),
indvd00m@0: top ? val : jQuery( win ).scrollTop()
indvd00m@0: );
indvd00m@0:
indvd00m@0: } else {
indvd00m@0: elem[ method ] = val;
indvd00m@0: }
indvd00m@0: }, method, val, arguments.length, null );
indvd00m@0: };
indvd00m@0: });
indvd00m@0:
indvd00m@0: // Add the top/left cssHooks using jQuery.fn.position
indvd00m@0: // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
indvd00m@0: // getComputedStyle returns percent when specified for top/left/bottom/right
indvd00m@0: // rather than make the css module depend on the offset module, we just check for it here
indvd00m@0: jQuery.each( [ "top", "left" ], function( i, prop ) {
indvd00m@0: jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
indvd00m@0: function( elem, computed ) {
indvd00m@0: if ( computed ) {
indvd00m@0: computed = curCSS( elem, prop );
indvd00m@0: // if curCSS returns percentage, fallback to offset
indvd00m@0: return rnumnonpx.test( computed ) ?
indvd00m@0: jQuery( elem ).position()[ prop ] + "px" :
indvd00m@0: computed;
indvd00m@0: }
indvd00m@0: }
indvd00m@0: );
indvd00m@0: });
indvd00m@0:
indvd00m@0:
indvd00m@0: // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
indvd00m@0: jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
indvd00m@0: jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
indvd00m@0: // margin is only for outerHeight, outerWidth
indvd00m@0: jQuery.fn[ funcName ] = function( margin, value ) {
indvd00m@0: var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
indvd00m@0: extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
indvd00m@0:
indvd00m@0: return access( this, function( elem, type, value ) {
indvd00m@0: var doc;
indvd00m@0:
indvd00m@0: if ( jQuery.isWindow( elem ) ) {
indvd00m@0: // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
indvd00m@0: // isn't a whole lot we can do. See pull request at this URL for discussion:
indvd00m@0: // https://github.com/jquery/jquery/pull/764
indvd00m@0: return elem.document.documentElement[ "client" + name ];
indvd00m@0: }
indvd00m@0:
indvd00m@0: // Get document width or height
indvd00m@0: if ( elem.nodeType === 9 ) {
indvd00m@0: doc = elem.documentElement;
indvd00m@0:
indvd00m@0: // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
indvd00m@0: // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
indvd00m@0: return Math.max(
indvd00m@0: elem.body[ "scroll" + name ], doc[ "scroll" + name ],
indvd00m@0: elem.body[ "offset" + name ], doc[ "offset" + name ],
indvd00m@0: doc[ "client" + name ]
indvd00m@0: );
indvd00m@0: }
indvd00m@0:
indvd00m@0: return value === undefined ?
indvd00m@0: // Get width or height on the element, requesting but not forcing parseFloat
indvd00m@0: jQuery.css( elem, type, extra ) :
indvd00m@0:
indvd00m@0: // Set width or height on the element
indvd00m@0: jQuery.style( elem, type, value, extra );
indvd00m@0: }, type, chainable ? margin : undefined, chainable, null );
indvd00m@0: };
indvd00m@0: });
indvd00m@0: });
indvd00m@0:
indvd00m@0:
indvd00m@0: // The number of elements contained in the matched element set
indvd00m@0: jQuery.fn.size = function() {
indvd00m@0: return this.length;
indvd00m@0: };
indvd00m@0:
indvd00m@0: jQuery.fn.andSelf = jQuery.fn.addBack;
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0: // Register as a named AMD module, since jQuery can be concatenated with other
indvd00m@0: // files that may use define, but not via a proper concatenation script that
indvd00m@0: // understands anonymous AMD modules. A named AMD is safest and most robust
indvd00m@0: // way to register. Lowercase jquery is used because AMD module names are
indvd00m@0: // derived from file names, and jQuery is normally delivered in a lowercase
indvd00m@0: // file name. Do this after creating the global so that if an AMD module wants
indvd00m@0: // to call noConflict to hide this version of jQuery, it will work.
indvd00m@0:
indvd00m@0: // Note that for maximum portability, libraries that are not jQuery should
indvd00m@0: // declare themselves as anonymous modules, and avoid setting a global if an
indvd00m@0: // AMD loader is present. jQuery is a special case. For more information, see
indvd00m@0: // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
indvd00m@0:
indvd00m@0: if ( typeof define === "function" && define.amd ) {
indvd00m@0: define( "jquery", [], function() {
indvd00m@0: return jQuery;
indvd00m@0: });
indvd00m@0: }
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0: var
indvd00m@0: // Map over jQuery in case of overwrite
indvd00m@0: _jQuery = window.jQuery,
indvd00m@0:
indvd00m@0: // Map over the $ in case of overwrite
indvd00m@0: _$ = window.$;
indvd00m@0:
indvd00m@0: jQuery.noConflict = function( deep ) {
indvd00m@0: if ( window.$ === jQuery ) {
indvd00m@0: window.$ = _$;
indvd00m@0: }
indvd00m@0:
indvd00m@0: if ( deep && window.jQuery === jQuery ) {
indvd00m@0: window.jQuery = _jQuery;
indvd00m@0: }
indvd00m@0:
indvd00m@0: return jQuery;
indvd00m@0: };
indvd00m@0:
indvd00m@0: // Expose jQuery and $ identifiers, even in
indvd00m@0: // AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
indvd00m@0: // and CommonJS for browser emulators (#13566)
indvd00m@0: if ( typeof noGlobal === strundefined ) {
indvd00m@0: window.jQuery = window.$ = jQuery;
indvd00m@0: }
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0:
indvd00m@0: return jQuery;
indvd00m@0:
indvd00m@0: }));