From 139393fe0978e79c427ad13f1a03a10431ef95e5 Mon Sep 17 00:00:00 2001
From: John Resig
Date: Tue, 4 Sep 2007 01:57:35 +0000
Subject: [PATCH] Removed all inline documentation. The current version of all
documentation is stored online, on the wiki: http://docs.jquery.com/
---
src/ajax/ajax.js | 451 -----------
src/event/event.js | 579 +-------------
src/fx/fx.js | 248 ------
src/jquery/jquery.js | 1544 --------------------------------------
src/selector/selector.js | 36 -
5 files changed, 10 insertions(+), 2848 deletions(-)
diff --git a/src/ajax/ajax.js b/src/ajax/ajax.js
index 0b965e4a1..62785f355 100644
--- a/src/ajax/ajax.js
+++ b/src/ajax/ajax.js
@@ -1,49 +1,9 @@
jQuery.fn.extend({
-
- /**
- * Load HTML from a remote file and inject it into the DOM, only if it's
- * been modified by the server.
- *
- * @example $("#feeds").loadIfModified("feeds.html");
- * @before
- * @result
45 feeds found.
- *
- * @name loadIfModified
- * @type jQuery
- * @param String url The URL of the HTML file to load.
- * @param Map params (optional) Key/value pairs that will be sent to the server.
- * @param Function callback (optional) A function to be executed whenever the data is loaded (parameters: responseText, status and response itself).
- * @cat Ajax
- */
// DEPRECATED
loadIfModified: function( url, params, callback ) {
this.load( url, params, callback, 1 );
},
- /**
- * Load HTML from a remote file and inject it into the DOM.
- *
- * Note: Avoid to use this to load scripts, instead use $.getScript.
- * IE strips script tags when there aren't any other characters in front of it.
- *
- * @example $("#feeds").load("feeds.html");
- * @before
- * @result
45 feeds found.
- *
- * @example $("#feeds").load("feeds.html",
- * {limit: 25},
- * function() { alert("The last 25 entries in the feed have been loaded"); }
- * );
- * @desc Same as above, but with an additional parameter
- * and a callback that is executed when the data was loaded.
- *
- * @name load
- * @type jQuery
- * @param String url The URL of the HTML file to load.
- * @param Object params (optional) A set of key/value pairs that will be sent as data to the server.
- * @param Function callback (optional) A function to be executed whenever the data is loaded (parameters: responseText, status and response itself).
- * @cat Ajax
- */
load: function( url, params, callback, ifModified ) {
if ( jQuery.isFunction( url ) )
return this.bind("load", url);
@@ -107,25 +67,6 @@ jQuery.fn.extend({
return this;
},
- /**
- * Serializes a set of input elements into a string of data.
- * This will serialize all given elements.
- *
- * A serialization similar to the form submit of a browser is
- * provided by the [http://www.malsup.com/jquery/form/ Form Plugin].
- * It also takes multiple-selects
- * into account, while this method recognizes only a single option.
- *
- * @example $("input[@type=text]").serialize();
- * @before
- *
- * @after name=John&location=Boston
- * @desc Serialize a selection of input elements to a string
- *
- * @name serialize
- * @type String
- * @cat Ajax
- */
serialize: function() {
return jQuery.param( this );
},
@@ -138,106 +79,6 @@ jQuery.fn.extend({
});
// Attach a bunch of functions for handling common AJAX events
-
-/**
- * Attach a function to be executed whenever an AJAX request begins
- * and there is none already active.
- *
- * @example $("#loading").ajaxStart(function(){
- * $(this).show();
- * });
- * @desc Show a loading message whenever an AJAX request starts
- * (and none is already active).
- *
- * @name ajaxStart
- * @type jQuery
- * @param Function callback The function to execute.
- * @cat Ajax
- */
-
-/**
- * Attach a function to be executed whenever all AJAX requests have ended.
- *
- * @example $("#loading").ajaxStop(function(){
- * $(this).hide();
- * });
- * @desc Hide a loading message after all the AJAX requests have stopped.
- *
- * @name ajaxStop
- * @type jQuery
- * @param Function callback The function to execute.
- * @cat Ajax
- */
-
-/**
- * Attach a function to be executed whenever an AJAX request completes.
- *
- * The XMLHttpRequest and settings used for that request are passed
- * as arguments to the callback.
- *
- * @example $("#msg").ajaxComplete(function(request, settings){
- * $(this).append("
Request Complete.
");
- * });
- * @desc Show a message when an AJAX request completes.
- *
- * @name ajaxComplete
- * @type jQuery
- * @param Function callback The function to execute.
- * @cat Ajax
- */
-
-/**
- * Attach a function to be executed whenever an AJAX request completes
- * successfully.
- *
- * The XMLHttpRequest and settings used for that request are passed
- * as arguments to the callback.
- *
- * @example $("#msg").ajaxSuccess(function(request, settings){
- * $(this).append("
Successful Request!
");
- * });
- * @desc Show a message when an AJAX request completes successfully.
- *
- * @name ajaxSuccess
- * @type jQuery
- * @param Function callback The function to execute.
- * @cat Ajax
- */
-
-/**
- * Attach a function to be executed whenever an AJAX request fails.
- *
- * The XMLHttpRequest and settings used for that request are passed
- * as arguments to the callback. A third argument, an exception object,
- * is passed if an exception occured while processing the request.
- *
- * @example $("#msg").ajaxError(function(request, settings){
- * $(this).append("
Error requesting page " + settings.url + "
");
- * });
- * @desc Show a message when an AJAX request fails.
- *
- * @name ajaxError
- * @type jQuery
- * @param Function callback The function to execute.
- * @cat Ajax
- */
-
-/**
- * Attach a function to be executed before an AJAX request is sent.
- *
- * The XMLHttpRequest and settings used for that request are passed
- * as arguments to the callback.
- *
- * @example $("#msg").ajaxSend(function(request, settings){
- * $(this).append("
Starting request at " + settings.url + "
");
- * });
- * @desc Show a message before an AJAX request is sent.
- *
- * @name ajaxSend
- * @type jQuery
- * @param Function callback The function to execute.
- * @cat Ajax
- */
jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){
jQuery.fn[o] = function(f){
return this.bind(o, f);
@@ -247,39 +88,6 @@ jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".sp
var jsc = (new Date).getTime();
jQuery.extend({
-
- /**
- * Load a remote page using an HTTP GET request.
- *
- * This is an easy way to send a simple GET request to a server
- * without having to use the more complex $.ajax function. It
- * allows a single callback function to be specified that will
- * be executed when the request is complete (and only if the response
- * has a successful response code). If you need to have both error
- * and success callbacks, you may want to use $.ajax.
- *
- * @example $.get("test.cgi");
- *
- * @example $.get("test.cgi", { name: "John", time: "2pm" } );
- *
- * @example $.get("test.cgi", function(data){
- * alert("Data Loaded: " + data);
- * });
- *
- * @example $.get("test.cgi",
- * { name: "John", time: "2pm" },
- * function(data){
- * alert("Data Loaded: " + data);
- * }
- * );
- *
- * @name $.get
- * @type XMLHttpRequest
- * @param String url The URL of the page to load.
- * @param Map params (optional) Key/value pairs that will be sent to the server.
- * @param Function callback (optional) A function to be executed whenever the data is loaded successfully.
- * @cat Ajax
- */
get: function( url, data, callback, type, ifModified ) {
// shift arguments if data argument was ommited
if ( jQuery.isFunction( data ) ) {
@@ -297,110 +105,19 @@ jQuery.extend({
});
},
- /**
- * Load a remote page using an HTTP GET request, only if it hasn't
- * been modified since it was last retrieved.
- *
- * @example $.getIfModified("test.html");
- *
- * @example $.getIfModified("test.html", { name: "John", time: "2pm" } );
- *
- * @example $.getIfModified("test.cgi", function(data){
- * alert("Data Loaded: " + data);
- * });
- *
- * @example $.getifModified("test.cgi",
- * { name: "John", time: "2pm" },
- * function(data){
- * alert("Data Loaded: " + data);
- * }
- * );
- *
- * @name $.getIfModified
- * @type XMLHttpRequest
- * @param String url The URL of the page to load.
- * @param Map params (optional) Key/value pairs that will be sent to the server.
- * @param Function callback (optional) A function to be executed whenever the data is loaded successfully.
- * @cat Ajax
- */
// DEPRECATED
getIfModified: function( url, data, callback, type ) {
return jQuery.get(url, data, callback, type, 1);
},
- /**
- * Loads, and executes, a remote JavaScript file using an HTTP GET request.
- *
- * Warning: Safari <= 2.0.x is unable to evaluate scripts in a global
- * context synchronously. If you load functions via getScript, make sure
- * to call them after a delay.
- *
- * @example $.getScript("test.js");
- *
- * @example $.getScript("test.js", function(){
- * alert("Script loaded and executed.");
- * });
- *
- * @name $.getScript
- * @type XMLHttpRequest
- * @param String url The URL of the page to load.
- * @param Function callback (optional) A function to be executed whenever the data is loaded successfully.
- * @cat Ajax
- */
getScript: function( url, callback ) {
return jQuery.get(url, null, callback, "script");
},
- /**
- * Load JSON data using an HTTP GET request.
- *
- * @example $.getJSON("test.js", function(json){
- * alert("JSON Data: " + json.users[3].name);
- * });
- *
- * @example $.getJSON("test.js",
- * { name: "John", time: "2pm" },
- * function(json){
- * alert("JSON Data: " + json.users[3].name);
- * }
- * );
- *
- * @name $.getJSON
- * @type XMLHttpRequest
- * @param String url The URL of the page to load.
- * @param Map params (optional) Key/value pairs that will be sent to the server.
- * @param Function callback A function to be executed whenever the data is loaded successfully.
- * @cat Ajax
- */
getJSON: function( url, data, callback ) {
return jQuery.get(url, data, callback, "json");
},
- /**
- * Load a remote page using an HTTP POST request.
- *
- * @example $.post("test.cgi");
- *
- * @example $.post("test.cgi", { name: "John", time: "2pm" } );
- *
- * @example $.post("test.cgi", function(data){
- * alert("Data Loaded: " + data);
- * });
- *
- * @example $.post("test.cgi",
- * { name: "John", time: "2pm" },
- * function(data){
- * alert("Data Loaded: " + data);
- * }
- * );
- *
- * @name $.post
- * @type XMLHttpRequest
- * @param String url The URL of the page to load.
- * @param Map params (optional) Key/value pairs that will be sent to the server.
- * @param Function callback (optional) A function to be executed whenever the data is loaded successfully.
- * @cat Ajax
- */
post: function( url, data, callback, type ) {
if ( jQuery.isFunction( data ) ) {
callback = data;
@@ -416,51 +133,11 @@ jQuery.extend({
});
},
- /**
- * Set the timeout in milliseconds of all AJAX requests to a specific amount of time.
- * This will make all future AJAX requests timeout after a specified amount
- * of time.
- *
- * Set to null or 0 to disable timeouts (default).
- *
- * You can manually abort requests with the XMLHttpRequest's (returned by
- * all ajax functions) abort() method.
- *
- * Deprecated. Use $.ajaxSetup instead.
- *
- * @example $.ajaxTimeout( 5000 );
- * @desc Make all AJAX requests timeout after 5 seconds.
- *
- * @name $.ajaxTimeout
- * @type undefined
- * @param Number time How long before an AJAX request times out, in milliseconds.
- * @cat Ajax
- */
// DEPRECATED
ajaxTimeout: function( timeout ) {
jQuery.ajaxSettings.timeout = timeout;
},
- /**
- * Setup global settings for AJAX requests.
- *
- * See $.ajax for a description of all available options.
- *
- * @example $.ajaxSetup( {
- * url: "/xmlhttp/",
- * global: false,
- * type: "POST"
- * } );
- * $.ajax({ data: myData });
- * @desc Sets the defaults for AJAX requests to the url "/xmlhttp/",
- * disables global handlers and uses POST instead of GET. The following
- * AJAX requests then sends some data without having to set anything else.
- *
- * @name $.ajaxSetup
- * @type undefined
- * @param Map settings Key/value pairs to use for all AJAX requests
- * @cat Ajax
- */
ajaxSetup: function( settings ) {
jQuery.extend( jQuery.ajaxSettings, settings );
},
@@ -478,128 +155,6 @@ jQuery.extend({
// Last-Modified header cache for next request
lastModified: {},
- /**
- * Load a remote page using an HTTP request.
- *
- * This is jQuery's low-level AJAX implementation. See $.get, $.post etc. for
- * higher-level abstractions that are often easier to understand and use,
- * but don't offer as much functionality (such as error callbacks).
- *
- * $.ajax() returns the XMLHttpRequest that it creates. In most cases you won't
- * need that object to manipulate directly, but it is available if you need to
- * abort the request manually.
- *
- * '''Note:''' If you specify the dataType option described below, make sure
- * the server sends the correct MIME type in the response (eg. xml as "text/xml").
- * Sending the wrong MIME type can lead to unexpected problems in your script.
- * See [[Specifying the Data Type for AJAX Requests]] for more information.
- *
- * Supported datatypes are (see dataType option):
- *
- * "xml": Returns a XML document that can be processed via jQuery.
- *
- * "html": Returns HTML as plain text, included script tags are evaluated.
- *
- * "script": Evaluates the response as Javascript and returns it as plain text.
- *
- * "json": Evaluates the response as JSON and returns a Javascript Object
- *
- * $.ajax() takes one argument, an object of key/value pairs, that are
- * used to initalize and handle the request. These are all the key/values that can
- * be used:
- *
- * (String) url - The URL to request.
- *
- * (String) type - The type of request to make ("POST" or "GET"), default is "GET".
- *
- * (String) dataType - The type of data that you're expecting back from
- * the server. No default: If the server sends xml, the responseXML, otherwise
- * the responseText is passed to the success callback.
- *
- * (Boolean) ifModified - Allow the request to be successful only if the
- * response has changed since the last request. This is done by checking the
- * Last-Modified header. Default value is false, ignoring the header.
- *
- * (Number) timeout - Local timeout in milliseconds to override global timeout, eg. to give a
- * single request a longer timeout while all others timeout after 1 second.
- * See $.ajaxTimeout() for global timeouts.
- *
- * (Boolean) global - Whether to trigger global AJAX event handlers for
- * this request, default is true. Set to false to prevent that global handlers
- * like ajaxStart or ajaxStop are triggered.
- *
- * (Function) error - A function to be called if the request fails. The
- * function gets passed tree arguments: The XMLHttpRequest object, a
- * string describing the type of error that occurred and an optional
- * exception object, if one occured.
- *
- * (Function) success - A function to be called if the request succeeds. The
- * function gets passed one argument: The data returned from the server,
- * formatted according to the 'dataType' parameter.
- *
- * (Function) complete - A function to be called when the request finishes. The
- * function gets passed two arguments: The XMLHttpRequest object and a
- * string describing the type of success of the request.
- *
- * (Object|String) data - Data to be sent to the server. Converted to a query
- * string, if not already a string. Is appended to the url for GET-requests.
- * See processData option to prevent this automatic processing.
- *
- * (String) contentType - When sending data to the server, use this content-type.
- * Default is "application/x-www-form-urlencoded", which is fine for most cases.
- *
- * (Boolean) processData - By default, data passed in to the data option as an object
- * other as string will be processed and transformed into a query string, fitting to
- * the default content-type "application/x-www-form-urlencoded". If you want to send
- * DOMDocuments, set this option to false.
- *
- * (Boolean) async - By default, all requests are sent asynchronous (set to true).
- * If you need synchronous requests, set this option to false.
- *
- * (Function) beforeSend - A pre-callback to set custom headers etc., the
- * XMLHttpRequest is passed as the only argument.
- *
- * @example $.ajax({
- * type: "GET",
- * url: "test.js",
- * dataType: "script"
- * })
- * @desc Load and execute a JavaScript file.
- *
- * @example $.ajax({
- * type: "POST",
- * url: "some.php",
- * data: "name=John&location=Boston",
- * success: function(msg){
- * alert( "Data Saved: " + msg );
- * }
- * });
- * @desc Save some data to the server and notify the user once its complete.
- *
- * @example var html = $.ajax({
- * url: "some.php",
- * async: false
- * }).responseText;
- * @desc Loads data synchronously. Blocks the browser while the requests is active.
- * It is better to block user interaction by other means when synchronization is
- * necessary.
- *
- * @example var xmlDocument = [create xml document];
- * $.ajax({
- * url: "page.php",
- * processData: false,
- * data: xmlDocument,
- * success: handleResponse
- * });
- * @desc Sends an xml document as data to the server. By setting the processData
- * option to false, the automatic conversion of data to strings is prevented.
- *
- * @name $.ajax
- * @type XMLHttpRequest
- * @param Map properties Key/value pairs to initialize the request with.
- * @cat Ajax
- * @see ajaxSetup(Map)
- */
ajax: function( s ) {
var jsonp, jsre = /=(\?|%3F)/g, status, data;
@@ -862,12 +417,6 @@ jQuery.extend({
return false;
},
- /* Get the data out of an XMLHttpRequest.
- * Return parsed XML if content-type header is "xml" and type is "xml" or omitted,
- * otherwise return plain text.
- * (String) data - The type of data that you're expecting back,
- * (e.g. "xml", "html", "script")
- */
httpData: function( r, type ) {
var ct = r.getResponseHeader("content-type");
var xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0;
diff --git a/src/event/event.js b/src/event/event.js
index 6224d13bc..df982ec40 100644
--- a/src/event/event.js
+++ b/src/event/event.js
@@ -285,88 +285,12 @@ jQuery.event = {
};
jQuery.fn.extend({
-
- /**
- * Binds a handler to a particular event (like click) for each matched element.
- * The event handler is passed an event object that you can use to prevent
- * default behaviour. To stop both default action and event bubbling, your handler
- * has to return false.
- *
- * In most cases, you can define your event handlers as anonymous functions
- * (see first example). In cases where that is not possible, you can pass additional
- * data as the second parameter (and the handler function as the third), see
- * second example.
- *
- * Calling bind with an event type of "unload" will automatically
- * use the one method instead of bind to prevent memory leaks.
- *
- * @example $("p").bind("click", function(){
- * alert( $(this).text() );
- * });
- * @before
Hello
- * @result alert("Hello")
- *
- * @example function handler(event) {
- * alert(event.data.foo);
- * }
- * $("p").bind("click", {foo: "bar"}, handler)
- * @result alert("bar")
- * @desc Pass some additional data to the event handler.
- *
- * @example $("form").bind("submit", function() { return false; })
- * @desc Cancel a default action and prevent it from bubbling by returning false
- * from your function.
- *
- * @example $("form").bind("submit", function(event){
- * event.preventDefault();
- * });
- * @desc Cancel only the default action by using the preventDefault method.
- *
- *
- * @example $("form").bind("submit", function(event){
- * event.stopPropagation();
- * });
- * @desc Stop only an event from bubbling by using the stopPropagation method.
- *
- * @name bind
- * @type jQuery
- * @param String type An event type
- * @param Object data (optional) Additional data passed to the event handler as event.data
- * @param Function fn A function to bind to the event on each of the set of matched elements
- * @cat Events
- */
bind: function( type, data, fn ) {
return type == "unload" ? this.one(type, data, fn) : this.each(function(){
jQuery.event.add( this, type, fn || data, fn && data );
});
},
- /**
- * Binds a handler to a particular event (like click) for each matched element.
- * The handler is executed only once for each element. Otherwise, the same rules
- * as described in bind() apply.
- * The event handler is passed an event object that you can use to prevent
- * default behaviour. To stop both default action and event bubbling, your handler
- * has to return false.
- *
- * In most cases, you can define your event handlers as anonymous functions
- * (see first example). In cases where that is not possible, you can pass additional
- * data as the second paramter (and the handler function as the third), see
- * second example.
- *
- * @example $("p").one("click", function(){
- * alert( $(this).text() );
- * });
- * @before
Hello
- * @result alert("Hello")
- *
- * @name one
- * @type jQuery
- * @param String type An event type
- * @param Object data (optional) Additional data passed to the event handler as event.data
- * @param Function fn A function to bind to the event on each of the set of matched elements
- * @cat Events
- */
one: function( type, data, fn ) {
return this.each(function(){
jQuery.event.add( this, type, function(event) {
@@ -376,73 +300,12 @@ jQuery.fn.extend({
});
},
- /**
- * The opposite of bind, removes a bound event from each of the matched
- * elements.
- *
- * Without any arguments, all bound events are removed.
- *
- * If the type is provided, all bound events of that type are removed.
- *
- * If the function that was passed to bind is provided as the second argument,
- * only that specific event handler is removed.
- *
- * @example $("p").unbind()
- * @before
]
- *
- * @name unbind
- * @type jQuery
- * @param String type (optional) An event type
- * @param Function fn (optional) A function to unbind from the event on each of the set of matched elements
- * @cat Events
- */
unbind: function( type, fn ) {
return this.each(function(){
jQuery.event.remove( this, type, fn );
});
},
- /**
- * Trigger a type of event on every matched element. This will also cause
- * the default action of the browser with the same name (if one exists)
- * to be executed. For example, passing 'submit' to the trigger()
- * function will also cause the browser to submit the form. This
- * default action can be prevented by returning false from one of
- * the functions bound to the event.
- *
- * You can also trigger custom events registered with bind.
- *
- * @example $("p").trigger("click")
- * @before
Hello
- * @result alert('hello')
- *
- * @example $("p").click(function(event, a, b) {
- * // when a normal click fires, a and b are undefined
- * // for a trigger like below a refers too "foo" and b refers to "bar"
- * }).trigger("click", ["foo", "bar"]);
- * @desc Example of how to pass arbitrary data to an event
- *
- * @example $("p").bind("myEvent",function(event,message1,message2) {
- * alert(message1 + ' ' + message2);
- * });
- * $("p").trigger("myEvent",["Hello","World"]);
- * @result alert('Hello World') // One for each paragraph
- *
- * @name trigger
- * @type jQuery
- * @param String type An event type to trigger.
- * @param Array data (optional) Additional data to pass as arguments (after the event object) to the event handler
- * @cat Events
- */
trigger: function( type, data, fn ) {
return this.each(function(){
jQuery.event.trigger( type, data, this, true, fn );
@@ -454,26 +317,6 @@ jQuery.fn.extend({
return jQuery.event.trigger( type, data, this[0], false, fn );
},
- /**
- * Toggle between two function calls every other click.
- * Whenever a matched element is clicked, the first specified function
- * is fired, when clicked again, the second is fired. All subsequent
- * clicks continue to rotate through the two functions.
- *
- * Use unbind("click") to remove.
- *
- * @example $("p").toggle(function(){
- * $(this).addClass("selected");
- * },function(){
- * $(this).removeClass("selected");
- * });
- *
- * @name toggle
- * @type jQuery
- * @param Function even The function to execute on every even click.
- * @param Function odd The function to execute on every odd click.
- * @cat Events
- */
toggle: function() {
// Save reference to arguments for access in closure
var a = arguments;
@@ -489,32 +332,7 @@ jQuery.fn.extend({
return a[this.lastToggle].apply( this, [e] ) || false;
});
},
-
- /**
- * A method for simulating hovering (moving the mouse on, and off,
- * an object). This is a custom method which provides an 'in' to a
- * frequent task.
- *
- * Whenever the mouse cursor is moved over a matched
- * element, the first specified function is fired. Whenever the mouse
- * moves off of the element, the second specified function fires.
- * Additionally, checks are in place to see if the mouse is still within
- * the specified element itself (for example, an image inside of a div),
- * and if it is, it will continue to 'hover', and not move out
- * (a common error in using a mouseout event handler).
- *
- * @example $("p").hover(function(){
- * $(this).addClass("hover");
- * },function(){
- * $(this).removeClass("hover");
- * });
- *
- * @name hover
- * @type jQuery
- * @param Function over The function to fire whenever the mouse is moved over a matched element.
- * @param Function out The function to fire whenever the mouse is moved off of a matched element.
- * @cat Events
- */
+
hover: function(f,g) {
// A private function for handling mouse 'hovering'
@@ -536,43 +354,6 @@ jQuery.fn.extend({
return this.mouseover(handleHover).mouseout(handleHover);
},
- /**
- * Bind a function to be executed whenever the DOM is ready to be
- * traversed and manipulated. This is probably the most important
- * function included in the event module, as it can greatly improve
- * the response times of your web applications.
- *
- * In a nutshell, this is a solid replacement for using window.onload,
- * and attaching a function to that. By using this method, your bound function
- * will be called the instant the DOM is ready to be read and manipulated,
- * which is when what 99.99% of all JavaScript code needs to run.
- *
- * There is one argument passed to the ready event handler: A reference to
- * the jQuery function. You can name that argument whatever you like, and
- * can therefore stick with the $ alias without risk of naming collisions.
- *
- * Please ensure you have no code in your <body> onload event handler,
- * otherwise $(document).ready() may not fire.
- *
- * You can have as many $(document).ready events on your page as you like.
- * The functions are then executed in the order they were added.
- *
- * @example $(document).ready(function(){ Your code here... });
- *
- * @example jQuery(function($) {
- * // Your code using failsafe $ alias here...
- * });
- * @desc Uses both the [[Core#.24.28_fn_.29|shortcut]] for $(document).ready() and the argument
- * to write failsafe jQuery code using the $ alias, without relying on the
- * global alias.
- *
- * @name ready
- * @type jQuery
- * @param Function fn The function to be executed when the DOM is ready.
- * @cat Events
- * @see $.noConflict()
- * @see $(Function)
- */
ready: function(f) {
// Attach the listeners
bindReady();
@@ -626,356 +407,16 @@ jQuery.extend({
}
});
- /**
- * Bind a function to the scroll event of each matched element.
- *
- * @example $("p").scroll( function() { alert("Hello"); } );
- * @before
Hello
- * @result
Hello
- *
- * @name scroll
- * @type jQuery
- * @param Function fn A function to bind to the scroll event on each of the matched elements.
- * @cat Events
- */
-
- /**
- * Bind a function to the submit event of each matched element.
- *
- * @example $("#myform").submit( function() {
- * return $("input", this).val().length > 0;
- * } );
- * @before
- * @desc Prevents the form submission when the input has no value entered.
- *
- * @name submit
- * @type jQuery
- * @param Function fn A function to bind to the submit event on each of the matched elements.
- * @cat Events
- */
-
- /**
- * Trigger the submit event of each matched element. This causes all of the functions
- * that have been bound to that submit event to be executed, and calls the browser's
- * default submit action on the matching element(s). This default action can be prevented
- * by returning false from one of the functions bound to the submit event.
- *
- * Note: This does not execute the submit method of the form element! If you need to
- * submit the form via code, you have to use the DOM method, eg. $("form")[0].submit();
- *
- * @example $("form").submit();
- * @desc Triggers all submit events registered to the matched form(s), and submits them.
- *
- * @name submit
- * @type jQuery
- * @cat Events
- */
-
- /**
- * Bind a function to the focus event of each matched element.
- *
- * @example $("p").focus( function() { alert("Hello"); } );
- * @before
Hello
- * @result
Hello
- *
- * @name focus
- * @type jQuery
- * @param Function fn A function to bind to the focus event on each of the matched elements.
- * @cat Events
- */
-
- /**
- * Trigger the focus event of each matched element. This causes all of the functions
- * that have been bound to thet focus event to be executed.
- *
- * Note: This does not execute the focus method of the underlying elements! If you need to
- * focus an element via code, you have to use the DOM method, eg. $("#myinput")[0].focus();
- *
- * @example $("p").focus();
- * @before
Hello
- * @result alert('Hello');
- *
- * @name focus
- * @type jQuery
- * @cat Events
- */
-
- /**
- * Bind a function to the keydown event of each matched element.
- *
- * @example $("p").keydown( function() { alert("Hello"); } );
- * @before
Hello
- * @result
Hello
- *
- * @name keydown
- * @type jQuery
- * @param Function fn A function to bind to the keydown event on each of the matched elements.
- * @cat Events
- */
-
- /**
- * Bind a function to the dblclick event of each matched element.
- *
- * @example $("p").dblclick( function() { alert("Hello"); } );
- * @before
Hello
- * @result
Hello
- *
- * @name dblclick
- * @type jQuery
- * @param Function fn A function to bind to the dblclick event on each of the matched elements.
- * @cat Events
- */
-
- /**
- * Bind a function to the keypress event of each matched element.
- *
- * @example $("p").keypress( function() { alert("Hello"); } );
- * @before
Hello
- * @result
Hello
- *
- * @name keypress
- * @type jQuery
- * @param Function fn A function to bind to the keypress event on each of the matched elements.
- * @cat Events
- */
-
- /**
- * Bind a function to the error event of each matched element.
- *
- * @example $("p").error( function() { alert("Hello"); } );
- * @before
Hello
- * @result
Hello
- *
- * @name error
- * @type jQuery
- * @param Function fn A function to bind to the error event on each of the matched elements.
- * @cat Events
- */
-
- /**
- * Bind a function to the blur event of each matched element.
- *
- * @example $("p").blur( function() { alert("Hello"); } );
- * @before
Hello
- * @result
Hello
- *
- * @name blur
- * @type jQuery
- * @param Function fn A function to bind to the blur event on each of the matched elements.
- * @cat Events
- */
-
- /**
- * Trigger the blur event of each matched element. This causes all of the functions
- * that have been bound to that blur event to be executed, and calls the browser's
- * default blur action on the matching element(s). This default action can be prevented
- * by returning false from one of the functions bound to the blur event.
- *
- * Note: This does not execute the blur method of the underlying elements! If you need to
- * blur an element via code, you have to use the DOM method, eg. $("#myinput")[0].blur();
- *
- * @example $("p").blur();
- * @before
Hello
- * @result alert('Hello');
- *
- * @name blur
- * @type jQuery
- * @cat Events
- */
-
- /**
- * Bind a function to the load event of each matched element.
- *
- * @example $("p").load( function() { alert("Hello"); } );
- * @before
Hello
- * @result
Hello
- *
- * @name load
- * @type jQuery
- * @param Function fn A function to bind to the load event on each of the matched elements.
- * @cat Events
- */
-
- /**
- * Bind a function to the select event of each matched element.
- *
- * @example $("p").select( function() { alert("Hello"); } );
- * @before
Hello
- * @result
Hello
- *
- * @name select
- * @type jQuery
- * @param Function fn A function to bind to the select event on each of the matched elements.
- * @cat Events
- */
-
- /**
- * Trigger the select event of each matched element. This causes all of the functions
- * that have been bound to that select event to be executed, and calls the browser's
- * default select action on the matching element(s). This default action can be prevented
- * by returning false from one of the functions bound to the select event.
- *
- * @example $("p").select();
- * @before
Hello
- * @result alert('Hello');
- *
- * @name select
- * @type jQuery
- * @cat Events
- */
-
- /**
- * Bind a function to the mouseup event of each matched element.
- *
- * @example $("p").mouseup( function() { alert("Hello"); } );
- * @before
Hello
- * @result
Hello
- *
- * @name mouseup
- * @type jQuery
- * @param Function fn A function to bind to the mouseup event on each of the matched elements.
- * @cat Events
- */
-
- /**
- * Bind a function to the unload event of each matched element.
- *
- * @example $("p").unload( function() { alert("Hello"); } );
- * @before
Hello
- * @result
Hello
- *
- * @name unload
- * @type jQuery
- * @param Function fn A function to bind to the unload event on each of the matched elements.
- * @cat Events
- */
-
- /**
- * Bind a function to the change event of each matched element.
- *
- * @example $("p").change( function() { alert("Hello"); } );
- * @before
Hello
- * @result
Hello
- *
- * @name change
- * @type jQuery
- * @param Function fn A function to bind to the change event on each of the matched elements.
- * @cat Events
- */
-
- /**
- * Bind a function to the mouseout event of each matched element.
- *
- * @example $("p").mouseout( function() { alert("Hello"); } );
- * @before
Hello
- * @result
Hello
- *
- * @name mouseout
- * @type jQuery
- * @param Function fn A function to bind to the mouseout event on each of the matched elements.
- * @cat Events
- */
-
- /**
- * Bind a function to the keyup event of each matched element.
- *
- * @example $("p").keyup( function() { alert("Hello"); } );
- * @before
Hello
- * @result
Hello
- *
- * @name keyup
- * @type jQuery
- * @param Function fn A function to bind to the keyup event on each of the matched elements.
- * @cat Events
- */
- /**
- * Bind a function to the click event of each matched element.
- *
- * @example $("p").click( function() { alert("Hello"); } );
- * @before
Hello
- * @result
Hello
- *
- * @name click
- * @type jQuery
- * @param Function fn A function to bind to the click event on each of the matched elements.
- * @cat Events
- */
-
- /**
- * Trigger the click event of each matched element. This causes all of the functions
- * that have been bound to thet click event to be executed.
- *
- * @example $("p").click();
- * @before
Hello
- * @result alert('Hello');
- *
- * @name click
- * @type jQuery
- * @cat Events
- */
-
- /**
- * Bind a function to the resize event of each matched element.
- *
- * @example $("p").resize( function() { alert("Hello"); } );
- * @before
Hello
- * @result
Hello
- *
- * @name resize
- * @type jQuery
- * @param Function fn A function to bind to the resize event on each of the matched elements.
- * @cat Events
- */
-
- /**
- * Bind a function to the mousemove event of each matched element.
- *
- * @example $("p").mousemove( function() { alert("Hello"); } );
- * @before
Hello
- * @result
Hello
- *
- * @name mousemove
- * @type jQuery
- * @param Function fn A function to bind to the mousemove event on each of the matched elements.
- * @cat Events
- */
-
- /**
- * Bind a function to the mousedown event of each matched element.
- *
- * @example $("p").mousedown( function() { alert("Hello"); } );
- * @before
Hello
- * @result
Hello
- *
- * @name mousedown
- * @type jQuery
- * @param Function fn A function to bind to the mousedown event on each of the matched elements.
- * @cat Events
- */
-
- /**
- * Bind a function to the mouseover event of each matched element.
- *
- * @example $("p").mouseover( function() { alert("Hello"); } );
- * @before
Hello
- * @result
Hello
- *
- * @name mouseover
- * @type jQuery
- * @param Function fn A function to bind to the mousedown event on each of the matched elements.
- * @cat Events
- */
- jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
- "mousedown,mouseup,mousemove,mouseover,mouseout,change,select," +
- "submit,keydown,keypress,keyup,error").split(","), function(i,o){
-
- // Handle event binding
- jQuery.fn[o] = function(f){
- return f ? this.bind(o, f) : this.trigger(o);
- };
-
- });
+jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
+ "mousedown,mouseup,mousemove,mouseover,mouseout,change,select," +
+ "submit,keydown,keypress,keyup,error").split(","), function(i,o){
+
+ // Handle event binding
+ jQuery.fn[o] = function(f){
+ return f ? this.bind(o, f) : this.trigger(o);
+ };
+});
var readyBound = false;
diff --git a/src/fx/fx.js b/src/fx/fx.js
index 69885e890..7c5ba4455 100644
--- a/src/fx/fx.js
+++ b/src/fx/fx.js
@@ -1,37 +1,4 @@
jQuery.fn.extend({
-
- /**
- * Displays each of the set of matched elements if they are hidden.
- *
- * @example $("p").show()
- * @before
Hello
- * @result [
Hello
]
- *
- * @name show
- * @type jQuery
- * @cat Effects
- */
-
- /**
- * Show all matched elements using a graceful animation and firing an
- * optional callback after completion.
- *
- * The height, width, and opacity of each of the matched elements
- * are changed dynamically according to the specified speed.
- *
- * @example $("p").show("slow");
- *
- * @example $("p").show("slow",function(){
- * alert("Animation Done.");
- * });
- *
- * @name show
- * @type jQuery
- * @param String|Number speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
- * @param Function callback (optional) A function to be executed whenever the animation completes.
- * @cat Effects
- * @see hide(String|Number,Function)
- */
show: function(speed,callback){
return speed ?
this.animate({
@@ -45,38 +12,6 @@ jQuery.fn.extend({
}).end();
},
- /**
- * Hides each of the set of matched elements if they are shown.
- *
- * @example $("p").hide()
- * @before
Hello
- * @result [
Hello
]
- *
- * @name hide
- * @type jQuery
- * @cat Effects
- */
-
- /**
- * Hide all matched elements using a graceful animation and firing an
- * optional callback after completion.
- *
- * The height, width, and opacity of each of the matched elements
- * are changed dynamically according to the specified speed.
- *
- * @example $("p").hide("slow");
- *
- * @example $("p").hide("slow",function(){
- * alert("Animation Done.");
- * });
- *
- * @name hide
- * @type jQuery
- * @param String|Number speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
- * @param Function callback (optional) A function to be executed whenever the animation completes.
- * @cat Effects
- * @see show(String|Number,Function)
- */
hide: function(speed,callback){
return speed ?
this.animate({
@@ -94,19 +29,6 @@ jQuery.fn.extend({
// Save the old toggle function
_toggle: jQuery.fn.toggle,
- /**
- * Toggles each of the set of matched elements. If they are shown,
- * toggle makes them hidden. If they are hidden, toggle
- * makes them shown.
- *
- * @example $("p").toggle()
- * @before
Hello
Hello Again
- * @result [
Hello
,
Hello Again
]
- *
- * @name toggle
- * @type jQuery
- * @cat Effects
- */
toggle: function( fn, fn2 ){
return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
this._toggle( fn, fn2 ) :
@@ -119,196 +41,30 @@ jQuery.fn.extend({
});
},
- /**
- * Reveal all matched elements by adjusting their height and firing an
- * optional callback after completion.
- *
- * Only the height is adjusted for this animation, causing all matched
- * elements to be revealed in a "sliding" manner.
- *
- * @example $("p").slideDown("slow");
- *
- * @example $("p").slideDown("slow",function(){
- * alert("Animation Done.");
- * });
- *
- * @name slideDown
- * @type jQuery
- * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
- * @param Function callback (optional) A function to be executed whenever the animation completes.
- * @cat Effects
- * @see slideUp(String|Number,Function)
- * @see slideToggle(String|Number,Function)
- */
slideDown: function(speed,callback){
return this.animate({height: "show"}, speed, callback);
},
- /**
- * Hide all matched elements by adjusting their height and firing an
- * optional callback after completion.
- *
- * Only the height is adjusted for this animation, causing all matched
- * elements to be hidden in a "sliding" manner.
- *
- * @example $("p").slideUp("slow");
- *
- * @example $("p").slideUp("slow",function(){
- * alert("Animation Done.");
- * });
- *
- * @name slideUp
- * @type jQuery
- * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
- * @param Function callback (optional) A function to be executed whenever the animation completes.
- * @cat Effects
- * @see slideDown(String|Number,Function)
- * @see slideToggle(String|Number,Function)
- */
slideUp: function(speed,callback){
return this.animate({height: "hide"}, speed, callback);
},
- /**
- * Toggle the visibility of all matched elements by adjusting their height and firing an
- * optional callback after completion.
- *
- * Only the height is adjusted for this animation, causing all matched
- * elements to be hidden in a "sliding" manner.
- *
- * @example $("p").slideToggle("slow");
- *
- * @example $("p").slideToggle("slow",function(){
- * alert("Animation Done.");
- * });
- *
- * @name slideToggle
- * @type jQuery
- * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
- * @param Function callback (optional) A function to be executed whenever the animation completes.
- * @cat Effects
- * @see slideDown(String|Number,Function)
- * @see slideUp(String|Number,Function)
- */
slideToggle: function(speed, callback){
return this.animate({height: "toggle"}, speed, callback);
},
- /**
- * Fade in all matched elements by adjusting their opacity and firing an
- * optional callback after completion.
- *
- * Only the opacity is adjusted for this animation, meaning that
- * all of the matched elements should already have some form of height
- * and width associated with them.
- *
- * @example $("p").fadeIn("slow");
- *
- * @example $("p").fadeIn("slow",function(){
- * alert("Animation Done.");
- * });
- *
- * @name fadeIn
- * @type jQuery
- * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
- * @param Function callback (optional) A function to be executed whenever the animation completes.
- * @cat Effects
- * @see fadeOut(String|Number,Function)
- * @see fadeTo(String|Number,Number,Function)
- */
fadeIn: function(speed, callback){
return this.animate({opacity: "show"}, speed, callback);
},
- /**
- * Fade out all matched elements by adjusting their opacity and firing an
- * optional callback after completion.
- *
- * Only the opacity is adjusted for this animation, meaning that
- * all of the matched elements should already have some form of height
- * and width associated with them.
- *
- * @example $("p").fadeOut("slow");
- *
- * @example $("p").fadeOut("slow",function(){
- * alert("Animation Done.");
- * });
- *
- * @name fadeOut
- * @type jQuery
- * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
- * @param Function callback (optional) A function to be executed whenever the animation completes.
- * @cat Effects
- * @see fadeIn(String|Number,Function)
- * @see fadeTo(String|Number,Number,Function)
- */
fadeOut: function(speed, callback){
return this.animate({opacity: "hide"}, speed, callback);
},
- /**
- * Fade the opacity of all matched elements to a specified opacity and firing an
- * optional callback after completion.
- *
- * Only the opacity is adjusted for this animation, meaning that
- * all of the matched elements should already have some form of height
- * and width associated with them.
- *
- * @example $("p").fadeTo("slow", 0.5);
- *
- * @example $("p").fadeTo("slow", 0.5, function(){
- * alert("Animation Done.");
- * });
- *
- * @name fadeTo
- * @type jQuery
- * @param String|Number speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
- * @param Number opacity The opacity to fade to (a number from 0 to 1).
- * @param Function callback (optional) A function to be executed whenever the animation completes.
- * @cat Effects
- * @see fadeIn(String|Number,Function)
- * @see fadeOut(String|Number,Function)
- */
fadeTo: function(speed,to,callback){
return this.animate({opacity: to}, speed, callback);
},
- /**
- * A function for making your own, custom animations. The key aspect of
- * this function is the object of style properties that will be animated,
- * and to what end. Each key within the object represents a style property
- * that will also be animated (for example: "height", "top", or "opacity").
- *
- * Note that properties should be specified using camel case
- * eg. marginLeft instead of margin-left.
- *
- * The value associated with the key represents to what end the property
- * will be animated. If a number is provided as the value, then the style
- * property will be transitioned from its current state to that new number.
- * Otherwise if the string "hide", "show", or "toggle" is provided, a default
- * animation will be constructed for that property.
- *
- * @example $("p").animate({
- * height: 'toggle', opacity: 'toggle'
- * }, "slow");
- *
- * @example $("p").animate({
- * left: 50, opacity: 'show'
- * }, 500);
- *
- * @example $("p").animate({
- * opacity: 'show'
- * }, "slow", "easein");
- * @desc An example of using an 'easing' function to provide a different style of animation. This will only work if you have a plugin that provides this easing function (Only "swing" and "linear" are provided by default, with jQuery).
- *
- * @name animate
- * @type jQuery
- * @param Hash params A set of style attributes that you wish to animate, and to what end.
- * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000).
- * @param String easing (optional) The name of the easing effect that you want to use (e.g. "swing" or "linear"). Defaults to "swing".
- * @param Function callback (optional) A function to be executed whenever the animation completes.
- * @cat Effects
- */
animate: function( prop, speed, easing, callback ) {
return this.queue(function(){
var hidden = jQuery(this).is(":hidden"),
@@ -346,10 +102,6 @@ jQuery.fn.extend({
});
},
- /**
- *
- * @private
- */
queue: function(type,fn){
if ( !fn ) {
fn = type;
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js
index 8f8a1763d..338df7f96 100644
--- a/src/jquery/jquery.js
+++ b/src/jquery/jquery.js
@@ -9,17 +9,6 @@
* $Rev$
*/
-/**
- * Create a new jQuery Object
- *
- * @constructor
- * @private
- * @name jQuery
- * @param String|Function|Element|Array|jQuery a selector
- * @param jQuery|Element|Array c context
- * @cat Core
- */
-
// Map over jQuery in case of overwrite
if ( typeof jQuery != "undefined" )
var _jQuery = jQuery;
@@ -41,118 +30,7 @@ window.$ = jQuery;
var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;
-/**
- * This function accepts a string containing a CSS or
- * basic XPath selector which is then used to match a set of elements.
- *
- * The core functionality of jQuery centers around this function.
- * Everything in jQuery is based upon this, or uses this in some way.
- * The most basic use of this function is to pass in an expression
- * (usually consisting of CSS or XPath), which then finds all matching
- * elements.
- *
- * By default, if no context is specified, $() looks for DOM elements within the context of the
- * current HTML document. If you do specify a context, such as a DOM
- * element or jQuery object, the expression will be matched against
- * the contents of that context.
- *
- * See [[DOM/Traversing/Selectors]] for the allowed CSS/XPath syntax for expressions.
- *
- * @example $("div > p")
- * @desc Finds all p elements that are children of a div element.
- * @before
one
two
three
- * @result [
two
]
- *
- * @example $("input:radio", document.forms[0])
- * @desc Searches for all inputs of type radio within the first form in the document
- *
- * @example $("div", xml.responseXML)
- * @desc This finds all div elements within the specified XML document.
- *
- * @name $
- * @param String expr An expression to search with
- * @param Element|jQuery context (optional) A DOM Element, Document or jQuery to use as context
- * @cat Core
- * @type jQuery
- * @see $(Element)
- * @see $(Element)
- */
-
-/**
- * Create DOM elements on-the-fly from the provided String of raw HTML.
- *
- * @example $("
Hello
").appendTo("body")
- * @desc Creates a div element (and all of its contents) dynamically,
- * and appends it to the body element. Internally, an
- * element is created and its innerHTML property set to the given markup.
- * It is therefore both quite flexible and limited.
- *
- * @name $
- * @param String html A string of HTML to create on the fly.
- * @cat Core
- * @type jQuery
- * @see appendTo(String)
- */
-
-/**
- * Wrap jQuery functionality around a single or multiple DOM Element(s).
- *
- * This function also accepts XML Documents and Window objects
- * as valid arguments (even though they are not DOM Elements).
- *
- * @example $(document.body).css( "background", "black" );
- * @desc Sets the background color of the page to black.
- *
- * @example $( myForm.elements ).hide()
- * @desc Hides all the input elements within a form
- *
- * @name $
- * @param Element|Array elems DOM element(s) to be encapsulated by a jQuery object.
- * @cat Core
- * @type jQuery
- */
-
-/**
- * A shorthand for $(document).ready(), allowing you to bind a function
- * to be executed when the DOM document has finished loading. This function
- * behaves just like $(document).ready(), in that it should be used to wrap
- * other $() operations on your page that depend on the DOM being ready to be
- * operated on. While this function is, technically, chainable - there really
- * isn't much use for chaining against it.
- *
- * You can have as many $(document).ready events on your page as you like.
- *
- * See ready(Function) for details about the ready event.
- *
- * @example $(function(){
- * // Document is ready
- * });
- * @desc Executes the function when the DOM is ready to be used.
- *
- * @example jQuery(function($) {
- * // Your code using failsafe $ alias here...
- * });
- * @desc Uses both the shortcut for $(document).ready() and the argument
- * to write failsafe jQuery code using the $ alias, without relying on the
- * global alias.
- *
- * @name $
- * @param Function fn The function to execute when the DOM is ready.
- * @cat Core
- * @type jQuery
- * @see ready(Function)
- */
-
jQuery.fn = jQuery.prototype = {
- /**
- * Initialize a new jQuery object
- *
- * @private
- * @name init
- * @param String|Function|Element|Array|jQuery a selector
- * @param jQuery|Element|Array c context
- * @cat Core
- */
init: function(a,c) {
// Make sure that a selection was provided
a = a || document;
@@ -203,80 +81,14 @@ jQuery.fn = jQuery.prototype = {
[ a ] );
},
- /**
- * The current version of jQuery.
- *
- * @private
- * @property
- * @name jquery
- * @type String
- * @cat Core
- */
jquery: "@VERSION",
- /**
- * The number of elements currently matched. The size function will return the same value.
- *
- * @example $("img").length;
- * @before
- * @result 2
- *
- * @property
- * @name length
- * @type Number
- * @cat Core
- */
-
- /**
- * Get the number of elements currently matched. This returns the same
- * number as the 'length' property of the jQuery object.
- *
- * @example $("img").size();
- * @before
- * @result 2
- *
- * @name size
- * @type Number
- * @cat Core
- */
size: function() {
return this.length;
},
length: 0,
- /**
- * Access all matched DOM elements. This serves as a backwards-compatible
- * way of accessing all matched elements (other than the jQuery object
- * itself, which is, in fact, an array of elements).
- *
- * It is useful if you need to operate on the DOM elements themselves instead of using built-in jQuery functions.
- *
- * @example $("img").get();
- * @before
- * @result [ ]
- * @desc Selects all images in the document and returns the DOM Elements as an Array
- *
- * @name get
- * @type Array
- * @cat Core
- */
-
- /**
- * Access a single matched DOM element at a specified index in the matched set.
- * This allows you to extract the actual DOM element and operate on it
- * directly without necessarily using jQuery functionality on it.
- *
- * @example $("img").get(0);
- * @before
- * @result
- * @desc Selects all images in the document and returns the first one
- *
- * @name get
- * @type Element
- * @param Number num Access the element in the Nth position.
- * @cat Core
- */
get: function( num ) {
return num == undefined ?
@@ -287,96 +99,22 @@ jQuery.fn = jQuery.prototype = {
this[num];
},
- /**
- * Set the jQuery object to an array of elements, while maintaining
- * the stack.
- *
- * @example $("img").pushStack([ document.body ]);
- * @result $("img").pushStack() == [ document.body ]
- *
- * @private
- * @name pushStack
- * @type jQuery
- * @param Elements elems An array of elements
- * @cat Core
- */
pushStack: function( a ) {
var ret = jQuery(a);
ret.prevObject = this;
return ret;
},
- /**
- * Set the jQuery object to an array of elements. This operation is
- * completely destructive - be sure to use .pushStack() if you wish to maintain
- * the jQuery stack.
- *
- * @example $("img").setArray([ document.body ]);
- * @result $("img").setArray() == [ document.body ]
- *
- * @private
- * @name setArray
- * @type jQuery
- * @param Elements elems An array of elements
- * @cat Core
- */
setArray: function( a ) {
this.length = 0;
Array.prototype.push.apply( this, a );
return this;
},
- /**
- * Execute a function within the context of every matched element.
- * This means that every time the passed-in function is executed
- * (which is once for every element matched) the 'this' keyword
- * points to the specific DOM element.
- *
- * Additionally, the function, when executed, is passed a single
- * argument representing the position of the element in the matched
- * set (integer, zero-index).
- *
- * @example $("img").each(function(i){
- * this.src = "test" + i + ".jpg";
- * });
- * @before
- * @result
- * @desc Iterates over two images and sets their src property
- *
- * @name each
- * @type jQuery
- * @param Function fn A function to execute
- * @cat Core
- */
each: function( fn, args ) {
return jQuery.each( this, fn, args );
},
- /**
- * Searches every matched element for the object and returns
- * the index of the element, if found, starting with zero.
- * Returns -1 if the object wasn't found.
- *
- * @example $("*").index( $('#foobar')[0] )
- * @before
- * @result 0
- * @desc Returns the index for the element with ID foobar
- *
- * @example $("*").index( $('#foo')[0] )
- * @before
- * @result 2
- * @desc Returns the index for the element with ID foo within another element
- *
- * @example $("*").index( $('#bar')[0] )
- * @before
- * @result -1
- * @desc Returns -1, as there is no element with ID bar
- *
- * @name index
- * @type Number
- * @param Element subject Object to search for
- * @cat Core
- */
index: function( obj ) {
var pos = -1;
this.each(function(i){
@@ -385,85 +123,6 @@ jQuery.fn = jQuery.prototype = {
return pos;
},
- /**
- * Access a property on the first matched element.
- * This method makes it easy to retrieve a property value
- * from the first matched element.
- *
- * If the element does not have an attribute with such a
- * name, undefined is returned.
- *
- * @example $("img").attr("src");
- * @before
- * @result test.jpg
- * @desc Returns the src attribute from the first image in the document.
- *
- * @name attr
- * @type Object
- * @param String name The name of the property to access.
- * @cat DOM/Attributes
- */
-
- /**
- * Set a key/value object as properties to all matched elements.
- *
- * This serves as the best way to set a large number of properties
- * on all matched elements.
- *
- * @example $("img").attr({ src: "test.jpg", alt: "Test Image" });
- * @before
- * @result
- * @desc Sets src and alt attributes to all images.
- *
- * @name attr
- * @type jQuery
- * @param Map properties Key/value pairs to set as object properties.
- * @cat DOM/Attributes
- */
-
- /**
- * Set a single property to a value, on all matched elements.
- *
- * Note that you can't set the name property of input elements in IE.
- * Use $(html) or .append(html) or .html(html) to create elements
- * on the fly including the name property.
- *
- * @example $("img").attr("src","test.jpg");
- * @before
- * @result
- * @desc Sets src attribute to all images.
- *
- * @name attr
- * @type jQuery
- * @param String key The name of the property to set.
- * @param Object value The value to set the property to.
- * @cat DOM/Attributes
- */
-
- /**
- * Set a single property to a computed value, on all matched elements.
- *
- * Instead of supplying a string value as described
- * [[DOM/Attributes#attr.28_key.2C_value_.29|above]],
- * a function is provided that computes the value.
- *
- * @example $("img").attr("title", function() { return this.src });
- * @before
- * @result
- * @desc Sets title attribute from src attribute.
- *
- * @example $("img").attr("title", function(index) { return this.title + (i + 1); });
- * @before
- * @result
- * @desc Enumerate title attribute.
- *
- * @name attr
- * @type jQuery
- * @param String key The name of the property to set.
- * @param Function value A function returning the value to set.
- * Scope: Current element, argument: Index of current element
- * @cat DOM/Attributes
- */
attr: function( key, value, type ) {
var obj = key;
@@ -487,104 +146,10 @@ jQuery.fn = jQuery.prototype = {
});
},
- /**
- * Access a style property on the first matched element.
- * This method makes it easy to retrieve a style property value
- * from the first matched element.
- *
- * @example $("p").css("color");
- * @before
Test Paragraph.
- * @result "red"
- * @desc Retrieves the color style of the first paragraph
- *
- * @example $("p").css("font-weight");
- * @before
Test Paragraph.
- * @result "bold"
- * @desc Retrieves the font-weight style of the first paragraph.
- *
- * @name css
- * @type String
- * @param String name The name of the property to access.
- * @cat CSS
- */
-
- /**
- * Set a key/value object as style properties to all matched elements.
- *
- * This serves as the best way to set a large number of style properties
- * on all matched elements.
- *
- * @example $("p").css({ color: "red", background: "blue" });
- * @before
Test Paragraph.
- * @result
Test Paragraph.
- * @desc Sets color and background styles to all p elements.
- *
- * @name css
- * @type jQuery
- * @param Map properties Key/value pairs to set as style properties.
- * @cat CSS
- */
-
- /**
- * Set a single style property to a value, on all matched elements.
- * If a number is provided, it is automatically converted into a pixel value.
- *
- * @example $("p").css("color","red");
- * @before
Test Paragraph.
- * @result
Test Paragraph.
- * @desc Changes the color of all paragraphs to red
- *
- * @example $("p").css("left",30);
- * @before
Test Paragraph.
- * @result
Test Paragraph.
- * @desc Changes the left of all paragraphs to "30px"
- *
- * @name css
- * @type jQuery
- * @param String key The name of the property to set.
- * @param String|Number value The value to set the property to.
- * @cat CSS
- */
css: function( key, value ) {
return this.attr( key, value, "curCSS" );
},
- /**
- * Get the text contents of all matched elements. The result is
- * a string that contains the combined text contents of all matched
- * elements. This method works on both HTML and XML documents.
- *
- * @example $("p").text();
- * @before
Test Paragraph.
Paraparagraph
- * @result Test Paragraph.Paraparagraph
- * @desc Gets the concatenated text of all paragraphs
- *
- * @name text
- * @type String
- * @cat DOM/Attributes
- */
-
- /**
- * Set the text contents of all matched elements.
- *
- * Similar to html(), but escapes HTML (replace "<" and ">" with their
- * HTML entities).
- *
- * @example $("p").text("Some new text.");
- * @before
Test Paragraph.
- * @result
<b>Some</b> new text.
- * @desc Sets the text of all paragraphs.
- *
- * @example $("p").text("Some new text.", true);
- * @before
Test Paragraph.
- * @result
Some new text.
- * @desc Sets the text of all paragraphs.
- *
- * @name text
- * @type String
- * @param String val The text value to set the contents of the element to.
- * @cat DOM/Attributes
- */
text: function(e) {
if ( typeof e != "object" && e != null )
return this.empty().append( document.createTextNode( e ) );
@@ -600,52 +165,6 @@ jQuery.fn = jQuery.prototype = {
return t;
},
- /**
- * Wrap all matched elements with a structure of other elements.
- * This wrapping process is most useful for injecting additional
- * stucture into a document, without ruining the original semantic
- * qualities of a document.
- *
- * This works by going through the first element
- * provided (which is generated, on the fly, from the provided HTML)
- * and finds the deepest ancestor element within its
- * structure - it is that element that will en-wrap everything else.
- *
- * This does not work with elements that contain text. Any necessary text
- * must be added after the wrapping is done.
- *
- * @example $("p").wrap("");
- * @before
Test Paragraph.
- * @result
Test Paragraph.
- *
- * @name wrap
- * @type jQuery
- * @param String html A string of HTML, that will be created on the fly and wrapped around the target.
- * @cat DOM/Manipulation
- */
-
- /**
- * Wrap all matched elements with a structure of other elements.
- * This wrapping process is most useful for injecting additional
- * stucture into a document, without ruining the original semantic
- * qualities of a document.
- *
- * This works by going through the first element
- * provided and finding the deepest ancestor element within its
- * structure - it is that element that will en-wrap everything else.
- *
- * This does not work with elements that contain text. Any necessary text
- * must be added after the wrapping is done.
- *
- * @example $("p").wrap( document.getElementById('content') );
- * @before
Test Paragraph.
- * @result
Test Paragraph.
- *
- * @name wrap
- * @type jQuery
- * @param Element elem A DOM element that will be wrapped around the target.
- * @cat DOM/Manipulation
- */
wrapAll: function(html) {
if ( this[0] )
// The elements to wrap the target around
@@ -675,208 +194,40 @@ jQuery.fn = jQuery.prototype = {
});
},
- /**
- * Append content to the inside of every matched element.
- *
- * This operation is similar to doing an appendChild to all the
- * specified elements, adding them into the document.
- *
- * @example $("p").append("Hello");
- * @before
I would like to say:
- * @result
I would like to say: Hello
- * @desc Appends some HTML to all paragraphs.
- *
- * @example $("p").append( $("#foo")[0] );
- * @before
I would like to say:
Hello
- * @result
I would like to say: Hello
- * @desc Appends an Element to all paragraphs.
- *
- * @example $("p").append( $("b") );
- * @before
I would like to say:
Hello
- * @result
I would like to say: Hello
- * @desc Appends a jQuery object (similar to an Array of DOM Elements) to all paragraphs.
- *
- * @name append
- * @type jQuery
- * @param content Content to append to the target
- * @cat DOM/Manipulation
- * @see prepend()
- * @see before()
- * @see after()
- */
append: function() {
return this.domManip(arguments, true, 1, function(a){
this.appendChild( a );
});
},
- /**
- * Prepend content to the inside of every matched element.
- *
- * This operation is the best way to insert elements
- * inside, at the beginning, of all matched elements.
- *
- * @example $("p").prepend("Hello");
- * @before
I would like to say:
- * @result
HelloI would like to say:
- * @desc Prepends some HTML to all paragraphs.
- *
- * @example $("p").prepend( $("#foo")[0] );
- * @before
I would like to say:
Hello
- * @result
HelloI would like to say:
- * @desc Prepends an Element to all paragraphs.
- *
- * @example $("p").prepend( $("b") );
- * @before
I would like to say:
Hello
- * @result
HelloI would like to say:
- * @desc Prepends a jQuery object (similar to an Array of DOM Elements) to all paragraphs.
- *
- * @name prepend
- * @type jQuery
- * @param content Content to prepend to the target.
- * @cat DOM/Manipulation
- * @see append()
- * @see before()
- * @see after()
- */
prepend: function() {
return this.domManip(arguments, true, -1, function(a){
this.insertBefore( a, this.firstChild );
});
},
- /**
- * Insert content before each of the matched elements.
- *
- * @example $("p").before("Hello");
- * @before
I would like to say:
- * @result Hello
I would like to say:
- * @desc Inserts some HTML before all paragraphs.
- *
- * @example $("p").before( $("#foo")[0] );
- * @before
I would like to say:
Hello
- * @result Hello
I would like to say:
- * @desc Inserts an Element before all paragraphs.
- *
- * @example $("p").before( $("b") );
- * @before
I would like to say:
Hello
- * @result Hello
I would like to say:
- * @desc Inserts a jQuery object (similar to an Array of DOM Elements) before all paragraphs.
- *
- * @name before
- * @type jQuery
- * @param content Content to insert before each target.
- * @cat DOM/Manipulation
- * @see append()
- * @see prepend()
- * @see after()
- */
before: function() {
return this.domManip(arguments, false, 1, function(a){
this.parentNode.insertBefore( a, this );
});
},
- /**
- * Insert content after each of the matched elements.
- *
- * @example $("p").after("Hello");
- * @before
I would like to say:
- * @result
I would like to say:
Hello
- * @desc Inserts some HTML after all paragraphs.
- *
- * @example $("p").after( $("#foo")[0] );
- * @before Hello
I would like to say:
- * @result
I would like to say:
Hello
- * @desc Inserts an Element after all paragraphs.
- *
- * @example $("p").after( $("b") );
- * @before Hello
I would like to say:
- * @result
I would like to say:
Hello
- * @desc Inserts a jQuery object (similar to an Array of DOM Elements) after all paragraphs.
- *
- * @name after
- * @type jQuery
- * @param content Content to insert after each target.
- * @cat DOM/Manipulation
- * @see append()
- * @see prepend()
- * @see before()
- */
after: function() {
return this.domManip(arguments, false, -1, function(a){
this.parentNode.insertBefore( a, this.nextSibling );
});
},
- /**
- * Revert the most recent 'destructive' operation, changing the set of matched elements
- * to its previous state (right before the destructive operation).
- *
- * If there was no destructive operation before, an empty set is returned.
- *
- * A 'destructive' operation is any operation that changes the set of
- * matched jQuery elements. These functions are: add,
- * children, clone, filter,
- * find, not, next,
- * parent, parents, prev and siblings.
- *
- * @example $("p").find("span").end();
- * @before
Hello, how are you?
- * @result [
...
]
- * @desc Selects all paragraphs, finds span elements inside these, and reverts the
- * selection back to the paragraphs.
- *
- * @name end
- * @type jQuery
- * @cat DOM/Traversing
- */
end: function() {
return this.prevObject || jQuery([]);
},
- /**
- * Searches for all elements that match the specified expression.
- *
- * This method is a good way to find additional descendant
- * elements with which to process.
- *
- * All searching is done using a jQuery expression. The expression can be
- * written using CSS 1-3 Selector syntax, or basic XPath.
- *
- * @example $("p").find("span");
- * @before
Hello, how are you?
- * @result [ Hello ]
- * @desc Starts with all paragraphs and searches for descendant span
- * elements, same as $("p span")
- *
- * @name find
- * @type jQuery
- * @param String expr An expression to search with.
- * @cat DOM/Traversing
- */
find: function(t) {
var data = jQuery.map(this, function(a){ return jQuery.find(t,a); });
return this.pushStack( /[^+>] [^+>]/.test( t ) || t.indexOf("..") > -1 ?
jQuery.unique( data ) : data );
},
- /**
- * Clone matched DOM Elements and select the clones.
- *
- * This is useful for moving copies of the elements to another
- * location in the DOM.
- *
- * @example $("b").clone().prependTo("p");
- * @before Hello
, how are you?
- * @result Hello
Hello, how are you?
- * @desc Clones all b elements (and selects the clones) and prepends them to all paragraphs.
- *
- * @name clone
- * @type jQuery
- * @param Boolean deep (Optional) Set to false if you don't want to clone all descendant nodes, in addition to the element itself.
- * @cat DOM/Manipulation
- */
clone: function(deep) {
deep = deep != undefined ? deep : true;
var $this = this.add(this.find("*"));
@@ -920,46 +271,6 @@ jQuery.fn = jQuery.prototype = {
return r;
},
- /**
- * Removes all elements from the set of matched elements that do not
- * match the specified expression(s). This method is used to narrow down
- * the results of a search.
- *
- * Provide a comma-separated list of expressions to apply multiple filters at once.
- *
- * @example $("p").filter(".selected")
- * @before
Hello
How are you?
- * @result [
Hello
]
- * @desc Selects all paragraphs and removes those without a class "selected".
- *
- * @example $("p").filter(".selected, :first")
- * @before
Hello
Hello Again
And Again
- * @result [
Hello
,
And Again
]
- * @desc Selects all paragraphs and removes those without class "selected" and being the first one.
- *
- * @name filter
- * @type jQuery
- * @param String expression Expression(s) to search with.
- * @cat DOM/Traversing
- */
-
- /**
- * Removes all elements from the set of matched elements that do not
- * pass the specified filter. This method is used to narrow down
- * the results of a search.
- *
- * @example $("p").filter(function(index) {
- * return $("ol", this).length == 0;
- * })
- * @before
Hello
How are you?
- * @result [
How are you?
]
- * @desc Remove all elements that have a child ol element
- *
- * @name filter
- * @type jQuery
- * @param Function filter A function to use for filtering
- * @cat DOM/Traversing
- */
filter: function(t) {
return this.pushStack(
jQuery.isFunction( t ) &&
@@ -970,55 +281,6 @@ jQuery.fn = jQuery.prototype = {
jQuery.multiFilter(t,this) );
},
- /**
- * Removes the specified Element from the set of matched elements. This
- * method is used to remove a single Element from a jQuery object.
- *
- * @example $("p").not( $("#selected")[0] )
- * @before
Hello
Hello Again
- * @result [
Hello
]
- * @desc Removes the element with the ID "selected" from the set of all paragraphs.
- *
- * @name not
- * @type jQuery
- * @param Element el An element to remove from the set
- * @cat DOM/Traversing
- */
-
- /**
- * Removes elements matching the specified expression from the set
- * of matched elements. This method is used to remove one or more
- * elements from a jQuery object.
- *
- * @example $("p").not("#selected")
- * @before
Hello
Hello Again
- * @result [
Hello
]
- * @desc Removes the element with the ID "selected" from the set of all paragraphs.
- *
- * @name not
- * @type jQuery
- * @param String expr An expression with which to remove matching elements
- * @cat DOM/Traversing
- */
-
- /**
- * Removes any elements inside the array of elements from the set
- * of matched elements. This method is used to remove one or more
- * elements from a jQuery object.
- *
- * Please note: the expression cannot use a reference to the
- * element name. See the two examples below.
- *
- * @example $("p").not( $("div p.selected") )
- * @before
Hello
Hello Again
- * @result [
Hello
]
- * @desc Removes all elements that match "div p.selected" from the total set of all paragraphs.
- *
- * @name not
- * @type jQuery
- * @param jQuery elems A set of elements to remove from the jQuery set of matched elements.
- * @cat DOM/Traversing
- */
not: function(t) {
return this.pushStack(
t.constructor == String &&
@@ -1032,54 +294,6 @@ jQuery.fn = jQuery.prototype = {
);
},
- /**
- * Adds more elements, matched by the given expression,
- * to the set of matched elements.
- *
- * @example $("p").add("span")
- * @before (HTML)
, Hello Again ]
- * @desc Compare the above result to the result of $('p'),
- * which would just result in [
Hello
].
- * Using add(), matched elements of $('span') are simply
- * added to the returned jQuery-object.
- *
- * @name add
- * @type jQuery
- * @param String expr An expression whose matched elements are added
- * @cat DOM/Traversing
- */
-
- /**
- * Adds more elements, created on the fly, to the set of
- * matched elements.
- *
- * @example $("p").add("Again")
- * @before
Hello
- * @result [
Hello
, Again ]
- *
- * @name add
- * @type jQuery
- * @param String html A string of HTML to create on the fly.
- * @cat DOM/Traversing
- */
-
- /**
- * Adds one or more Elements to the set of matched elements.
- *
- * @example $("p").add( document.getElementById("a") )
- * @before
, , ]
- *
- * @name add
- * @type jQuery
- * @param Element|Array elements One or more Elements to add
- * @cat DOM/Traversing
- */
add: function(t) {
return this.pushStack( jQuery.merge(
this.get(),
@@ -1090,97 +304,16 @@ jQuery.fn = jQuery.prototype = {
);
},
- /**
- * Checks the current selection against an expression and returns true,
- * if at least one element of the selection fits the given expression.
- *
- * Does return false, if no element fits or the expression is not valid.
- *
- * filter(String) is used internally, therefore all rules that apply there
- * apply here, too.
- *
- * @example $("input[@type='checkbox']").parent().is("form")
- * @before
- * @result true
- * @desc Returns true, because the parent of the input is a form element
- *
- * @example $("input[@type='checkbox']").parent().is("form")
- * @before
- * @result false
- * @desc Returns false, because the parent of the input is a p element
- *
- * @name is
- * @type Boolean
- * @param String expr The expression with which to filter
- * @cat DOM/Traversing
- */
is: function(expr) {
return expr ? jQuery.multiFilter(expr,this).length > 0 : false;
},
- /**
- * Get the content of the value attribute of the first matched element.
- *
- * Use caution when relying on this function to check the value of
- * multiple-select elements and checkboxes in a form. While it will
- * still work as intended, it may not accurately represent the value
- * the server will receive because these elements may send an array
- * of values. For more robust handling of field values, see the
- * [http://www.malsup.com/jquery/form/#fields fieldValue function of the Form Plugin].
- *
- * @example $("input").val();
- * @before
- * @result "some text"
- *
- * @name val
- * @type String
- * @cat DOM/Attributes
- */
-
- /**
- * Set the value attribute of every matched element.
- *
- * @example $("input").val("test");
- * @before
- * @result
- *
- * @name val
- * @type jQuery
- * @param String val Set the property to the specified value.
- * @cat DOM/Attributes
- */
val: function( val ) {
return val == undefined ?
( this.length ? this[0].value : null ) :
this.attr( "value", val );
},
- /**
- * Get the html contents of the first matched element.
- * This property is not available on XML documents.
- *
- * @example $("div").html();
- * @before
- * @result
- *
- * @name html
- * @type String
- * @cat DOM/Attributes
- */
-
- /**
- * Set the html contents of every matched element.
- * This property is not available on XML documents.
- *
- * @example $("div").html("new stuff");
- * @before
- * @result
new stuff
- *
- * @name html
- * @type jQuery
- * @param String val Set the html contents to the specified value.
- * @cat DOM/Attributes
- */
html: function( val ) {
return val == undefined ?
( this.length ? this[0].innerHTML : null ) :
@@ -1201,16 +334,6 @@ jQuery.fn = jQuery.prototype = {
}));
},
- /**
- * @private
- * @name domManip
- * @param Array args
- * @param Boolean table Insert TBODY in TABLEs if one is not found.
- * @param Number dir If dir<0, process args in reverse order.
- * @param Function fn The function doing the DOM manipulation.
- * @type jQuery
- * @cat Core
- */
domManip: function(args, table, dir, fn){
var clone = this.length > 1, a;
@@ -1239,57 +362,6 @@ jQuery.fn = jQuery.prototype = {
}
};
-/**
- * Extends the jQuery object itself. Can be used to add functions into
- * the jQuery namespace and to [[Plugins/Authoring|add plugin methods]] (plugins).
- *
- * @example jQuery.fn.extend({
- * check: function() {
- * return this.each(function() { this.checked = true; });
- * },
- * uncheck: function() {
- * return this.each(function() { this.checked = false; });
- * }
- * });
- * $("input[@type=checkbox]").check();
- * $("input[@type=radio]").uncheck();
- * @desc Adds two plugin methods.
- *
- * @example jQuery.extend({
- * min: function(a, b) { return a < b ? a : b; },
- * max: function(a, b) { return a > b ? a : b; }
- * });
- * @desc Adds two functions into the jQuery namespace
- *
- * @name $.extend
- * @param Object prop The object that will be merged into the jQuery object
- * @type Object
- * @cat Core
- */
-
-/**
- * Extend one object with one or more others, returning the original,
- * modified, object. This is a great utility for simple inheritance.
- *
- * @example var settings = { validate: false, limit: 5, name: "foo" };
- * var options = { validate: true, name: "bar" };
- * jQuery.extend(settings, options);
- * @result settings == { validate: true, limit: 5, name: "bar" }
- * @desc Merge settings and options, modifying settings
- *
- * @example var defaults = { validate: false, limit: 5, name: "foo" };
- * var options = { validate: true, name: "bar" };
- * var settings = jQuery.extend({}, defaults, options);
- * @result settings == { validate: true, limit: 5, name: "bar" }
- * @desc Merge defaults and options, without modifying the defaults
- *
- * @name $.extend
- * @param Object target The object to extend
- * @param Object prop1 The object that will be merged into the first.
- * @param Object propN (optional) More objects to merge into the first
- * @type Object
- * @cat JavaScript
- */
jQuery.extend = jQuery.fn.extend = function() {
// copy reference to target object
var target = arguments[0] || {}, a = 1, al = arguments.length, deep = false;
@@ -1331,40 +403,6 @@ jQuery.extend = jQuery.fn.extend = function() {
};
jQuery.extend({
- /**
- * Run this function to give control of the $ variable back
- * to whichever library first implemented it. This helps to make
- * sure that jQuery doesn't conflict with the $ object
- * of other libraries.
- *
- * By using this function, you will only be able to access jQuery
- * using the 'jQuery' variable. For example, where you used to do
- * $("div p"), you now must do jQuery("div p").
- *
- * @example jQuery.noConflict();
- * // Do something with jQuery
- * jQuery("div p").hide();
- * // Do something with another library's $()
- * $("content").style.display = 'none';
- * @desc Maps the original object that was referenced by $ back to $
- *
- * @example jQuery.noConflict();
- * (function($) {
- * $(function() {
- * // more code using $ as alias to jQuery
- * });
- * })(jQuery);
- * // other code using $ as an alias to the other library
- * @desc Reverts the $ alias and then creates and executes a
- * function to provide the $ as a jQuery alias inside the functions
- * scope. Inside the function the original $ object is not available.
- * This works well for most plugins that don't rely on any other library.
- *
- *
- * @name $.noConflict
- * @type undefined
- * @cat Core
- */
noConflict: function(deep) {
window.$ = _$;
if ( deep )
@@ -1404,34 +442,6 @@ jQuery.extend({
return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
},
- /**
- * A generic iterator function, which can be used to seamlessly
- * iterate over both objects and arrays. This function is not the same
- * as $().each() - which is used to iterate, exclusively, over a jQuery
- * object. This function can be used to iterate over anything.
- *
- * The callback has two arguments:the key (objects) or index (arrays) as first
- * the first, and the value as the second.
- *
- * @example $.each( [0,1,2], function(i, n){
- * alert( "Item #" + i + ": " + n );
- * });
- * @desc This is an example of iterating over the items in an array,
- * accessing both the current item and its index.
- *
- * @example $.each( { name: "John", lang: "JS" }, function(i, n){
- * alert( "Name: " + i + ", Value: " + n );
- * });
- *
- * @desc This is an example of iterating over the properties in an
- * Object, accessing both the current item and its key.
- *
- * @name $.each
- * @param Object obj The object, or array, to iterate over.
- * @param Function fn The function that will be executed on every object.
- * @type Object
- * @cat JavaScript
- */
// args is for internal usage only
each: function( obj, fn, args ) {
if ( args ) {
@@ -1492,10 +502,6 @@ jQuery.extend({
}
},
- /**
- * Swap in/out style options.
- * @private
- */
swap: function(e,o,f) {
for ( var i in o ) {
e.style["old"+i] = e.style[i];
@@ -1753,17 +759,6 @@ jQuery.extend({
}
},
- /**
- * Remove the whitespace from the beginning and end of a string.
- *
- * @example $.trim(" hello, how are you? ");
- * @result "hello, how are you?"
- *
- * @name $.trim
- * @type String
- * @param String str The string to trim.
- * @cat JavaScript
- */
trim: function(t){
return (t||"").replace(/^\s+|\s+$/g, "");
},
@@ -1788,19 +783,6 @@ jQuery.extend({
return -1;
},
- /**
- * Merge two arrays together by concatenating them.
- *
- * @example $.merge( [0,1,2], [2,3,4] )
- * @result [0,1,2,2,3,4]
- * @desc Merges two arrays.
- *
- * @name $.merge
- * @type Array
- * @param Array first The first array to merge, the elements of second are added.
- * @param Array second The second array to append to the first, unaltered.
- * @cat JavaScript
- */
merge: function(first, second) {
// We have to loop this way because IE & Opera overwrite the length
// expando of getElementsByTagName
@@ -1818,18 +800,6 @@ jQuery.extend({
return first;
},
- /**
- * Reduce an array (of jQuery objects only) to its unique elements.
- *
- * @example $.unique( [x1, x2, x3, x2, x3] )
- * @result [x1, x2, x3]
- * @desc Reduces the arrays of jQuery objects to unique elements by removing the duplicates of x2 and x3
- *
- * @name $.unique
- * @type Array
- * @param Array array The array to reduce to its unique jQuery objects.
- * @cat JavaScript
- */
unique: function(first) {
var r = [], num = jQuery.mergeNum++;
@@ -1848,26 +818,6 @@ jQuery.extend({
mergeNum: 0,
- /**
- * Filter items out of an array, by using a filter function.
- *
- * The specified function will be passed two arguments: The
- * current array item and the index of the item in the array. The
- * function must return 'true' to keep the item in the array,
- * false to remove it.
- *
- * @example $.grep( [0,1,2], function(i){
- * return i > 0;
- * });
- * @result [1, 2]
- *
- * @name $.grep
- * @type Array
- * @param Array array The Array to find items in.
- * @param Function fn The function to process each item against.
- * @param Boolean inv Invert the selection - select the opposite of the function.
- * @cat JavaScript
- */
grep: function(elems, fn, inv) {
// If a string is passed in for the function, make a function
// for it (a handy shortcut)
@@ -1885,43 +835,6 @@ jQuery.extend({
return result;
},
- /**
- * Translate all items in an array to another array of items.
- *
- * The translation function that is provided to this method is
- * called for each item in the array and is passed one argument:
- * The item to be translated.
- *
- * The function can then return the translated value, 'null'
- * (to remove the item), or an array of values - which will
- * be flattened into the full array.
- *
- * @example $.map( [0,1,2], function(i){
- * return i + 4;
- * });
- * @result [4, 5, 6]
- * @desc Maps the original array to a new one and adds 4 to each value.
- *
- * @example $.map( [0,1,2], function(i){
- * return i > 0 ? i + 1 : null;
- * });
- * @result [2, 3]
- * @desc Maps the original array to a new one and adds 1 to each
- * value if it is bigger then zero, otherwise it's removed-
- *
- * @example $.map( [0,1,2], function(i){
- * return [ i, i + 1 ];
- * });
- * @result [0, 1, 1, 2, 2, 3]
- * @desc Maps the original array to a new one, each element is added
- * with it's original value and the value plus one.
- *
- * @name $.map
- * @type Array
- * @param Array array The Array to translate.
- * @param Function fn The function to process each item against.
- * @cat JavaScript
- */
map: function(elems, fn) {
// If a string is passed in for the function, make a function
// for it (a handy shortcut)
@@ -1945,38 +858,6 @@ jQuery.extend({
}
});
-/**
- * Contains flags for the useragent, read from navigator.userAgent.
- * Available flags are: safari, opera, msie, mozilla
- *
- * This property is available before the DOM is ready, therefore you can
- * use it to add ready events only for certain browsers.
- *
- * There are situations where object detections is not reliable enough, in that
- * cases it makes sense to use browser detection. Simply try to avoid both!
- *
- * A combination of browser and object detection yields quite reliable results.
- *
- * @example $.browser.msie
- * @desc Returns true if the current useragent is some version of microsoft's internet explorer
- *
- * @example if($.browser.safari) { $( function() { alert("this is safari!"); } ); }
- * @desc Alerts "this is safari!" only for safari browsers
- *
- * @property
- * @name $.browser
- * @type Boolean
- * @cat JavaScript
- */
-
-/*
- * Whether the W3C compliant box model is being used.
- *
- * @property
- * @name $.boxModel
- * @type Boolean
- * @cat JavaScript
- */
var userAgent = navigator.userAgent.toLowerCase();
// Figure out what browser is being used
@@ -2013,143 +894,6 @@ jQuery.extend({
}
});
-/**
- * Get a set of elements containing the unique parents of the matched
- * set of elements.
- *
- * You may use an optional expression to filter the set of parent elements that will match.
- *
- * @example $("p").parent()
- * @before
Hello
Hello
- * @result [
Hello
Hello
]
- * @desc Find the parent element of each paragraph.
- *
- * @example $("p").parent(".selected")
- * @before
Hello
Hello Again
- * @result [
Hello Again
]
- * @desc Find the parent element of each paragraph with a class "selected".
- *
- * @name parent
- * @type jQuery
- * @param String expr (optional) An expression to filter the parents with
- * @cat DOM/Traversing
- */
-
-/**
- * Get a set of elements containing the unique ancestors of the matched
- * set of elements (except for the root element).
- *
- * The matched elements can be filtered with an optional expression.
- *
- * @example $("span").parents()
- * @before
Hello
Hello Again
- * @result [ ...,
...
,
Hello
]
- * @desc Find all parent elements of each span.
- *
- * @example $("span").parents("p")
- * @before
Hello
Hello Again
- * @result [
Hello
]
- * @desc Find all parent elements of each span that is a paragraph.
- *
- * @name parents
- * @type jQuery
- * @param String expr (optional) An expression to filter the ancestors with
- * @cat DOM/Traversing
- */
-
-/**
- * Get a set of elements containing the unique next siblings of each of the
- * matched set of elements.
- *
- * It only returns the very next sibling for each element, not all
- * next siblings.
- *
- * You may provide an optional expression to filter the match.
- *
- * @example $("p").next()
- * @before
Hello
Hello Again
And Again
- * @result [
Hello Again
,
And Again
]
- * @desc Find the very next sibling of each paragraph.
- *
- * @example $("p").next(".selected")
- * @before
Hello
Hello Again
And Again
- * @result [
Hello Again
]
- * @desc Find the very next sibling of each paragraph that has a class "selected".
- *
- * @name next
- * @type jQuery
- * @param String expr (optional) An expression to filter the next Elements with
- * @cat DOM/Traversing
- */
-
-/**
- * Get a set of elements containing the unique previous siblings of each of the
- * matched set of elements.
- *
- * Use an optional expression to filter the matched set.
- *
- * Only the immediately previous sibling is returned, not all previous siblings.
- *
- * @example $("p").prev()
- * @before
Hello
Hello Again
And Again
- * @result [
Hello Again
]
- * @desc Find the very previous sibling of each paragraph.
- *
- * @example $("p").prev(".selected")
- * @before
Hello
Hello Again
And Again
- * @result [
Hello
]
- * @desc Find the very previous sibling of each paragraph that has a class "selected".
- *
- * @name prev
- * @type jQuery
- * @param String expr (optional) An expression to filter the previous Elements with
- * @cat DOM/Traversing
- */
-
-/**
- * Get a set of elements containing all of the unique siblings of each of the
- * matched set of elements.
- *
- * Can be filtered with an optional expressions.
- *
- * @example $("div").siblings()
- * @before
Hello
Hello Again
And Again
- * @result [
Hello
,
And Again
]
- * @desc Find all siblings of each div.
- *
- * @example $("div").siblings(".selected")
- * @before
Hello
Hello Again
And Again
- * @result [
Hello Again
]
- * @desc Find all siblings with a class "selected" of each div.
- *
- * @name siblings
- * @type jQuery
- * @param String expr (optional) An expression to filter the sibling Elements with
- * @cat DOM/Traversing
- */
-
-/**
- * Get a set of elements containing all of the unique children of each of the
- * matched set of elements.
- *
- * This set can be filtered with an optional expression that will cause
- * only elements matching the selector to be collected.
- *
- * @example $("div").children()
- * @before
Hello
Hello Again
And Again
- * @result [ Hello Again ]
- * @desc Find all children of each div.
- *
- * @example $("div").children(".selected")
- * @before
Hello
Hello Again
And Again
- * @result [
Hello Again
]
- * @desc Find all children with a class "selected" of each div.
- *
- * @name children
- * @type jQuery
- * @param String expr (optional) An expression to filter the child Elements with
- * @cat DOM/Traversing
- */
jQuery.each({
parent: "a.parentNode",
parents: "jQuery.parents(a)",
@@ -2167,78 +911,6 @@ jQuery.each({
};
});
-/**
- * Append all of the matched elements to another, specified, set of elements.
- * This operation is, essentially, the reverse of doing a regular
- * $(A).append(B), in that instead of appending B to A, you're appending
- * A to B.
- *
- * @example $("p").appendTo("#foo");
- * @before
I would like to say:
- * @result
I would like to say:
- * @desc Appends all paragraphs to the element with the ID "foo"
- *
- * @name appendTo
- * @type jQuery
- * @param content Content to append to the selected element to.
- * @cat DOM/Manipulation
- * @see append()
- */
-
-/**
- * Prepend all of the matched elements to another, specified, set of elements.
- * This operation is, essentially, the reverse of doing a regular
- * $(A).prepend(B), in that instead of prepending B to A, you're prepending
- * A to B.
- *
- * @example $("p").prependTo("#foo");
- * @before
I would like to say:
Hello
- * @result
I would like to say:
Hello
- * @desc Prepends all paragraphs to the element with the ID "foo"
- *
- * @name prependTo
- * @type jQuery
- * @param content Content to prepend to the selected element to.
- * @cat DOM/Manipulation
- * @see prepend()
- */
-
-/**
- * Insert all of the matched elements before another, specified, set of elements.
- * This operation is, essentially, the reverse of doing a regular
- * $(A).before(B), in that instead of inserting B before A, you're inserting
- * A before B.
- *
- * @example $("p").insertBefore("#foo");
- * @before
Hello
I would like to say:
- * @result
I would like to say:
Hello
- * @desc Same as $("#foo").before("p")
- *
- * @name insertBefore
- * @type jQuery
- * @param content Content to insert the selected element before.
- * @cat DOM/Manipulation
- * @see before()
- */
-
-/**
- * Insert all of the matched elements after another, specified, set of elements.
- * This operation is, essentially, the reverse of doing a regular
- * $(A).after(B), in that instead of inserting B after A, you're inserting
- * A after B.
- *
- * @example $("p").insertAfter("#foo");
- * @before
I would like to say:
Hello
- * @result
Hello
I would like to say:
- * @desc Same as $("#foo").after("p")
- *
- * @name insertAfter
- * @type jQuery
- * @param content Content to insert the selected element after.
- * @cat DOM/Manipulation
- * @see after()
- */
-
jQuery.each({
appendTo: "append",
prependTo: "prepend",
@@ -2255,105 +927,6 @@ jQuery.each({
};
});
-/**
- * Remove an attribute from each of the matched elements.
- *
- * @example $("input").removeAttr("disabled")
- * @before
- * @result
- *
- * @name removeAttr
- * @type jQuery
- * @param String name The name of the attribute to remove.
- * @cat DOM/Attributes
- */
-
-/**
- * Adds the specified class(es) to each of the set of matched elements.
- *
- * @example $("p").addClass("selected")
- * @before
]
- *
- * @name addClass
- * @type jQuery
- * @param String class One or more CSS classes to add to the elements
- * @cat DOM/Attributes
- * @see removeClass(String)
- */
-
-/**
- * Removes all or the specified class(es) from the set of matched elements.
- *
- * @example $("p").removeClass()
- * @before
]
- *
- * @name removeClass
- * @type jQuery
- * @param String class (optional) One or more CSS classes to remove from the elements
- * @cat DOM/Attributes
- * @see addClass(String)
- */
-
-/**
- * Adds the specified class if it is not present, removes it if it is
- * present.
- *
- * @example $("p").toggleClass("selected")
- * @before
Hello
Hello Again
- * @result [
Hello
,
Hello Again
]
- *
- * @name toggleClass
- * @type jQuery
- * @param String class A CSS class with which to toggle the elements
- * @cat DOM/Attributes
- */
-
-/**
- * Removes all matched elements from the DOM. This does NOT remove them from the
- * jQuery object, allowing you to use the matched elements further.
- *
- * Can be filtered with an optional expressions.
- *
- * @example $("p").remove();
- * @before
Hello
how are
you?
- * @result how are
- *
- * @example $("p").remove(".hello");
- * @before
Hello
how are
you?
- * @result how are
you?
- *
- * @name remove
- * @type jQuery
- * @param String expr (optional) A jQuery expression to filter elements by.
- * @cat DOM/Manipulation
- */
-
-/**
- * Removes all child nodes from the set of matched elements.
- *
- * @example $("p").empty()
- * @before
- * @result [ ]
- *
- * @name empty
- * @type jQuery
- * @cat DOM/Manipulation
- */
-
jQuery.each( {
removeAttr: function( key ) {
jQuery.attr( this, key, "" );
@@ -2382,63 +955,6 @@ jQuery.each( {
};
});
-/**
- * Reduce the set of matched elements to a single element.
- * The position of the element in the set of matched elements
- * starts at 0 and goes to length - 1.
- *
- * @example $("p").eq(1)
- * @before
This is just a test.
So is this
- * @result [
So is this
]
- *
- * @name eq
- * @type jQuery
- * @param Number pos The index of the element that you wish to limit to.
- * @cat Core
- */
-
-/**
- * Reduce the set of matched elements to all elements before a given position.
- * The position of the element in the set of matched elements
- * starts at 0 and goes to length - 1.
- *
- * @example $("p").lt(1)
- * @before
This is just a test.
So is this
- * @result [
This is just a test.
]
- *
- * @name lt
- * @type jQuery
- * @param Number pos Reduce the set to all elements below this position.
- * @cat Core
- */
-
-/**
- * Reduce the set of matched elements to all elements after a given position.
- * The position of the element in the set of matched elements
- * starts at 0 and goes to length - 1.
- *
- * @example $("p").gt(0)
- * @before
This is just a test.
So is this
- * @result [
So is this
]
- *
- * @name gt
- * @type jQuery
- * @param Number pos Reduce the set to all elements after this position.
- * @cat Core
- */
-
-/**
- * Filter the set of elements to those that contain the specified text.
- *
- * @example $("p").contains("test")
- * @before
This is just a test.
So is this
- * @result [
This is just a test.
]
- *
- * @name contains
- * @type jQuery
- * @param String str The string that will be contained within the text of an element.
- * @cat DOM/Traversing
- */
// DEPRECATED
jQuery.each( [ "eq", "lt", "gt", "contains" ], function(i,n){
jQuery.fn[ n ] = function(num,fn) {
@@ -2446,66 +962,6 @@ jQuery.each( [ "eq", "lt", "gt", "contains" ], function(i,n){
};
});
-/**
- * Get the current computed, pixel, width of the first matched element.
- *
- * @example $("p").width();
- * @before
This is just a test.
- * @result 300
- *
- * @name width
- * @type String
- * @cat CSS
- */
-
-/**
- * Set the CSS width of every matched element. If no explicit unit
- * was specified (like 'em' or '%') then "px" is added to the width.
- *
- * @example $("p").width(20);
- * @before
- *
- * @name width
- * @type jQuery
- * @param String|Number val Set the CSS property to the specified value.
- * @cat CSS
- */
-
-/**
- * Get the current computed, pixel, height of the first matched element.
- *
- * @example $("p").height();
- * @before
This is just a test.
- * @result 300
- *
- * @name height
- * @type String
- * @cat CSS
- */
-
-/**
- * Set the CSS height of every matched element. If no explicit unit
- * was specified (like 'em' or '%') then "px" is added to the width.
- *
- * @example $("p").height(20);
- * @before
- *
- * @name height
- * @type jQuery
- * @param String|Number val Set the CSS property to the specified value.
- * @cat CSS
- */
-
jQuery.each( [ "height", "width" ], function(i,n){
jQuery.fn[ n ] = function(h) {
return h == undefined ?
diff --git a/src/selector/selector.js b/src/selector/selector.js
index f75bae3c4..4a5789337 100644
--- a/src/selector/selector.js
+++ b/src/selector/selector.js
@@ -94,12 +94,6 @@ jQuery.extend({
return cur;
},
- /**
- * @name $.find
- * @type Array
- * @private
- * @cat Core
- */
find: function( t, context ) {
// Quickly handle non-string expressions
if ( typeof t != "string" )
@@ -427,15 +421,6 @@ jQuery.extend({
return { r: r, t: t };
},
- /**
- * All ancestors of a given element.
- *
- * @private
- * @name $.parents
- * @type Array
- * @param Element elem The element to find the ancestors of.
- * @cat DOM/Traversing
- */
parents: function( elem ){
var matched = [];
var cur = elem.parentNode;
@@ -446,18 +431,6 @@ jQuery.extend({
return matched;
},
- /**
- * A handy, and fast, way to traverse in a particular direction and find
- * a specific element.
- *
- * @private
- * @name $.nth
- * @type DOMElement
- * @param DOMElement cur The element to search from.
- * @param String|Number num The Nth result to match. Can be a number or a string (like 'even' or 'odd').
- * @param String dir The direction to move in (pass in something like 'previousSibling' or 'nextSibling').
- * @cat DOM/Traversing
- */
nth: function(cur,result,dir,elem){
result = result || 1;
var num = 0;
@@ -469,15 +442,6 @@ jQuery.extend({
return cur;
},
- /**
- * All elements on a specified axis.
- *
- * @private
- * @name $.sibling
- * @type Array
- * @param Element elem The element to find all the siblings of (including itself).
- * @cat DOM/Traversing
- */
sibling: function( n, elem ) {
var r = [];
--
2.39.5