diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ba9f6b8f..9a004cd3 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,5 +1,5 @@
-Welcome! Thanks for your interest in contributing to api.jquery.com. You're **almost** in the right place. More information on how to contribute to this and all other jQuery Foundation projects is over at [contribute.jquery.org](http://contribute.jquery.org). You'll definitely want to take a look at the articles on contributing [documentation](http://contribute.jquery.org/documentation).
+Welcome! Thanks for your interest in contributing to api.jquery.com. You're **almost** in the right place. More information on how to contribute to this and all other jQuery Foundation projects is over at [contribute.jquery.org](https://contribute.jquery.org). You'll definitely want to take a look at the articles on contributing [documentation](https://contribute.jquery.org/documentation).
-You may also want to take a look at our [commit & pull request guide](http://contribute.jquery.org/commits-and-pull-requests/) and [style guides](http://contribute.jquery.org/style-guide/) for instructions on how to maintain your fork and submit your code. Before we can merge any pull request, we'll also need you to sign our [contributor license agreement](http://contribute.jquery.org/cla).
+You may also want to take a look at our [commit & pull request guide](https://contribute.jquery.org/commits-and-pull-requests/) and [style guides](https://contribute.jquery.org/style-guide/) for instructions on how to maintain your fork and submit your code. Before we can merge any pull request, we'll also need you to sign our [contributor license agreement](https://contribute.jquery.org/cla).
-You can find us on [IRC](http://irc.jquery.org), specifically in #jquery-dev and #jquery-content should you have any questions. If you've never contributed to open source before, we've put together [a short guide with tips, tricks, and ideas on getting started](http://contribute.jquery.org/open-source/).
+You can find us on [IRC](https://irc.jquery.org), specifically in #jquery-dev and #jquery-content should you have any questions. If you've never contributed to open source before, we've put together [a short guide with tips, tricks, and ideas on getting started](https://contribute.jquery.org/open-source/).
diff --git a/README.md b/README.md
index 805e0442..f7920803 100644
--- a/README.md
+++ b/README.md
@@ -2,14 +2,14 @@
## Building and Deploying
-To build and deploy your changes for previewing in a [`jquery-wp-content`](https://github.com/jquery/jquery-wp-content) instance, follow the [workflow instructions](http://contribute.jquery.org/web-sites/#workflow) from our documentation on [contributing to jQuery Foundation web sites](http://contribute.jquery.org/web-sites/).
+To build and deploy your changes for previewing in a [`jquery-wp-content`](https://github.com/jquery/jquery-wp-content) instance, follow the [workflow instructions](https://contribute.jquery.org/web-sites/#workflow) from our documentation on [contributing to jQuery Foundation web sites](https://contribute.jquery.org/web-sites/).
### Requirements
* [libxml2](http://xmlsoft.org/)
* [libxslt](http://xmlsoft.org/libxslt/)
-The `xmllint` and `xsltproc` utilities need to be in your path. If you are on Windows, you can get libxml2 and libxslt from zlatkovic.com.
+The `xmllint` and `xsltproc` utilities need to be in your path. If you are on Windows, you can get libxml2 and libxslt from zlatkovic.com.
**Note**: If you're using Windows and you receive the error "Error" when executing the task `build-xml-entries:all`, try to add the DLL `libwinpthread-1.dll` in the root of the project.
@@ -49,7 +49,7 @@ The `xmllint` and `xsltproc` utilities need to be in your path. If you are on Wi
### Code Style
-Code in the API documentation should follow the [jQuery Core Style Guide](http://contribute.jquery.org/style-guide/) with the following addition:
+Code in the API documentation should follow the [jQuery Core Style Guide](https://contribute.jquery.org/style-guide/) with the following addition:
* **Document ready syntax**: Use `$( document ).ready(function() {` instead of `$(function() {` as it's harder for new users to distinguish the difference between the latter and an IIFE.
diff --git a/categories.xml b/categories.xml
index d43d8929..369353c2 100644
--- a/categories.xml
+++ b/categories.xml
@@ -38,7 +38,7 @@
.attr()
, .html()
, and .val()
—also act as "getters," retrieving information from DOM elements for later use.
+ ]]>
\\
. For example, an element with id="foo.bar"
, can use the selector $("#foo\\.bar")
. The W3C CSS specification contains the complete set of rules regarding valid CSS selectors. Also useful is the blog entry by Mathias Bynens on CSS character escape sequences for identifiers.
To use any of the meta-characters ( such as !"#$%&'()*+,./:;<=>?@[\]^`{|}~
) as a literal part of a name, it must be escaped with with two backslashes: \\
. For example, an element with id="foo.bar"
, can use the selector $("#foo\\.bar")
. The W3C CSS specification contains the complete set of rules regarding valid CSS selectors. Also useful is the blog entry by Mathias Bynens on CSS character escape sequences for identifiers.
The opacity
of the image is already at its target value, so this property is not animated by the second click. Since the target value for left
is a relative value, the image moves even farther to the right during this second animation.
Directional properties (top
, right
, bottom
, left
) have no discernible effect on elements if their position
style property is static
, which it is by default.
Note: The jQuery UI project extends the .animate()
method by allowing some non-numeric styles such as colors to be animated. The project also includes mechanisms for specifying animations through CSS classes rather than individual attributes.
Note: The jQuery UI project extends the .animate()
method by allowing some non-numeric styles such as colors to be animated. The project also includes mechanisms for specifying animations through CSS classes rather than individual attributes.
Note: if attempting to animate an element with a height or width of 0px, where contents of the element are visible due to overflow, jQuery may clip this overflow during animation. By fixing the dimensions of the original element being hidden however, it is possible to ensure that the animation runs smoothly. A clearfix can be used to automatically fix the dimensions of your main element without the need to set this manually.
+Note: if attempting to animate an element with a height or width of 0px, where contents of the element are visible due to overflow, jQuery may clip this overflow during animation. By fixing the dimensions of the original element being hidden however, it is possible to ensure that the animation runs smoothly. A clearfix can be used to automatically fix the dimensions of your main element without the need to set this manually.
The second version of .animate()
provides a step
option — a callback function that is fired at each step of the animation. This function is useful for enabling custom animation types or altering the animation as it is occurring. It accepts two arguments (now
and fx
), and this
is set to the DOM element being animated.
The remaining parameter of .animate()
is a string naming an easing function to use. An easing function specifies the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called swing
, and one that progresses at a constant pace, called linear
. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.
The remaining parameter of .animate()
is a string naming an easing function to use. An easing function specifies the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called swing
, and one that progresses at a constant pace, called linear
. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.
As of jQuery version 1.4, you can set per-property easing functions within a single .animate()
call. In the first version of .animate()
, each property can take an array as its value: The first member of the array is the CSS property and the second member is an easing function. If a per-property easing function is not defined for a particular property, it uses the value of the .animate()
method's optional easing argument. If the easing argument is not defined, the default swing
function is used.
For example, to simultaneously animate the width and height with the swing
easing function and the opacity with the linear
easing function:
The second statement of the code above correctly refers to the data-last-value
attribute of the element. In case no data is stored with the passed key, jQuery searches among the attributes of the element, converting a camel-cased string into a dashed string and then prepending data-
to the result. So, the string lastValue
is converted to data-last-value
.
Every attempt is made to convert the string to a JavaScript value (this includes booleans, numbers, objects, arrays, and null). A value is only converted to a number if doing so doesn't change the value's representation. For example, "1E02" and "100.000" are equivalent as numbers (numeric value 100) but converting them would alter their representation so they are left as strings. The string value "100" is converted to the number 100.
-When the data attribute is an object (starts with '{') or array (starts with '[') then jQuery.parseJSON
is used to parse the string; it must follow valid JSON syntax including quoted property names. If the value isn't parseable as a JavaScript value, it is left as a string.
When the data attribute is an object (starts with '{') or array (starts with '[') then jQuery.parseJSON
is used to parse the string; it must follow valid JSON syntax including quoted property names. If the value isn't parseable as a JavaScript value, it is left as a string.
To retrieve the value's attribute as a string without any attempt to convert it, use the attr()
method.
The data- attributes are pulled in the first time the data property is accessed and then are no longer accessed or mutated (all data values are then stored internally in jQuery).
Calling .data()
with no parameters retrieves all of the values as a JavaScript object. This object can be safely cached in a variable as long as a new object is not set with .data(obj)
. Using the object directly to get or set values is faster than making individual calls to .data()
to get or set each value:
Returns a boolean value (true
or false
) that indicates whether or not the META key was pressed at the time the event fired.
This key might map to an alternative key name on some platforms.
On Macintosh keyboards, the META key maps to the Command key (⌘).
-On Windows keyboards, the META key maps to the Windows key.
+On Macintosh keyboards, the META key maps to the Command key (⌘).
+On Windows keyboards, the META key maps to the Windows key.
As of jQuery 1.4.3, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called swing
, and one that progresses at a constant pace, called linear
. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.
As of jQuery 1.4.3, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called swing
, and one that progresses at a constant pace, called linear
. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.
If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but this
is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole.
As of jQuery 1.6, the .promise()
method can be used in conjunction with the deferred.done()
method to execute a single callback for the animation as a whole when all matching elements have completed their animations ( See the example for .promise() ).
Note: To avoid unnecessary DOM manipulation, .fadeOut()
will not hide an element that is already considered hidden. For information on which elements jQuery considers hidden, see :hidden Selector.
As of jQuery 1.4.3, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called swing
, and one that progresses at a constant pace, called linear
. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.
As of jQuery 1.4.3, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called swing
, and one that progresses at a constant pace, called linear
. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.
If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but this
is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole.
As of jQuery 1.6, the .promise()
method can be used in conjunction with the deferred.done()
method to execute a single callback for the animation as a whole when all matching elements have completed their animations ( See the example for .promise() ).
The .fadeToggle()
method animates the opacity of the matched elements. When called on a visible element, the element's display
style property is set to none
once the opacity reaches 0, so the element no longer affects the layout of the page.
Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings 'fast'
and 'slow'
can be supplied to indicate durations of 200
and 600
milliseconds, respectively.
The string representing an easing function specifies the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called swing
, and one that progresses at a constant pace, called linear
. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.
The string representing an easing function specifies the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called swing
, and one that progresses at a constant pace, called linear
. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.
If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but this
is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole.
As of jQuery 1.6, the .promise()
method can be used in conjunction with the deferred.done()
method to execute a single callback for the animation as a whole when all matching elements have completed their animations ( See the example for .promise() ).
Elements with visibility: hidden
or opacity: 0
are considered to be visible, since they still consume space in the layout. During animations that hide an element, the element is considered to be visible until the end of the animation.
Elements that are not in a document are not considered to be visible; jQuery does not have a way to know if they will be visible when appended to a document since it depends on the applicable styles.
During animations to show an element, the element is considered to be visible at the start of the animation.
-How :hidden
is determined was changed in jQuery 1.3.2. An element is assumed to be hidden if it or any of its parents consumes no space in the document. CSS visibility isn't taken into account (therefore $( elem ).css( "visibility", "hidden" ).is( ":hidden" ) == false
). The release notes outline the changes in more detail.
How :hidden
is determined was changed in jQuery 1.3.2. An element is assumed to be hidden if it or any of its parents consumes no space in the document. CSS visibility isn't taken into account (therefore $( elem ).css( "visibility", "hidden" ).is( ":hidden" ) == false
). The release notes outline the changes in more detail.
When a duration, a plain object, or a "complete" function is provided, .hide()
becomes an animation method. The .hide()
method animates the width, height, and opacity of the matched elements simultaneously. When these properties reach 0, the display
style property is set to none
to ensure that the element no longer affects the layout of the page.
Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings 'fast'
and 'slow'
can be supplied to indicate durations of 200
and 600
milliseconds, respectively.
Note that .hide()
is fired immediately and will override the animation queue if no duration or a duration of 0 is specified.
As of jQuery 1.4.3, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called swing
, and one that progresses at a constant pace, called linear
. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.
As of jQuery 1.4.3, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called swing
, and one that progresses at a constant pace, called linear
. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.
If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but this
is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole.
We can animate any element, such as a simple image:
diff --git a/entries/html.xml b/entries/html.xml
index 7a4f2594..ca5400fe 100644
--- a/entries/html.xml
+++ b/entries/html.xml
@@ -118,7 +118,7 @@ $( "div.demo-container" ).html(function() {
});
Given a document with six paragraphs, this example will set the HTML of <div class="demo-container">
to <p>All new content for <em>6 paragraphs!</em></p>
.
This method uses the browser's innerHTML
property. Some browsers may not generate a DOM that exactly replicates the HTML source provided. For example, Internet Explorer prior to version 8 will convert all href
properties on links to absolute URLs, and Internet Explorer prior to version 9 will not correctly handle HTML5 elements without the addition of a separate compatibility layer.
This method uses the browser's innerHTML
property. Some browsers may not generate a DOM that exactly replicates the HTML source provided. For example, Internet Explorer prior to version 8 will convert all href
properties on links to absolute URLs, and Internet Explorer prior to version 9 will not correctly handle HTML5 elements without the addition of a separate compatibility layer.
To set the content of a <script>
element, which does not contain HTML, use the .text()
method and not .html()
.
Note: In Internet Explorer up to and including version 9, setting the text content of an HTML element may corrupt the text nodes of its children that are being removed from the document as a result of the operation. If you are keeping references to these DOM elements and need them to be unchanged, use .empty().html( string )
instead of .html(string)
so that the elements are removed from the document before the new string is assigned to the element.
For id selectors, jQuery uses the JavaScript function document.getElementById()
, which is extremely efficient. When another selector is attached to the id selector, such as h2#pageTitle
, jQuery performs an additional check before identifying the element as a match.
Calling jQuery()
(or $()
) with an id selector as its argument will return a jQuery object containing a collection of either zero or one DOM element.
Each id
value must be used only once within a document. If more than one element has been assigned the same ID, queries that use that ID will only select the first matched element in the DOM. This behavior should not be relied on, however; a document with more than one element using the same ID is invalid.
If the id contains characters like periods or colons you have to escape those characters with backslashes.
+If the id contains characters like periods or colons you have to escape those characters with backslashes.
As of jQuery 1.5.1, the jqXHR
object also contains the overrideMimeType()
method (it was available in jQuery 1.4.x, as well, but was temporarily removed in jQuery 1.5). The .overrideMimeType()
method may be used in the beforeSend()
callback function, for example, to modify the response content-type header:
$.ajax({
- url: "http://fiddle.jshell.net/favicon.png",
+ url: "https://fiddle.jshell.net/favicon.png",
beforeSend: function( xhr ) {
xhr.overrideMimeType( "text/plain; charset=x-user-defined" );
}
@@ -297,7 +297,7 @@ jqxhr.always(function() {
Different types of response to $.ajax()
call are subjected to different kinds of pre-processing before being passed to the success handler. The type of pre-processing depends by default upon the Content-Type of the response, but can be set explicitly using the dataType
option. If the dataType
option is provided, the Content-Type header of the response will be disregarded.
The available data types are text
, html
, xml
, json
, jsonp
, and script
.
If text
or html
is specified, no pre-processing occurs. The data is simply passed on to the success handler, and made available through the responseText
property of the jqXHR
object.
- If xml
is specified, the response is parsed using jQuery.parseXML
before being passed, as an XMLDocument
, to the success handler. The XML document is made available through the responseXML
property of the jqXHR
object.
+ If xml
is specified, the response is parsed using jQuery.parseXML
before being passed, as an XMLDocument
, to the success handler. The XML document is made available through the responseXML
property of the jqXHR
object.
If json
is specified, the response is parsed using jQuery.parseJSON
before being passed, as an object, to the success handler. The parsed JSON object is made available through the responseJSON
property of the jqXHR
object.
If script
is specified, $.ajax()
will execute the JavaScript that is received from the server before passing it on to the success handler as a string.
If jsonp
is specified, $.ajax()
will automatically append a query string parameter of (by default) callback=?
to the URL. The jsonp
and jsonpCallback
properties of the settings passed to $.ajax()
can be used to specify, respectively, the name of the query string parameter and the name of the JSONP callback function. The server should return valid JavaScript that passes the JSON response into the callback function. $.ajax()
will execute the returned JavaScript, calling the JSONP callback function, before passing the JSON object contained in the response to the $.ajax()
success handler.
diff --git a/entries/jQuery.browser.xml b/entries/jQuery.browser.xml
index e7c690ac..667ed5f1 100644
--- a/entries/jQuery.browser.xml
+++ b/entries/jQuery.browser.xml
@@ -18,7 +18,7 @@
This property is available immediately. It is therefore safe to use it to determine whether or not to call $(document).ready()
.
The $.browser
property is deprecated in jQuery 1.3, and its functionality may be moved to a team-supported plugin in a future release of jQuery.
- Because $.browser
uses navigator.userAgent
to determine the platform, it is vulnerable to spoofing by the user or misrepresentation by the browser itself. It is always best to avoid browser-specific code entirely where possible. Instead of relying on $.browser
it's better to use libraries like Modernizr.
+ Because $.browser
uses navigator.userAgent
to determine the platform, it is vulnerable to spoofing by the user or misrepresentation by the browser itself. It is always best to avoid browser-specific code entirely where possible. Instead of relying on $.browser
it's better to use libraries like Modernizr.
Show the browser info.
diff --git a/entries/jQuery.extend.xml b/entries/jQuery.extend.xml
index ee6fb4a7..ce4d0328 100644
--- a/entries/jQuery.extend.xml
+++ b/entries/jQuery.extend.xml
@@ -38,7 +38,7 @@
Warning: Passing false
for the first argument is not supported.
Undefined properties are not copied. However, properties inherited from the object's prototype will be copied over. Properties that are an object constructed via new MyCustomObject(args)
, or built-in JavaScript types such as Date or RegExp, are not re-constructed and will appear as plain Objects in the resulting object or array.
On a deep
extend, Object and Array are extended, but object wrappers on primitive types such as String, Boolean, and Number are not. Deep-extending a cyclical data structure will result in an error.
- For needs that fall outside of this behavior, write a custom extend method instead, or use a library like lodash.
+ For needs that fall outside of this behavior, write a custom extend method instead, or use a library like lodash.
Merge two objects, modifying the first.
diff --git a/entries/jQuery.getJSON.xml b/entries/jQuery.getJSON.xml
index 23ad5c2d..ea697e67 100644
--- a/entries/jQuery.getJSON.xml
+++ b/entries/jQuery.getJSON.xml
@@ -14,7 +14,7 @@
-
+
A callback function that is executed if the request succeeds.
@@ -95,7 +95,7 @@ jqxhr.complete(function() {
Loads the four most recent pictures of Mount Rainier from the Flickr JSONP API.
-Note that for-in-loop can be spoiled by extending Object.prototype (see Object.prototype is verboten) so take care when using other libraries. +
Note that for-in-loop can be spoiled by extending Object.prototype (see Object.prototype is verboten) so take care when using other libraries.
jQuery provides a generic each function to iterate over properties of objects, as well as elements of arrays: