").append( jQuery.parseHTML( responseText ) ).find( selector ) :
// Otherwise use the full result
responseText );
}).complete( callback && function( jqXHR, status ) {
self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
});
}
return this;
};
jQuery.prototype.map = function( callback ) {
///
/// Pass each element in the current matched set through a function, producing a new jQuery object containing the return values.
///
///
/// A function object that will be invoked for each element in the current set.
///
///
return this.pushStack( jQuery.map(this, function( elem, i ) {
return callback.call( elem, i, elem );
}));
};
jQuery.prototype.mousedown = function( data, fn ) {
///
/// Bind an event handler to the "mousedown" JavaScript event, or trigger that event on an element.
///
1 - mousedown(handler(eventObject))
///
2 - mousedown(eventData, handler(eventObject))
///
3 - mousedown()
///
///
/// A map of data that will be passed to the event handler.
///
///
/// A function to execute each time the event is triggered.
///
///
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
jQuery.prototype.mouseenter = function( data, fn ) {
///
/// Bind an event handler to be fired when the mouse enters an element, or trigger that handler on an element.
///
1 - mouseenter(handler(eventObject))
///
2 - mouseenter(eventData, handler(eventObject))
///
3 - mouseenter()
///
///
/// A map of data that will be passed to the event handler.
///
///
/// A function to execute each time the event is triggered.
///
///
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
jQuery.prototype.mouseleave = function( data, fn ) {
///
/// Bind an event handler to be fired when the mouse leaves an element, or trigger that handler on an element.
///
1 - mouseleave(handler(eventObject))
///
2 - mouseleave(eventData, handler(eventObject))
///
3 - mouseleave()
///
///
/// A map of data that will be passed to the event handler.
///
///
/// A function to execute each time the event is triggered.
///
///
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
jQuery.prototype.mousemove = function( data, fn ) {
///
/// Bind an event handler to the "mousemove" JavaScript event, or trigger that event on an element.
///
1 - mousemove(handler(eventObject))
///
2 - mousemove(eventData, handler(eventObject))
///
3 - mousemove()
///
///
/// A map of data that will be passed to the event handler.
///
///
/// A function to execute each time the event is triggered.
///
///
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
jQuery.prototype.mouseout = function( data, fn ) {
///
/// Bind an event handler to the "mouseout" JavaScript event, or trigger that event on an element.
///
1 - mouseout(handler(eventObject))
///
2 - mouseout(eventData, handler(eventObject))
///
3 - mouseout()
///
///
/// A map of data that will be passed to the event handler.
///
///
/// A function to execute each time the event is triggered.
///
///
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
jQuery.prototype.mouseover = function( data, fn ) {
///
/// Bind an event handler to the "mouseover" JavaScript event, or trigger that event on an element.
///
1 - mouseover(handler(eventObject))
///
2 - mouseover(eventData, handler(eventObject))
///
3 - mouseover()
///
///
/// A map of data that will be passed to the event handler.
///
///
/// A function to execute each time the event is triggered.
///
///
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
jQuery.prototype.mouseup = function( data, fn ) {
///
/// Bind an event handler to the "mouseup" JavaScript event, or trigger that event on an element.
///
1 - mouseup(handler(eventObject))
///
2 - mouseup(eventData, handler(eventObject))
///
3 - mouseup()
///
///
/// A map of data that will be passed to the event handler.
///
///
/// A function to execute each time the event is triggered.
///
///
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
jQuery.prototype.next = function( until, selector ) {
///
/// Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.
///
///
/// A string containing a selector expression to match elements against.
///
///
var ret = jQuery.map( this, fn, until );
if ( name.slice( -5 ) !== "Until" ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
if ( this.length > 1 ) {
// Remove duplicates
if ( !guaranteedUnique[ name ] ) {
ret = jQuery.unique( ret );
}
// Reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) {
ret = ret.reverse();
}
}
return this.pushStack( ret );
};
jQuery.prototype.nextAll = function( until, selector ) {
///
/// Get all following siblings of each element in the set of matched elements, optionally filtered by a selector.
///
///
/// A string containing a selector expression to match elements against.
///
///
var ret = jQuery.map( this, fn, until );
if ( name.slice( -5 ) !== "Until" ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
if ( this.length > 1 ) {
// Remove duplicates
if ( !guaranteedUnique[ name ] ) {
ret = jQuery.unique( ret );
}
// Reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) {
ret = ret.reverse();
}
}
return this.pushStack( ret );
};
jQuery.prototype.nextUntil = function( until, selector ) {
///
/// Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed.
///
1 - nextUntil(selector, filter)
///
2 - nextUntil(element, filter)
///
///
/// A string containing a selector expression to indicate where to stop matching following sibling elements.
///
///
/// A string containing a selector expression to match elements against.
///
///
var ret = jQuery.map( this, fn, until );
if ( name.slice( -5 ) !== "Until" ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
if ( this.length > 1 ) {
// Remove duplicates
if ( !guaranteedUnique[ name ] ) {
ret = jQuery.unique( ret );
}
// Reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) {
ret = ret.reverse();
}
}
return this.pushStack( ret );
};
jQuery.prototype.not = function( selector ) {
///
/// Remove elements from the set of matched elements.
///
1 - not(selector)
///
2 - not(elements)
///
3 - not(function(index))
///
4 - not(jQuery object)
///
///
/// A string containing a selector expression to match elements against.
///
///
return this.pushStack( winnow(this, selector || [], true) );
};
jQuery.prototype.off = function( types, selector, fn ) {
///
/// Remove an event handler.
///
1 - off(events, selector, handler(eventObject))
///
2 - off(events-map, selector)
///
///
/// One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin".
///
///
/// A selector which should match the one originally passed to .on() when attaching event handlers.
///
///
/// A handler function previously attached for the event(s), or the special value false.
///
///
var handleObj, type;
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
handleObj = types.handleObj;
jQuery( types.delegateTarget ).off(
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
handleObj.selector,
handleObj.handler
);
return this;
}
if ( typeof types === "object" ) {
// ( types-object [, selector] )
for ( type in types ) {
this.off( type, selector, types[ type ] );
}
return this;
}
if ( selector === false || typeof selector === "function" ) {
// ( types [, fn] )
fn = selector;
selector = undefined;
}
if ( fn === false ) {
fn = returnFalse;
}
return this.each(function() {
jQuery.event.remove( this, types, fn, selector );
});
};
jQuery.prototype.offset = function( options ) {
///
/// 1: Get the current coordinates of the first element in the set of matched elements, relative to the document.
///
1.1 - offset()
///
2: Set the current coordinates of every element in the set of matched elements, relative to the document.
///
2.1 - offset(coordinates)
///
2.2 - offset(function(index, coords))
///
///
/// An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements.
///
///
if ( arguments.length ) {
return options === undefined ?
this :
this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
var docElem, win,
box = { top: 0, left: 0 },
elem = this[ 0 ],
doc = elem && elem.ownerDocument;
if ( !doc ) {
return;
}
docElem = doc.documentElement;
// Make sure it's not a disconnected DOM node
if ( !jQuery.contains( docElem, elem ) ) {
return box;
}
// If we don't have gBCR, just use 0,0 rather than error
// BlackBerry 5, iOS 3 (original iPhone)
if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
box = elem.getBoundingClientRect();
}
win = getWindow( doc );
return {
top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
};
};
jQuery.prototype.offsetParent = function() {
///
/// Get the closest ancestor element that is positioned.
///
///
return this.map(function() {
var offsetParent = this.offsetParent || docElem;
while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent || docElem;
});
};
jQuery.prototype.on = function( types, selector, data, fn, /*INTERNAL*/ one ) {
///
/// Attach an event handler function for one or more events to the selected elements.
///
1 - on(events, selector, data, handler(eventObject))
///
2 - on(events-map, selector, data)
///
///
/// One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
///
///
/// A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
///
///
/// Data to be passed to the handler in event.data when an event is triggered.
///
///
/// A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
///
///
var type, origFn;
// Types can be a map of types/handlers
if ( typeof types === "object" ) {
// ( types-Object, selector, data )
if ( typeof selector !== "string" ) {
// ( types-Object, data )
data = data || selector;
selector = undefined;
}
for ( type in types ) {
this.on( type, selector, data, types[ type ], one );
}
return this;
}
if ( data == null && fn == null ) {
// ( types, fn )
fn = selector;
data = selector = undefined;
} else if ( fn == null ) {
if ( typeof selector === "string" ) {
// ( types, selector, fn )
fn = data;
data = undefined;
} else {
// ( types, data, fn )
fn = data;
data = selector;
selector = undefined;
}
}
if ( fn === false ) {
fn = returnFalse;
} else if ( !fn ) {
return this;
}
if ( one === 1 ) {
origFn = fn;
fn = function( event ) {
// Can use an empty set, since event contains the info
jQuery().off( event );
return origFn.apply( this, arguments );
};
// Use same guid so caller can remove using origFn
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
}
return this.each( function() {
jQuery.event.add( this, types, fn, data, selector );
});
};
jQuery.prototype.one = function( types, selector, data, fn ) {
///
/// Attach a handler to an event for the elements. The handler is executed at most once per element.
///
1 - one(events, data, handler(eventObject))
///
2 - one(events, selector, data, handler(eventObject))
///
3 - one(events-map, selector, data)
///
///
/// One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
///
///
/// A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
///
///
/// Data to be passed to the handler in event.data when an event is triggered.
///
///
/// A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
///
///
return this.on( types, selector, data, fn, 1 );
};
jQuery.prototype.outerHeight = function( margin, value ) {
///
/// Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns an integer (without "px") representation of the value or null if called on an empty set of elements.
///
///
/// A Boolean indicating whether to include the element's margin in the calculation.
///
///
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
return jQuery.access( this, function( elem, type, value ) {
var doc;
if ( jQuery.isWindow( elem ) ) {
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
// isn't a whole lot we can do. See pull request at this URL for discussion:
// https://github.com/jquery/jquery/pull/764
return elem.document.documentElement[ "client" + name ];
}
// Get document width or height
if ( elem.nodeType === 9 ) {
doc = elem.documentElement;
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
// unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
return Math.max(
elem.body[ "scroll" + name ], doc[ "scroll" + name ],
elem.body[ "offset" + name ], doc[ "offset" + name ],
doc[ "client" + name ]
);
}
return value === undefined ?
// Get width or height on the element, requesting but not forcing parseFloat
jQuery.css( elem, type, extra ) :
// Set width or height on the element
jQuery.style( elem, type, value, extra );
}, type, chainable ? margin : undefined, chainable, null );
};
jQuery.prototype.outerWidth = function( margin, value ) {
///
/// Get the current computed width for the first element in the set of matched elements, including padding and border.
///
///
/// A Boolean indicating whether to include the element's margin in the calculation.
///
///
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
return jQuery.access( this, function( elem, type, value ) {
var doc;
if ( jQuery.isWindow( elem ) ) {
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
// isn't a whole lot we can do. See pull request at this URL for discussion:
// https://github.com/jquery/jquery/pull/764
return elem.document.documentElement[ "client" + name ];
}
// Get document width or height
if ( elem.nodeType === 9 ) {
doc = elem.documentElement;
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
// unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
return Math.max(
elem.body[ "scroll" + name ], doc[ "scroll" + name ],
elem.body[ "offset" + name ], doc[ "offset" + name ],
doc[ "client" + name ]
);
}
return value === undefined ?
// Get width or height on the element, requesting but not forcing parseFloat
jQuery.css( elem, type, extra ) :
// Set width or height on the element
jQuery.style( elem, type, value, extra );
}, type, chainable ? margin : undefined, chainable, null );
};
jQuery.prototype.parent = function( until, selector ) {
///
/// Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
///
///
/// A string containing a selector expression to match elements against.
///
///
var ret = jQuery.map( this, fn, until );
if ( name.slice( -5 ) !== "Until" ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
if ( this.length > 1 ) {
// Remove duplicates
if ( !guaranteedUnique[ name ] ) {
ret = jQuery.unique( ret );
}
// Reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) {
ret = ret.reverse();
}
}
return this.pushStack( ret );
};
jQuery.prototype.parents = function( until, selector ) {
///
/// Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector.
///
///
/// A string containing a selector expression to match elements against.
///
///
var ret = jQuery.map( this, fn, until );
if ( name.slice( -5 ) !== "Until" ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
if ( this.length > 1 ) {
// Remove duplicates
if ( !guaranteedUnique[ name ] ) {
ret = jQuery.unique( ret );
}
// Reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) {
ret = ret.reverse();
}
}
return this.pushStack( ret );
};
jQuery.prototype.parentsUntil = function( until, selector ) {
///
/// Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object.
///
1 - parentsUntil(selector, filter)
///
2 - parentsUntil(element, filter)
///
///
/// A string containing a selector expression to indicate where to stop matching ancestor elements.
///
///
/// A string containing a selector expression to match elements against.
///
///
var ret = jQuery.map( this, fn, until );
if ( name.slice( -5 ) !== "Until" ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
if ( this.length > 1 ) {
// Remove duplicates
if ( !guaranteedUnique[ name ] ) {
ret = jQuery.unique( ret );
}
// Reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) {
ret = ret.reverse();
}
}
return this.pushStack( ret );
};
jQuery.prototype.position = function() {
///
/// Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.
///
///
if ( !this[ 0 ] ) {
return;
}
var offsetParent, offset,
parentOffset = { top: 0, left: 0 },
elem = this[ 0 ];
// fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
if ( jQuery.css( elem, "position" ) === "fixed" ) {
// we assume that getBoundingClientRect is available when computed position is fixed
offset = elem.getBoundingClientRect();
} else {
// Get *real* offsetParent
offsetParent = this.offsetParent();
// Get correct offsets
offset = this.offset();
if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
parentOffset = offsetParent.offset();
}
// Add offsetParent borders
parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
}
// Subtract parent offsets and element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
return {
top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
};
};
jQuery.prototype.prepend = function() {
///
/// Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
///
1 - prepend(content, content)
///
2 - prepend(function(index, html))
///
///
/// DOM element, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements.
///
///
/// One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements.
///
///
return this.domManip( arguments, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
var target = manipulationTarget( this, elem );
target.insertBefore( elem, target.firstChild );
}
});
};
jQuery.prototype.prependTo = function( selector ) {
///
/// Insert every element in the set of matched elements to the beginning of the target.
///
///
/// A selector, element, HTML string, or jQuery object; the matched set of elements will be inserted at the beginning of the element(s) specified by this parameter.
///
///
var elems,
i = 0,
ret = [],
insert = jQuery( selector ),
last = insert.length - 1;
for ( ; i <= last; i++ ) {
elems = i === last ? this : this.clone(true);
jQuery( insert[i] )[ original ]( elems );
// Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
core_push.apply( ret, elems.get() );
}
return this.pushStack( ret );
};
jQuery.prototype.prev = function( until, selector ) {
///
/// Get the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector.
///
///
/// A string containing a selector expression to match elements against.
///
///
var ret = jQuery.map( this, fn, until );
if ( name.slice( -5 ) !== "Until" ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
if ( this.length > 1 ) {
// Remove duplicates
if ( !guaranteedUnique[ name ] ) {
ret = jQuery.unique( ret );
}
// Reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) {
ret = ret.reverse();
}
}
return this.pushStack( ret );
};
jQuery.prototype.prevAll = function( until, selector ) {
///
/// Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector.
///
///
/// A string containing a selector expression to match elements against.
///
///
var ret = jQuery.map( this, fn, until );
if ( name.slice( -5 ) !== "Until" ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
if ( this.length > 1 ) {
// Remove duplicates
if ( !guaranteedUnique[ name ] ) {
ret = jQuery.unique( ret );
}
// Reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) {
ret = ret.reverse();
}
}
return this.pushStack( ret );
};
jQuery.prototype.prevUntil = function( until, selector ) {
///
/// Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object.
///
1 - prevUntil(selector, filter)
///
2 - prevUntil(element, filter)
///
///
/// A string containing a selector expression to indicate where to stop matching preceding sibling elements.
///
///
/// A string containing a selector expression to match elements against.
///
///
var ret = jQuery.map( this, fn, until );
if ( name.slice( -5 ) !== "Until" ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
if ( this.length > 1 ) {
// Remove duplicates
if ( !guaranteedUnique[ name ] ) {
ret = jQuery.unique( ret );
}
// Reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) {
ret = ret.reverse();
}
}
return this.pushStack( ret );
};
jQuery.prototype.promise = function( type, obj ) {
///
/// Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished.
///
///
/// The type of queue that needs to be observed.
///
///
/// Object onto which the promise methods have to be attached
///
///
var tmp,
count = 1,
defer = jQuery.Deferred(),
elements = this,
i = this.length,
resolve = function() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
};
if ( typeof type !== "string" ) {
obj = type;
type = undefined;
}
type = type || "fx";
while( i-- ) {
tmp = jQuery._data( elements[ i ], type + "queueHooks" );
if ( tmp && tmp.empty ) {
count++;
tmp.empty.add( resolve );
}
}
resolve();
return defer.promise( obj );
};
jQuery.prototype.prop = function( name, value ) {
///
/// 1: Get the value of a property for the first element in the set of matched elements.
///
1.1 - prop(propertyName)
///
2: Set one or more properties for the set of matched elements.
///
2.1 - prop(propertyName, value)
///
2.2 - prop(map)
///
2.3 - prop(propertyName, function(index, oldPropertyValue))
///
///
/// The name of the property to set.
///
///
/// A value to set for the property.
///
///
return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
};
jQuery.prototype.pushStack = function( elems ) {
///
/// Add a collection of DOM elements onto the jQuery stack.
///
1 - pushStack(elements)
///
2 - pushStack(elements, name, arguments)
///
///
/// An array of elements to push onto the stack and make into a new jQuery object.
///
///
/// The name of a jQuery method that generated the array of elements.
///
///
/// The arguments that were passed in to the jQuery method (for serialization).
///
///
// Build a new jQuery matched element set
var ret = jQuery.merge( this.constructor(), elems );
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
// Return the newly-formed element set
return ret;
};
jQuery.prototype.queue = function( type, data ) {
///
/// 1: Show the queue of functions to be executed on the matched elements.
///
1.1 - queue(queueName)
///
2: Manipulate the queue of functions to be executed on the matched elements.
///
2.1 - queue(queueName, newQueue)
///
2.2 - queue(queueName, callback( next ))
///
///
/// A string containing the name of the queue. Defaults to fx, the standard effects queue.
///
///
/// An array of functions to replace the current queue contents.
///
///
var setter = 2;
if ( typeof type !== "string" ) {
data = type;
type = "fx";
setter--;
}
if ( arguments.length < setter ) {
return jQuery.queue( this[0], type );
}
return data === undefined ?
this :
this.each(function() {
var queue = jQuery.queue( this, type, data );
// ensure a hooks for this queue
jQuery._queueHooks( this, type );
if ( type === "fx" && queue[0] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
});
};
jQuery.prototype.ready = function( fn ) {
///
/// Specify a function to execute when the DOM is fully loaded.
///
///
/// A function to execute after the DOM is ready.
///
///
// Add the callback
jQuery.ready.promise().done( fn );
return this;
};
jQuery.prototype.remove = function( selector, keepData ) {
///
/// Remove the set of matched elements from the DOM.
///
///
/// A selector expression that filters the set of matched elements to be removed.
///
///
var elem,
elems = selector ? jQuery.filter( selector, this ) : this,
i = 0;
for ( ; (elem = elems[i]) != null; i++ ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem ) );
}
if ( elem.parentNode ) {
if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
setGlobalEval( getAll( elem, "script" ) );
}
elem.parentNode.removeChild( elem );
}
}
return this;
};
jQuery.prototype.removeAttr = function( name ) {
///
/// Remove an attribute from each element in the set of matched elements.
///
///
/// An attribute to remove; as of version 1.7, it can be a space-separated list of attributes.
///
///
return this.each(function() {
jQuery.removeAttr( this, name );
});
};
jQuery.prototype.removeClass = function( value ) {
///
/// Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
///
1 - removeClass(className)
///
2 - removeClass(function(index, class))
///
///
/// One or more space-separated classes to be removed from the class attribute of each matched element.
///
///
var classes, elem, cur, clazz, j,
i = 0,
len = this.length,
proceed = arguments.length === 0 || typeof value === "string" && value;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).removeClass( value.call( this, j, this.className ) );
});
}
if ( proceed ) {
classes = ( value || "" ).match( core_rnotwhite ) || [];
for ( ; i < len; i++ ) {
elem = this[ i ];
// This expression is here for better compressibility (see addClass)
cur = elem.nodeType === 1 && ( elem.className ?
( " " + elem.className + " " ).replace( rclass, " " ) :
""
);
if ( cur ) {
j = 0;
while ( (clazz = classes[j++]) ) {
// Remove *all* instances
while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
cur = cur.replace( " " + clazz + " ", " " );
}
}
elem.className = value ? jQuery.trim( cur ) : "";
}
}
}
return this;
};
jQuery.prototype.removeData = function( key ) {
///
/// Remove a previously-stored piece of data.
///
1 - removeData(name)
///
2 - removeData(list)
///
///
/// A string naming the piece of data to delete.
///
///
return this.each(function() {
jQuery.removeData( this, key );
});
};
jQuery.prototype.removeProp = function( name ) {
///
/// Remove a property for the set of matched elements.
///
///
/// The name of the property to set.
///
///
name = jQuery.propFix[ name ] || name;
return this.each(function() {
// try/catch handles cases where IE balks (such as removing a property on window)
try {
this[ name ] = undefined;
delete this[ name ];
} catch( e ) {}
});
};
jQuery.prototype.replaceAll = function( selector ) {
///
/// Replace each target element with the set of matched elements.
///
///
/// A selector expression indicating which element(s) to replace.
///
///
var elems,
i = 0,
ret = [],
insert = jQuery( selector ),
last = insert.length - 1;
for ( ; i <= last; i++ ) {
elems = i === last ? this : this.clone(true);
jQuery( insert[i] )[ original ]( elems );
// Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
core_push.apply( ret, elems.get() );
}
return this.pushStack( ret );
};
jQuery.prototype.replaceWith = function() {
///
/// Replace each element in the set of matched elements with the provided new content.
///
1 - replaceWith(newContent)
///
2 - replaceWith(function)
///
///
/// The content to insert. May be an HTML string, DOM element, or jQuery object.
///
///
var
// Snapshot the DOM in case .domManip sweeps something relevant into its fragment
args = jQuery.map( this, function( elem ) {
return [ elem.nextSibling, elem.parentNode ];
}),
i = 0;
// Make the changes, replacing each context element with the new content
this.domManip( arguments, function( elem ) {
var next = args[ i++ ],
parent = args[ i++ ];
if ( parent ) {
// Don't use the snapshot next if it has moved (#13810)
if ( next && next.parentNode !== parent ) {
next = this.nextSibling;
}
jQuery( this ).remove();
parent.insertBefore( elem, next );
}
// Allow new content to include elements from the context set
}, true );
// Force removal if there was no new content (e.g., from empty arguments)
return i ? this : this.remove();
};
jQuery.prototype.resize = function( data, fn ) {
///
/// Bind an event handler to the "resize" JavaScript event, or trigger that event on an element.
///
1 - resize(handler(eventObject))
///
2 - resize(eventData, handler(eventObject))
///
3 - resize()
///
///
/// A map of data that will be passed to the event handler.
///
///
/// A function to execute each time the event is triggered.
///
///
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
jQuery.prototype.scroll = function( data, fn ) {
///
/// Bind an event handler to the "scroll" JavaScript event, or trigger that event on an element.
///
1 - scroll(handler(eventObject))
///
2 - scroll(eventData, handler(eventObject))
///
3 - scroll()
///
///
/// A map of data that will be passed to the event handler.
///
///
/// A function to execute each time the event is triggered.
///
///
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
jQuery.prototype.scrollLeft = function( val ) {
///
/// 1: Get the current horizontal position of the scroll bar for the first element in the set of matched elements.
///
1.1 - scrollLeft()
///
2: Set the current horizontal position of the scroll bar for each of the set of matched elements.
///
2.1 - scrollLeft(value)
///
///
/// An integer indicating the new position to set the scroll bar to.
///
///
return jQuery.access( this, function( elem, method, val ) {
var win = getWindow( elem );
if ( val === undefined ) {
return win ? (prop in win) ? win[ prop ] :
win.document.documentElement[ method ] :
elem[ method ];
}
if ( win ) {
win.scrollTo(
!top ? val : jQuery( win ).scrollLeft(),
top ? val : jQuery( win ).scrollTop()
);
} else {
elem[ method ] = val;
}
}, method, val, arguments.length, null );
};
jQuery.prototype.scrollTop = function( val ) {
///
/// 1: Get the current vertical position of the scroll bar for the first element in the set of matched elements.
///
1.1 - scrollTop()
///
2: Set the current vertical position of the scroll bar for each of the set of matched elements.
///
2.1 - scrollTop(value)
///
///
/// An integer indicating the new position to set the scroll bar to.
///
///
return jQuery.access( this, function( elem, method, val ) {
var win = getWindow( elem );
if ( val === undefined ) {
return win ? (prop in win) ? win[ prop ] :
win.document.documentElement[ method ] :
elem[ method ];
}
if ( win ) {
win.scrollTo(
!top ? val : jQuery( win ).scrollLeft(),
top ? val : jQuery( win ).scrollTop()
);
} else {
elem[ method ] = val;
}
}, method, val, arguments.length, null );
};
jQuery.prototype.select = function( data, fn ) {
///
/// Bind an event handler to the "select" JavaScript event, or trigger that event on an element.
///
1 - select(handler(eventObject))
///
2 - select(eventData, handler(eventObject))
///
3 - select()
///
///
/// A map of data that will be passed to the event handler.
///
///
/// A function to execute each time the event is triggered.
///
///
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
jQuery.prototype.serialize = function() {
///
/// Encode a set of form elements as a string for submission.
///
///
return jQuery.param( this.serializeArray() );
};
jQuery.prototype.serializeArray = function() {
///
/// Encode a set of form elements as an array of names and values.
///
///
return this.map(function(){
// Can add propHook for "elements" to filter or add form elements
var elements = jQuery.prop( this, "elements" );
return elements ? jQuery.makeArray( elements ) : this;
})
.filter(function(){
var type = this.type;
// Use .is(":disabled") so that fieldset[disabled] works
return this.name && !jQuery( this ).is( ":disabled" ) &&
rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
( this.checked || !manipulation_rcheckableType.test( type ) );
})
.map(function( i, elem ){
var val = jQuery( this ).val();
return val == null ?
null :
jQuery.isArray( val ) ?
jQuery.map( val, function( val ){
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}) :
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}).get();
};
jQuery.prototype.show = function( speed, easing, callback ) {
///
/// Display the matched elements.
///
1 - show()
///
2 - show(duration, callback)
///
3 - show(duration, easing, callback)
///
///
/// A string or number determining how long the animation will run.
///
///
/// A string indicating which easing function to use for the transition.
///
///
/// A function to call once the animation is complete.
///
///
return speed == null || typeof speed === "boolean" ?
cssFn.apply( this, arguments ) :
this.animate( genFx( name, true ), speed, easing, callback );
};
jQuery.prototype.siblings = function( until, selector ) {
///
/// Get the siblings of each element in the set of matched elements, optionally filtered by a selector.
///
///
/// A string containing a selector expression to match elements against.
///
///
var ret = jQuery.map( this, fn, until );
if ( name.slice( -5 ) !== "Until" ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
if ( this.length > 1 ) {
// Remove duplicates
if ( !guaranteedUnique[ name ] ) {
ret = jQuery.unique( ret );
}
// Reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) {
ret = ret.reverse();
}
}
return this.pushStack( ret );
};
jQuery.prototype.size = function() {
///
/// Return the number of elements in the jQuery object.
///
///
return this.length;
};
jQuery.prototype.slice = function() {
///
/// Reduce the set of matched elements to a subset specified by a range of indices.
///
///
/// An integer indicating the 0-based position at which the elements begin to be selected. If negative, it indicates an offset from the end of the set.
///
///
/// An integer indicating the 0-based position at which the elements stop being selected. If negative, it indicates an offset from the end of the set. If omitted, the range continues until the end of the set.
///
///
return this.pushStack( core_slice.apply( this, arguments ) );
};
jQuery.prototype.slideDown = function( speed, easing, callback ) {
///
/// Display the matched elements with a sliding motion.
///
1 - slideDown(duration, callback)
///
2 - slideDown(duration, easing, callback)
///
///
/// A string or number determining how long the animation will run.
///
///
/// A string indicating which easing function to use for the transition.
///
///
/// A function to call once the animation is complete.
///
///
return this.animate( props, speed, easing, callback );
};
jQuery.prototype.slideToggle = function( speed, easing, callback ) {
///
/// Display or hide the matched elements with a sliding motion.
///
1 - slideToggle(duration, callback)
///
2 - slideToggle(duration, easing, callback)
///
///
/// A string or number determining how long the animation will run.
///
///
/// A string indicating which easing function to use for the transition.
///
///
/// A function to call once the animation is complete.
///
///
return this.animate( props, speed, easing, callback );
};
jQuery.prototype.slideUp = function( speed, easing, callback ) {
///
/// Hide the matched elements with a sliding motion.
///
1 - slideUp(duration, callback)
///
2 - slideUp(duration, easing, callback)
///
///
/// A string or number determining how long the animation will run.
///
///
/// A string indicating which easing function to use for the transition.
///
///
/// A function to call once the animation is complete.
///
///
return this.animate( props, speed, easing, callback );
};
jQuery.prototype.stop = function( type, clearQueue, gotoEnd ) {
///
/// Stop the currently-running animation on the matched elements.
///
1 - stop(clearQueue, jumpToEnd)
///
2 - stop(queue, clearQueue, jumpToEnd)
///
///
/// The name of the queue in which to stop animations.
///
///
/// A Boolean indicating whether to remove queued animation as well. Defaults to false.
///
///
/// A Boolean indicating whether to complete the current animation immediately. Defaults to false.
///
///
var stopQueue = function( hooks ) {
var stop = hooks.stop;
delete hooks.stop;
stop( gotoEnd );
};
if ( typeof type !== "string" ) {
gotoEnd = clearQueue;
clearQueue = type;
type = undefined;
}
if ( clearQueue && type !== false ) {
this.queue( type || "fx", [] );
}
return this.each(function() {
var dequeue = true,
index = type != null && type + "queueHooks",
timers = jQuery.timers,
data = jQuery._data( this );
if ( index ) {
if ( data[ index ] && data[ index ].stop ) {
stopQueue( data[ index ] );
}
} else {
for ( index in data ) {
if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
stopQueue( data[ index ] );
}
}
}
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
timers[ index ].anim.stop( gotoEnd );
dequeue = false;
timers.splice( index, 1 );
}
}
// start the next in the queue if the last step wasn't forced
// timers currently will call their complete callbacks, which will dequeue
// but only if they were gotoEnd
if ( dequeue || !gotoEnd ) {
jQuery.dequeue( this, type );
}
});
};
jQuery.prototype.submit = function( data, fn ) {
///
/// Bind an event handler to the "submit" JavaScript event, or trigger that event on an element.
///
1 - submit(handler(eventObject))
///
2 - submit(eventData, handler(eventObject))
///
3 - submit()
///
///
/// A map of data that will be passed to the event handler.
///
///
/// A function to execute each time the event is triggered.
///
///
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
jQuery.prototype.text = function( value ) {
///
/// 1: Get the combined text contents of each element in the set of matched elements, including their descendants.
///
1.1 - text()
///
2: Set the content of each element in the set of matched elements to the specified text.
///
2.1 - text(textString)
///
2.2 - text(function(index, text))
///
///
/// A string of text to set as the content of each matched element.
///
///
return jQuery.access( this, function( value ) {
return value === undefined ?
jQuery.text( this ) :
this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
}, null, value, arguments.length );
};
jQuery.prototype.toArray = function() {
///
/// Retrieve all the DOM elements contained in the jQuery set, as an array.
///
///
return core_slice.call( this );
};
jQuery.prototype.toggle = function( speed, easing, callback ) {
///
/// 1: Bind two or more handlers to the matched elements, to be executed on alternate clicks.
///
1.1 - toggle(handler(eventObject), handler(eventObject), handler(eventObject))
///
2: Display or hide the matched elements.
///
2.1 - toggle(duration, callback)
///
2.2 - toggle(duration, easing, callback)
///
2.3 - toggle(showOrHide)
///
///
/// A function to execute every even time the element is clicked.
///
///
/// A function to execute every odd time the element is clicked.
///
///
/// Additional handlers to cycle through after clicks.
///
///
return speed == null || typeof speed === "boolean" ?
cssFn.apply( this, arguments ) :
this.animate( genFx( name, true ), speed, easing, callback );
};
jQuery.prototype.toggleClass = function( value, stateVal ) {
///
/// Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
///
1 - toggleClass(className)
///
2 - toggleClass(className, switch)
///
3 - toggleClass(switch)
///
4 - toggleClass(function(index, class, switch), switch)
///
///
/// One or more class names (separated by spaces) to be toggled for each element in the matched set.
///
///
/// A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed.
///
///
var type = typeof value,
isBool = typeof stateVal === "boolean";
if ( jQuery.isFunction( value ) ) {
return this.each(function( i ) {
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
});
}
return this.each(function() {
if ( type === "string" ) {
// toggle individual class names
var className,
i = 0,
self = jQuery( this ),
state = stateVal,
classNames = value.match( core_rnotwhite ) || [];
while ( (className = classNames[ i++ ]) ) {
// check each className given, space separated list
state = isBool ? state : !self.hasClass( className );
self[ state ? "addClass" : "removeClass" ]( className );
}
// Toggle whole class name
} else if ( type === core_strundefined || type === "boolean" ) {
if ( this.className ) {
// store className if set
jQuery._data( this, "__className__", this.className );
}
// If the element has a class name or if we're passed "false",
// then remove the whole classname (if there was one, the above saved it).
// Otherwise bring back whatever was previously saved (if anything),
// falling back to the empty string if nothing was stored.
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
}
});
};
jQuery.prototype.trigger = function( type, data ) {
///
/// Execute all handlers and behaviors attached to the matched elements for the given event type.
///
1 - trigger(eventType, extraParameters)
///
2 - trigger(event)
///
///
/// A string containing a JavaScript event type, such as click or submit.
///
///
/// Additional parameters to pass along to the event handler.
///
///
return this.each(function() {
jQuery.event.trigger( type, data, this );
});
};
jQuery.prototype.triggerHandler = function( type, data ) {
///
/// Execute all handlers attached to an element for an event.
///
///
/// A string containing a JavaScript event type, such as click or submit.
///
///
/// An array of additional parameters to pass along to the event handler.
///
///
var elem = this[0];
if ( elem ) {
return jQuery.event.trigger( type, data, elem, true );
}
};
jQuery.prototype.unbind = function( types, fn ) {
///
/// Remove a previously-attached event handler from the elements.
///
1 - unbind(eventType, handler(eventObject))
///
2 - unbind(eventType, false)
///
3 - unbind(event)
///
///
/// A string containing a JavaScript event type, such as click or submit.
///
///
/// The function that is to be no longer executed.
///
///
return this.off( types, null, fn );
};
jQuery.prototype.undelegate = function( selector, types, fn ) {
///
/// Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.
///
1 - undelegate()
///
2 - undelegate(selector, eventType)
///
3 - undelegate(selector, eventType, handler(eventObject))
///
4 - undelegate(selector, events)
///
5 - undelegate(namespace)
///
///
/// A selector which will be used to filter the event results.
///
///
/// A string containing a JavaScript event type, such as "click" or "keydown"
///
///
/// A function to execute at the time the event is triggered.
///
///
// ( namespace ) or ( selector, types [, fn] )
return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
};
jQuery.prototype.unload = function( data, fn ) {
///
/// Bind an event handler to the "unload" JavaScript event.
///
1 - unload(handler(eventObject))
///
2 - unload(eventData, handler(eventObject))
///
///
/// A map of data that will be passed to the event handler.
///
///
/// A function to execute each time the event is triggered.
///
///
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
jQuery.prototype.unwrap = function() {
///
/// Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.
///
///
return this.parent().each(function() {
if ( !jQuery.nodeName( this, "body" ) ) {
jQuery( this ).replaceWith( this.childNodes );
}
}).end();
};
jQuery.prototype.val = function( value ) {
///
/// 1: Get the current value of the first element in the set of matched elements.
///
1.1 - val()
///
2: Set the value of each element in the set of matched elements.
///
2.1 - val(value)
///
2.2 - val(function(index, value))
///
///
/// A string of text or an array of strings corresponding to the value of each matched element to set as selected/checked.
///
///
var ret, hooks, isFunction,
elem = this[0];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
return ret;
}
ret = elem.value;
return typeof ret === "string" ?
// handle most common string cases
ret.replace(rreturn, "") :
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
return;
}
isFunction = jQuery.isFunction( value );
return this.each(function( i ) {
var val;
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, jQuery( this ).val() );
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray( val ) ) {
val = jQuery.map(val, function ( value ) {
return value == null ? "" : value + "";
});
}
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
// If set returns undefined, fall back to normal setting
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
this.value = val;
}
});
};
jQuery.prototype.width = function( margin, value ) {
///
/// 1: Get the current computed width for the first element in the set of matched elements.
///
1.1 - width()
///
2: Set the CSS width of each element in the set of matched elements.
///
2.1 - width(value)
///
2.2 - width(function(index, width))
///
///
/// An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
///
///
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
return jQuery.access( this, function( elem, type, value ) {
var doc;
if ( jQuery.isWindow( elem ) ) {
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
// isn't a whole lot we can do. See pull request at this URL for discussion:
// https://github.com/jquery/jquery/pull/764
return elem.document.documentElement[ "client" + name ];
}
// Get document width or height
if ( elem.nodeType === 9 ) {
doc = elem.documentElement;
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
// unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
return Math.max(
elem.body[ "scroll" + name ], doc[ "scroll" + name ],
elem.body[ "offset" + name ], doc[ "offset" + name ],
doc[ "client" + name ]
);
}
return value === undefined ?
// Get width or height on the element, requesting but not forcing parseFloat
jQuery.css( elem, type, extra ) :
// Set width or height on the element
jQuery.style( elem, type, value, extra );
}, type, chainable ? margin : undefined, chainable, null );
};
jQuery.prototype.wrap = function( html ) {
///
/// Wrap an HTML structure around each element in the set of matched elements.
///
1 - wrap(wrappingElement)
///
2 - wrap(function(index))
///
///
/// An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the matched elements.
///
///
var isFunction = jQuery.isFunction( html );
return this.each(function(i) {
jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
});
};
jQuery.prototype.wrapAll = function( html ) {
///
/// Wrap an HTML structure around all elements in the set of matched elements.
///
///
/// An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the matched elements.
///
///
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapAll( html.call(this, i) );
});
}
if ( this[0] ) {
// The elements to wrap the target around
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
if ( this[0].parentNode ) {
wrap.insertBefore( this[0] );
}
wrap.map(function() {
var elem = this;
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
elem = elem.firstChild;
}
return elem;
}).append( this );
}
return this;
};
jQuery.prototype.wrapInner = function( html ) {
///
/// Wrap an HTML structure around the content of each element in the set of matched elements.
///
1 - wrapInner(wrappingElement)
///
2 - wrapInner(function(index))
///
///
/// An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the content of the matched elements.
///
///
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapInner( html.call(this, i) );
});
}
return this.each(function() {
var self = jQuery( this ),
contents = self.contents();
if ( contents.length ) {
contents.wrapAll( html );
} else {
self.append( html );
}
});
};
jQuery.fn = jQuery.prototype;
jQuery.fn.init.prototype = jQuery.fn;
window.jQuery = window.$ = jQuery;
})(window);