// Call all the callbacks with the given arguments
fire: function () {
self.fireWith(this, arguments);
return this;
},
// To know if the callbacks have already been called at least once
fired: function () {
return !!fired;
}
};
return self;
};
jQuery.Deferred = function (func) {
/// <summary>
/// A constructor function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function.
/// </summary>
/// <param name="func" type="Function">
/// A function that is called just before the constructor returns.
/// </param>
/// <returns type="Deferred" />
var tuples = [
// action, add listener, listener list, final state
jQuery.access(elems, fn, i, key[i], true, emptyGet, raw);
}
// Sets one value
} else if (value !== undefined) {
chainable = true;
if (!jQuery.isFunction(value)) {
raw = true;
}
if (bulk) {
// Bulk operations run against the entire set
if (raw) {
fn.call(elems, value);
fn = null;
// ...except when executing function values
} else {
bulk = fn;
fn = function (elem, key, value) {
return bulk.call(jQuery(elem), value);
};
}
}
if (fn) {
for (; i < length; i++) {
fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)));
}
}
}
return chainable ?
elems :
// Gets
bulk ?
fn.call(elems) :
length ? fn(elems[0], key) : emptyGet;
};
jQuery.active = 0;
jQuery.ajax = function (url, options) {
/// <summary>
/// Perform an asynchronous HTTP (Ajax) request.
///
1 - jQuery.ajax(url, settings)
///
2 - jQuery.ajax(settings)
/// </summary>
/// <param name="url" type="String">
/// A string containing the URL to which the request is sent.
/// </param>
/// <param name="options" type="PlainObject">
/// A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup(). See jQuery.ajax( settings ) below for a complete list of all settings.
/// </param>
// If url is an object, simulate pre-1.5 signature
if (typeof url === "object") {
options = url;
url = undefined;
}
// Force options to be an object
options = options || {};
var // Cross-domain detection vars
parts,
// Loop variable
i,
// URL without anti-cache param
cacheURL,
// Response headers as string
responseHeadersString,
// timeout handle
timeoutTimer,
// To know if global events are to be dispatched
fireGlobals,
transport,
// Response headers
responseHeaders,
// Create the final options object
s = jQuery.ajaxSetup({}, options),
// Callbacks context
callbackContext = s.context || s,
// Context for global events is callbackContext if it is a DOM node or jQuery collection
/// A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.
/// </summary>
/// <param name="obj" type="Object">
/// The object or array to iterate over.
/// </param>
/// <param name="callback" type="Function">
/// The function that will be executed on every object.
/// </param>
/// <returns type="Object" />
var value,
i = 0,
length = obj.length,
isArray = isArraylike(obj);
if (args) {
if (isArray) {
for (; i < length; i++) {
value = callback.apply(obj[i], args);
if (value === false) {
break;
}
}
} else {
for (i in obj) {
value = callback.apply(obj[i], args);
if (value === false) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if (isArray) {
for (; i < length; i++) {
value = callback.call(obj[i], i, obj[i]);
if (value === false) {
break;
}
}
} else {
for (i in obj) {
value = callback.call(obj[i], i, obj[i]);
if (value === false) {
break;
}
}
}
}
return obj;
};
jQuery.easing = {};
jQuery.error = function (msg) {
/// <summary>
/// Takes a string and throws an exception containing it.
// We use an anonymous function so that context is window
// rather than jQuery in Firefox
(window.execScript || function (data) {
window["eval"].call(window, data);
})(data);
}
};
jQuery.grep = function (elems, callback, inv) {
/// <summary>
/// Finds the elements of an array which satisfy a filter function. The original array is not affected.
/// </summary>
/// <param name="elems" type="Array">
/// The array to search through.
/// </param>
/// <param name="callback" type="Function">
/// The function to process each item against. The first argument to the function is the item, and the second argument is the index. The function should return a Boolean value. this will be the global window object.
/// </param>
/// <param name="inv" type="Boolean">
/// If "invert" is false, or not provided, then the function returns an array consisting of all elements for which "callback" returns true. If "invert" is true, then the function returns an array consisting of all elements for which "callback" returns false.
/// </param>
/// <returns type="Array" />
var retVal,
ret = [],
i = 0,
length = elems.length;
inv = !!inv;
// Go through the array, only saving the items
// that pass the validator function
for (; i < length; i++) {
retVal = !!callback(elems[i], i);
if (inv !== retVal) {
ret.push(elems[i]);
}
}
return ret;
};
jQuery.guid = 1;
jQuery.hasData = function (elem) {
/// <summary>
/// Determine whether an element has any jQuery data associated with it.
/// The function to process each item against. The first argument to the function is the array item, the second argument is the index in array The function can return any value. Within the function, this refers to the global (window) object.
/// </param>
/// <returns type="Array" />
var value,
i = 0,
length = elems.length,
isArray = isArraylike(elems),
ret = [];
// Go through the array, translating each of the items to their
if (isArray) {
for (; i < length; i++) {
value = callback(elems[i], i, arg);
if (value != null) {
ret[ret.length] = value;
}
}
// Go through every key on the object,
} else {
for (i in elems) {
value = callback(elems[i], i, arg);
if (value != null) {
ret[ret.length] = value;
}
}
}
// Flatten any nested arrays
return core_concat.apply([], ret);
};
jQuery.merge = function (first, second) {
/// <summary>
/// Merge the contents of two arrays together into the first array.
/// </summary>
/// <param name="first" type="Array">
/// The first array to merge, the elements of second added.
/// </param>
/// <param name="second" type="Array">
/// The second array to merge into the first, unaltered.
/// </param>
/// <returns type="Array" />
var l = second.length,
i = first.length,
j = 0;
if (typeof l === "number") {
for (; j < l; j++) {
first[i++] = second[j];
}
} else {
while (second[j] !== undefined) {
first[i++] = second[j++];
}
}
first.length = i;
return first;
};
jQuery.noConflict = function (deep) {
/// <summary>
/// Relinquish jQuery's control of the $ variable.
/// </summary>
/// <param name="deep" type="Boolean">
/// A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself).
/// Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.
/// </summary>
/// <param name="results" type="Array">
/// The Array of DOM elements.
/// </param>
/// <returns type="Array" />
var elem,
duplicates = [],
i = 1,
j = 0;
// Unless we *know* we can detect duplicates, assume their presence
hasDuplicate = !support.detectDuplicates;
results.sort(sortOrder);
if (hasDuplicate) {
for (; (elem = results[i]) ; i++) {
if (elem === results[i - 1]) {
j = duplicates.push(i);
}
}
while (j--) {
results.splice(duplicates[j], 1);
}
}
return results;
};
jQuery.valHooks = {
"option": {},
"select": {},
"radio": {},
"checkbox": {}
};
jQuery.when = function (subordinate /* , ..., subordinateN */) {
/// <summary>
/// Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.
/// </summary>
/// <param name="subordinate/*" type="Deferred">
/// One or more Deferred objects, or plain JavaScript objects.
/// Insert content, specified by the parameter, after each element in the set of matched elements.
///
1 - after(content, content)
///
2 - after(function(index))
/// </summary>
/// <param name="" type="jQuery">
/// HTML string, DOM element, or jQuery object to insert after each element in the set of matched elements.
/// </param>
/// <param name="" type="jQuery">
/// One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements.
/// </param>
/// <returns type="jQuery" />
return this.domManip(arguments, false, function (elem) {
/// An object of CSS properties and values that the animation will move toward.
/// </param>
/// <param name="speed" type="">
/// A string or number determining how long the animation will run.
/// </param>
/// <param name="easing" type="String">
/// A string indicating which easing function to use for the transition.
/// </param>
/// <param name="callback" type="Function">
/// A function to call once the animation is complete.
/// </param>
/// <returns type="jQuery" />
var empty = jQuery.isEmptyObject(prop),
optall = jQuery.speed(speed, easing, callback),
doAnimation = function () {
// Operate on a copy of prop so per-property easing won't be lost
var anim = Animation(this, jQuery.extend({}, prop), optall);
doAnimation.finish = function () {
anim.stop(true);
};
// Empty animations, or finishing resolves immediately
if (empty || jQuery._data(this, "finish")) {
anim.stop(true);
}
};
doAnimation.finish = doAnimation;
return empty || optall.queue === false ?
this.each(doAnimation) :
this.queue(optall.queue, doAnimation);
};
jQuery.prototype.append = function () {
/// <summary>
/// Insert content, specified by the parameter, to the end of each element in the set of matched elements.
///
1 - append(content, content)
///
2 - append(function(index, html))
/// </summary>
/// <param name="" type="jQuery">
/// DOM element, HTML string, or jQuery object to insert at the end of each element in the set of matched elements.
/// </param>
/// <param name="" type="jQuery">
/// One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements.
/// </param>
/// <returns type="jQuery" />
return this.domManip(arguments, true, function (elem) {
/// Insert every element in the set of matched elements to the end of the target.
/// </summary>
/// <param name="selector" type="jQuery">
/// A selector, element, HTML string, or jQuery object; the matched set of elements will be inserted at the end of the element(s) specified by this parameter.
/// </param>
/// <returns type="jQuery" />
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.attr = function (name, value) {
/// <summary>
/// 1: Get the value of an attribute for the first element in the set of matched elements.
///
1.1 - attr(attributeName)
///
2: Set one or more attributes for the set of matched elements.
/// Insert content, specified by the parameter, before each element in the set of matched elements.
///
1 - before(content, content)
///
2 - before(function)
/// </summary>
/// <param name="" type="jQuery">
/// HTML string, DOM element, or jQuery object to insert before each element in the set of matched elements.
/// </param>
/// <param name="" type="jQuery">
/// One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements.
/// </param>
/// <returns type="jQuery" />
return this.domManip(arguments, false, function (elem) {
if (this.parentNode) {
this.parentNode.insertBefore(elem, this);
}
});
};
jQuery.prototype.bind = function (types, data, fn) {
/// <summary>
/// Attach a handler to an event for the elements.
/// A Boolean indicating whether event handlers and data should be copied along with the elements. The default value is false. *In jQuery 1.5.0 the default value was incorrectly true; it was changed back to false in 1.5.1 and up.
/// A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. By default its value matches the first argument's value (which defaults to false).
jQuery.prototype.closest = function (selectors, context) {
/// <summary>
/// 1: For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
///
1.1 - closest(selector)
///
1.2 - closest(selector, context)
///
1.3 - closest(jQuery object)
///
1.4 - closest(element)
///
2: Get an array of all the elements and selectors matched against the current element up through the DOM tree.
///
2.1 - closest(selectors, context)
/// </summary>
/// <param name="selectors" type="String">
/// A string containing a selector expression to match elements against.
/// </param>
/// <param name="context" domElement="true">
/// A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead.
/// 1: Store arbitrary data associated with the matched elements.
///
1.1 - data(key, value)
///
1.2 - data(obj)
///
2: Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute.
///
2.1 - data(key)
///
2.2 - data()
/// </summary>
/// <param name="key" type="String">
/// A string naming the piece of data to set.
/// </param>
/// <param name="value" type="Object">
/// The new data value; it can be any Javascript type including Array or Object.
/// </param>
/// <returns type="jQuery" />
var attrs, name,
elem = this[0],
i = 0,
data = null;
// Gets all values
if (key === undefined) {
if (this.length) {
data = jQuery.data(elem);
if (elem.nodeType === 1 && !jQuery._data(elem, "parsedAttrs")) {
jQuery.prototype.insertAfter = function (selector) {
/// <summary>
/// Insert every element in the set of matched elements after the target.
/// </summary>
/// <param name="selector" type="jQuery">
/// A selector, element, HTML string, or jQuery object; the matched set of elements will be inserted after the element(s) specified by this parameter.
/// </param>
/// <returns type="jQuery" />
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.insertBefore = function (selector) {
/// <summary>
/// Insert every element in the set of matched elements before the target.
/// </summary>
/// <param name="selector" type="jQuery">
/// A selector, element, HTML string, or jQuery object; the matched set of elements will be inserted before the element(s) specified by this parameter.
/// </param>
/// <returns type="jQuery" />
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.is = function (selector) {
/// <summary>
/// Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.
///
1 - is(selector)
///
2 - is(function(index))
///
3 - is(jQuery object)
///
4 - is(element)
/// </summary>
/// <param name="selector" type="String">
/// A string containing a selector expression to match elements against.
/// </param>
/// <returns type="Boolean" />
return !!selector && (
typeof selector === "string" ?
// If this is a positional/relative selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
/// An object containing data that will be passed to the event handler.
/// </param>
/// <param name="fn" type="Function">
/// A function to execute each time the event is triggered.
/// </param>
/// <returns type="jQuery" />
return arguments.length > 0 ?
this.on(name, null, data, fn) :
this.trigger(name);
};
jQuery.prototype.mouseup = function (data, fn) {
/// <summary>
/// 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()
/// </summary>
/// <param name="data" type="PlainObject">
/// An object containing data that will be passed to the event handler.
/// </param>
/// <param name="fn" type="Function">
/// A function to execute each time the event is triggered.
/// </param>
/// <returns type="jQuery" />
return arguments.length > 0 ?
this.on(name, null, data, fn) :
this.trigger(name);
};
jQuery.prototype.next = function (until, selector) {
/// <summary>
/// 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.
/// </summary>
/// <param name="until" type="String">
/// A string containing a selector expression to match elements against.
/// One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
/// </param>
/// <param name="selector" type="String">
/// 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.
/// </param>
/// <param name="data" type="Anything">
/// Data to be passed to the handler in event.data when an event is triggered.
/// </param>
/// <param name="fn" type="Function">
/// 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.
/// </param>
/// <returns type="jQuery" />
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
/// One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
/// </param>
/// <param name="selector" type="String">
/// 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.
/// </param>
/// <param name="data" type="Anything">
/// Data to be passed to the handler in event.data when an event is triggered.
/// </param>
/// <param name="fn" type="Function">
/// 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.
/// </param>
/// <returns type="jQuery" />
return this.on(types, selector, data, fn, 1);
};
jQuery.prototype.outerHeight = function (margin, value) {
/// <summary>
/// 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.
/// </summary>
/// <param name="margin" type="Boolean">
/// A Boolean indicating whether to include the element's margin in the calculation.
jQuery.prototype.parentsUntil = function (until, selector) {
/// <summary>
/// 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)
/// </summary>
/// <param name="until" type="String">
/// A string containing a selector expression to indicate where to stop matching ancestor elements.
/// </param>
/// <param name="selector" type="String">
/// A string containing a selector expression to match elements against.
/// 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))
/// </summary>
/// <param name="" type="jQuery">
/// DOM element, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements.
/// </param>
/// <param name="" type="jQuery">
/// 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.
/// </param>
/// <returns type="jQuery" />
return this.domManip(arguments, true, function (elem) {
jQuery.prototype.prependTo = function (selector) {
/// <summary>
/// Insert every element in the set of matched elements to the beginning of the target.
/// </summary>
/// <param name="selector" type="jQuery">
/// 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.
/// </param>
/// <returns type="jQuery" />
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) {
/// <summary>
/// Get the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector.
/// </summary>
/// <param name="until" type="String">
/// A string containing a selector expression to match elements against.
/// Remove a property for the set of matched elements.
/// </summary>
/// <param name="name" type="String">
/// The name of the property to remove.
/// </param>
/// <returns type="jQuery" />
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) {
/// <summary>
/// Replace each target element with the set of matched elements.
/// </summary>
/// <param name="selector" type="String">
/// A selector expression indicating which element(s) to replace.
/// </param>
/// <returns type="jQuery" />
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 (value) {
/// <summary>
/// Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed.
///
1 - replaceWith(newContent)
///
2 - replaceWith(function)
/// </summary>
/// <param name="value" type="jQuery">
/// The content to insert. May be an HTML string, DOM element, or jQuery object.
/// </param>
/// <returns type="jQuery" />
var isFunc = jQuery.isFunction(value);
// Make sure that the elements are removed from the DOM before they are inserted
// this can help fix replacing a parent with child elements
if (!isFunc && typeof value !== "string") {
value = jQuery(value).not(this).detach();
}
return this.domManip([value], true, function (elem) {
var next = this.nextSibling,
parent = this.parentNode;
if (parent) {
jQuery(this).remove();
parent.insertBefore(elem, next);
}
});
};
jQuery.prototype.resize = function (data, fn) {
/// <summary>
/// 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()
/// </summary>
/// <param name="data" type="PlainObject">
/// An object containing data that will be passed to the event handler.
/// </param>
/// <param name="fn" type="Function">
/// A function to execute each time the event is triggered.
/// </param>
/// <returns type="jQuery" />
return arguments.length > 0 ?
this.on(name, null, data, fn) :
this.trigger(name);
};
jQuery.prototype.scroll = function (data, fn) {
/// <summary>
/// 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()
/// </summary>
/// <param name="data" type="PlainObject">
/// An object containing data that will be passed to the event handler.
/// </param>
/// <param name="fn" type="Function">
/// A function to execute each time the event is triggered.
/// </param>
/// <returns type="jQuery" />
return arguments.length > 0 ?
this.on(name, null, data, fn) :
this.trigger(name);
};
jQuery.prototype.scrollLeft = function (val) {
/// <summary>
/// 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)
/// </summary>
/// <param name="val" type="Number">
/// An integer indicating the new position to set the scroll bar to.
/// </param>
/// <returns type="jQuery" />
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) {
/// <summary>
/// 1: Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element.
///
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)
/// </summary>
/// <param name="val" type="Number">
/// An integer indicating the new position to set the scroll bar to.
/// </param>
/// <returns type="jQuery" />
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) {
/// <summary>
/// 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()
/// </summary>
/// <param name="data" type="PlainObject">
/// An object containing data that will be passed to the event handler.
/// </param>
/// <param name="fn" type="Function">
/// A function to execute each time the event is triggered.
/// </param>
/// <returns type="jQuery" />
return arguments.length > 0 ?
this.on(name, null, data, fn) :
this.trigger(name);
};
jQuery.prototype.serialize = function () {
/// <summary>
/// Encode a set of form elements as a string for submission.
/// </summary>
/// <returns type="String" />
return jQuery.param(this.serializeArray());
};
jQuery.prototype.serializeArray = function () {
/// <summary>
/// Encode a set of form elements as an array of names and values.
/// </summary>
/// <returns type="Array" />
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 the number of elements in the jQuery object.
/// </summary>
/// <returns type="Number" />
return this.length;
};
jQuery.prototype.slice = function () {
/// <summary>
/// Reduce the set of matched elements to a subset specified by a range of indices.
/// </summary>
/// <param name="" type="Number">
/// 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.
/// </param>
/// <param name="" type="Number">
/// 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.
jQuery.prototype.toggleClass = function (value, stateVal) {
/// <summary>
/// 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.