")
// inject the contents of the document in, removing the scripts
// to avoid any 'Permission Denied' errors in IE
.append(responseText.replace(rscript, ""))
// Locate the specified elements
.find(selector) :
// If not, just inject the full result
responseText);
});
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.
///
///
if (fn == null) {
fn = data;
data = null;
}
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.
///
///
if (fn == null) {
fn = data;
data = null;
}
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.
///
///
if (fn == null) {
fn = data;
data = null;
}
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.
///
///
if (fn == null) {
fn = data;
data = null;
}
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.
///
///
if (fn == null) {
fn = data;
data = null;
}
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.
///
///
if (fn == null) {
fn = data;
data = null;
}
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.
///
///
if (fn == null) {
fn = data;
data = null;
}
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 (!runtil.test(name)) {
selector = until;
}
if (selector && typeof selector === "string") {
ret = jQuery.filter(selector, ret);
}
ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret;
if (this.length > 1 && rparentsprev.test(name)) {
ret = ret.reverse();
}
return this.pushStack(ret, name, core_slice.call(arguments).join(","));
};
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 (!runtil.test(name)) {
selector = until;
}
if (selector && typeof selector === "string") {
ret = jQuery.filter(selector, ret);
}
ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret;
if (this.length > 1 && rparentsprev.test(name)) {
ret = ret.reverse();
}
return this.pushStack(ret, name, core_slice.call(arguments).join(","));
};
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 (!runtil.test(name)) {
selector = until;
}
if (selector && typeof selector === "string") {
ret = jQuery.filter(selector, ret);
}
ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret;
if (this.length > 1 && rparentsprev.test(name)) {
ret = ret.reverse();
}
return this.pushStack(ret, name, core_slice.call(arguments).join(","));
};
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, false), "not", selector);
};
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 box, docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft, top, left,
elem = this[0],
doc = elem && elem.ownerDocument;
if (!doc) {
return;
}
if ((body = doc.body) === elem) {
return jQuery.offset.bodyOffset(elem);
}
docElem = doc.documentElement;
// Make sure we're not dealing with a disconnected DOM node
if (!jQuery.contains(docElem, elem)) {
return { top: 0, left: 0 };
}
box = elem.getBoundingClientRect();
win = getWindow(doc);
clientTop = docElem.clientTop || body.clientTop || 0;
clientLeft = docElem.clientLeft || body.clientLeft || 0;
scrollTop = win.pageYOffset || docElem.scrollTop;
scrollLeft = win.pageXOffset || docElem.scrollLeft;
top = box.top + scrollTop - clientTop;
left = box.left + scrollLeft - clientLeft;
return { top: top, left: left };
};
jQuery.prototype.offsetParent = function () {
///
/// Get the closest ancestor element that is positioned.
///
///
return this.map(function () {
var offsetParent = this.offsetParent || document.body;
while (offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static")) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent || document.body;
});
};
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 origFn, type;
// Types can be a map of types/handlers
if (typeof types === "object") {
// ( types-Object, selector, data )
if (typeof selector !== "string") { // && selector != null
// ( 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, value, 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, value, 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 (!runtil.test(name)) {
selector = until;
}
if (selector && typeof selector === "string") {
ret = jQuery.filter(selector, ret);
}
ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret;
if (this.length > 1 && rparentsprev.test(name)) {
ret = ret.reverse();
}
return this.pushStack(ret, name, core_slice.call(arguments).join(","));
};
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 (!runtil.test(name)) {
selector = until;
}
if (selector && typeof selector === "string") {
ret = jQuery.filter(selector, ret);
}
ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret;
if (this.length > 1 && rparentsprev.test(name)) {
ret = ret.reverse();
}
return this.pushStack(ret, name, core_slice.call(arguments).join(","));
};
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 (!runtil.test(name)) {
selector = until;
}
if (selector && typeof selector === "string") {
ret = jQuery.filter(selector, ret);
}
ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret;
if (this.length > 1 && rparentsprev.test(name)) {
ret = ret.reverse();
}
return this.pushStack(ret, name, core_slice.call(arguments).join(","));
};
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 elem = this[0],
// Get *real* offsetParent
offsetParent = this.offsetParent(),
// Get correct offsets
offset = this.offset(),
parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
// Subtract 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
offset.top -= parseFloat(jQuery.css(elem, "marginTop")) || 0;
offset.left -= parseFloat(jQuery.css(elem, "marginLeft")) || 0;
// Add offsetParent borders
parentOffset.top += parseFloat(jQuery.css(offsetParent[0], "borderTopWidth")) || 0;
parentOffset.left += parseFloat(jQuery.css(offsetParent[0], "borderLeftWidth")) || 0;
// Subtract the two offsets
return {
top: offset.top - parentOffset.top,
left: offset.left - parentOffset.left
};
};
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, true, function (elem) {
if (this.nodeType === 1 || this.nodeType === 11) {
this.insertBefore(elem, this.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),
l = insert.length,
parent = this.length === 1 && this[0].parentNode;
if ((parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1) {
insert[original](this[0]);
return this;
} else {
for (; i < l; i++) {
elems = (i > 0 ? this.clone(true) : this).get();
jQuery(insert[i])[original](elems);
ret = ret.concat(elems);
}
return this.pushStack(ret, name, insert.selector);
}
};
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 (!runtil.test(name)) {
selector = until;
}
if (selector && typeof selector === "string") {
ret = jQuery.filter(selector, ret);
}
ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret;
if (this.length > 1 && rparentsprev.test(name)) {
ret = ret.reverse();
}
return this.pushStack(ret, name, core_slice.call(arguments).join(","));
};
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 (!runtil.test(name)) {
selector = until;
}
if (selector && typeof selector === "string") {
ret = jQuery.filter(selector, ret);
}
ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret;
if (this.length > 1 && rparentsprev.test(name)) {
ret = ret.reverse();
}
return this.pushStack(ret, name, core_slice.call(arguments).join(","));
};
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 (!runtil.test(name)) {
selector = until;
}
if (selector && typeof selector === "string") {
ret = jQuery.filter(selector, ret);
}
ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret;
if (this.length > 1 && rparentsprev.test(name)) {
ret = ret.reverse();
}
return this.pushStack(ret, name, core_slice.call(arguments).join(","));
};
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, name, selector) {
///
/// 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;
if (name === "find") {
ret.selector = this.selector + (this.selector ? " " : "") + selector;
} else if (name) {
ret.selector = this.selector + "." + name + "(" + selector + ")";
}
// Return the newly-formed element set
return ret;
};
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,
i = 0;
for (; (elem = this[i]) != null; i++) {
if (!selector || jQuery.filter(selector, [elem]).length) {
if (!keepData && elem.nodeType === 1) {
jQuery.cleanData(elem.getElementsByTagName("*"));
jQuery.cleanData([elem]);
}
if (elem.parentNode) {
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 removes, className, elem, c, cl, i, l;
if (jQuery.isFunction(value)) {
return this.each(function (j) {
jQuery(this).removeClass(value.call(this, j, this.className));
});
}
if ((value && typeof value === "string") || value === undefined) {
removes = (value || "").split(core_rspace);
for (i = 0, l = this.length; i < l; i++) {
elem = this[i];
if (elem.nodeType === 1 && elem.className) {
className = (" " + elem.className + " ").replace(rclass, " ");
// loop over each item in the removal list
for (c = 0, cl = removes.length; c < cl; c++) {
// Remove until there is nothing to remove,
while (className.indexOf(" " + removes[c] + " ") > -1) {
className = className.replace(" " + removes[c] + " ", " ");
}
}
elem.className = value ? jQuery.trim(className) : "";
}
}
}
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),
l = insert.length,
parent = this.length === 1 && this[0].parentNode;
if ((parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1) {
insert[original](this[0]);
return this;
} else {
for (; i < l; i++) {
elems = (i > 0 ? this.clone(true) : this).get();
jQuery(insert[i])[original](elems);
ret = ret.concat(elems);
}
return this.pushStack(ret, name, insert.selector);
}
};
jQuery.prototype.replaceWith = function (value) {
///
/// 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.
///
///
if (!isDisconnected(this[0])) {
// Make sure that the elements are removed from the DOM before they are inserted
// this can help fix replacing a parent with child elements
if (jQuery.isFunction(value)) {
return this.each(function (i) {
var self = jQuery(this), old = self.html();
self.replaceWith(value.call(this, i, old));
});
}
if (typeof value !== "string") {
value = jQuery(value).detach();
}
return this.each(function () {
var next = this.nextSibling,
parent = this.parentNode;
jQuery(this).remove();
if (next) {
jQuery(next).before(value);
} else {
jQuery(parent).append(value);
}
});
}
return this.length ?
this.pushStack(jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value) :
this;
};
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.
///
///
if (fn == null) {
fn = data;
data = null;
}
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.
///
///
if (fn == null) {
fn = data;
data = null;
}
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.
///
///
if (fn == null) {
fn = data;
data = null;
}
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 () {
return this.elements ? jQuery.makeArray(this.elements) : this;
})
.filter(function () {
return this.name && !this.disabled &&
(this.checked || rselectTextarea.test(this.nodeName) ||
rinput.test(this.type));
})
.map(function (i, elem) {
var val = jQuery(this).val();
return val == null ?
null :
jQuery.isArray(val) ?
jQuery.map(val, function (val, i) {
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" ||
// special check for .toggle( handler, handler, ... )
(!i && jQuery.isFunction(speed) && jQuery.isFunction(easing)) ?
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 (!runtil.test(name)) {
selector = until;
}
if (selector && typeof selector === "string") {
ret = jQuery.filter(selector, ret);
}
ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret;
if (this.length > 1 && rparentsprev.test(name)) {
ret = ret.reverse();
}
return this.pushStack(ret, name, core_slice.call(arguments).join(","));
};
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),
"slice", core_slice.call(arguments).join(","));
};
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.
///
///
if (fn == null) {
fn = data;
data = null;
}
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" ||
// special check for .toggle( handler, handler, ... )
(!i && jQuery.isFunction(speed) && jQuery.isFunction(easing)) ?
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.split(core_rspace);
while ((className = classNames[i++])) {
// check each className given, space separated list
state = isBool ? state : !self.hasClass(className);
self[state ? "addClass" : "removeClass"](className);
}
} else if (type === "undefined" || type === "boolean") {
if (this.className) {
// store className if set
jQuery._data(this, "__className__", this.className);
}
// toggle whole className
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.
///
///
if (this[0]) {
return jQuery.event.trigger(type, data, this[0], 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.
///
///
if (fn == null) {
fn = data;
data = null;
}
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 hooks, ret, isFunction,
elem = this[0];
if (!arguments.length) {
if (elem) {
hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
return ret;
}
ret = elem.value;
return typeof ret === "string" ?
// handle most common string cases
ret.replace(rreturn, "") :
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
return;
}
isFunction = jQuery.isFunction(value);
return this.each(function (i) {
var val,
self = jQuery(this);
if (this.nodeType !== 1) {
return;
}
if (isFunction) {
val = value.call(this, i, self.val());
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if (val == null) {
val = "";
} else if (typeof val === "number") {
val += "";
} else if (jQuery.isArray(val)) {
val = jQuery.map(val, function (value) {
return value == null ? "" : value + "";
});
}
hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
// If set returns undefined, fall back to normal setting
if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
this.value = val;
}
});
};
jQuery.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, value, 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);