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/LICENSE.txt b/LICENSE.txt
index 19a9bad2..203b68a7 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,4 +1,4 @@
-Copyright Packt Publishing (http://packtpub.com/),
+Copyright Packt Publishing (https://www.packtpub.com/),
jQuery Foundation (https://jquery.org/), and other contributors.
This software consists of voluntary contributions made by many
@@ -35,7 +35,7 @@ Copyright and related rights for sample code are waived via CC0. Sample
code is defined as all source code displayed within the prose of the
documentation and all examples and demos.
-CC0: http://creativecommons.org/publicdomain/zero/1.0/
+CC0: https://creativecommons.org/publicdomain/zero/1.0/
====
diff --git a/README.md b/README.md
index 805e0442..1141cd22 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](http://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 4af831f8..b08956d9 100644
--- a/categories.xml
+++ b/categories.xml
@@ -68,12 +68,12 @@
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:
According to the W3C forms specification, the checked
attribute is a boolean attribute, which means the corresponding property is true if the attribute is present at all—even if, for example, the attribute has no value or is set to empty string value or even "false". This is true of all boolean attributes.
According to the W3C forms specification, the checked
attribute is a boolean attribute, which means the corresponding property is true if the attribute is present at all—even if, for example, the attribute has no value or is set to empty string value or even "false". This is true of all boolean attributes.
Nevertheless, the most important concept to remember about the checked
attribute is that it does not correspond to the checked
property. The attribute actually corresponds to the defaultChecked
property and should be used only to set the initial value of the checkbox. The checked
attribute value does not change with the state of the checkbox, while the checked
property does. Therefore, the cross-browser-compatible way to determine if a checkbox is checked is to use the property:
In jQuery 1.4.3 setting an element's data object with .data(obj)
extends the data previously stored with that element.
Prior to jQuery 1.4.3 (starting in jQuery 1.4) the .data()
method completely replaced all data, instead of just extending the data object. If you are using third-party plugins it may not be advisable to completely replace the element's data object, since plugins may have also set data.
jQuery 3 changes the behavior of this method to align it to the Dataset API specifications. Specifically, jQuery 3 transforms every two-character sequence of "-" (U+002D) followed by a lowercase ASCII letter by the uppercase version of the letter as per definition of the algorithm of the Dataset API. Writing a statement like $( "body" ).data( { "my-name": "aValue" } ).data();
will return { myName: "aValue" }
.
jQuery 3 changes the behavior of this method to align it to the Dataset API specifications. Specifically, jQuery 3 transforms every two-character sequence of "-" (U+002D) followed by a lowercase ASCII letter by the uppercase version of the letter as per definition of the algorithm of the Dataset API. Writing a statement like $( "body" ).data( { "my-name": "aValue" } ).data();
will return { myName: "aValue" }
.
Due to the way browsers interact with plugins and external code, the .data()
method cannot be used on <object>
(unless it's a Flash plugin), <applet>
or <embed>
elements.
jQuery 3 changes the behavior of this method to align it to the Dataset API specifications. Specifically, jQuery 3 transforms every two-character sequence of "-" (U+002D) followed by a lowercase ASCII letter by the uppercase version of the letter as per definition of the algorithm of the Dataset API. Writing a statement like $( "body" ).data( { "my-name": "aValue" } ).data();
will return { myName: "aValue" }
.
jQuery 3 changes the behavior of this method to align it to the Dataset API specifications. Specifically, jQuery 3 transforms every two-character sequence of "-" (U+002D) followed by a lowercase ASCII letter by the uppercase version of the letter as per definition of the algorithm of the Dataset API. Writing a statement like $( "body" ).data( { "my-name": "aValue" } ).data();
will return { myName: "aValue" }
.
As of jQuery 1.4.3 HTML 5 data- attributes will be automatically pulled in to jQuery's data object. The treatment of attributes with embedded dashes was changed in jQuery 1.6 to conform to the W3C HTML5 specification.
+As of jQuery 1.4.3 HTML 5 data- attributes will be automatically pulled in to jQuery's data object. The treatment of attributes with embedded dashes was changed in jQuery 1.6 to conform to the W3C HTML5 specification.
For example, given the following HTML:
<div data-role="page" data-last-value="43" data-hidden="true" data-options='{"name":"John"}'></div>
All of the following jQuery code will work.
@@ -105,7 +105,7 @@ $( "div" ).data( "options" ).name === "John";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:
This is the inverse of :parent
.
One important thing to note with :empty (and :parent) is that child elements include text nodes.
-The W3C recommends that the <p>
element have at least one child node, even if that child is merely text (see http://www.w3.org/TR/html401/struct/text.html#edef-P). Some other elements, on the other hand, are empty (i.e. have no children) by definition: <input>, <img>, <br>, and <hr>, for example.
The W3C recommends that the <p>
element have at least one child node, even if that child is merely text (see https://www.w3.org/TR/html401/struct/text.html#edef-P). Some other elements, on the other hand, are empty (i.e. have no children) by definition: <input>, <img>, <br>, and <hr>, for example.
This property was introduced in DOM level 3.
+This property was introduced in DOM level 3.
This event method is described in the W3C DOM Level 3 specification.
+This event method is described in the W3C DOM Level 3 specification.
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.
fadeIn()
effectAs 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 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.
This selector is the opposite of the :visible
selector. So, every element selected by :hidden
isn't selected by :visible
and vice versa.
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.
jQuery 3 slightly modifies the meaning of :hidden
(and therefore of :visible
). Starting with this version, elements will be considered :hidden
if they don't have any layout boxes. For example, br
elements and inline elements with no content will not be selected by the :hidden
selector.
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.
Note: This method may cause performance issues, especially when used on many elements. If you're encountering such issues, use performance testing tools to determine whether this method is causing them. Moreover, this method can cause problems with responsive layouts if the display value differs at different viewport sizes.
diff --git a/entries/html.xml b/entries/html.xml index 7a4f2594..b830c566 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.
"xml"
: Returns a XML document that can be processed via jQuery."html"
: Returns HTML as plain text; included script tags are evaluated when inserted in the DOM."script"
: Evaluates the response as JavaScript and returns it as plain text. Disables caching by appending a query string parameter, _=[TIMESTAMP]
, to the URL unless the cache
option is set to true
. Note: This will turn POSTs into GETs for remote-domain requests."json"
: Evaluates the response as JSON and returns a JavaScript object. Cross-domain "json"
requests that have a callback placeholder, e.g. ?callback=?
, are performed using JSONP unless the request includes jsonp: false
in its request options. The JSON data is parsed in a strict manner; any malformed JSON is rejected and a parse error is thrown. As of jQuery 1.9, an empty response is also rejected; the server should return a response of null
or {}
instead. (See json.org for more information on proper JSON formatting.)"jsonp"
: Loads in a JSON block using JSONP. Adds an extra "?callback=?"
to the end of your URL to specify the callback. Disables caching by appending a query string parameter, "_=[TIMESTAMP]"
, to the URL unless the cache
option is set to true
."json"
: Evaluates the response as JSON and returns a JavaScript object. Cross-domain "json"
requests that have a callback placeholder, e.g. ?callback=?
, are performed using JSONP unless the request includes jsonp: false
in its request options. The JSON data is parsed in a strict manner; any malformed JSON is rejected and a parse error is thrown. As of jQuery 1.9, an empty response is also rejected; the server should return a response of null
or {}
instead. (See json.org for more information on proper JSON formatting.)"jsonp"
: Loads in a JSON block using JSONP. Adds an extra "?callback=?"
to the end of your URL to specify the callback. Disables caching by appending a query string parameter, "_=[TIMESTAMP]"
, to the URL unless the cache
option is set to true
."text"
: A plain text string."text xml"
for the dataType. You can also make a JSONP request, have it received as text, and interpreted by jQuery as XML: "jsonp text xml"
. Similarly, a shorthand string such as "jsonp xml"
will first attempt to convert from jsonp to xml, and, failing that, convert from jsonp to text, and then from text to xml.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" );
}
@@ -326,11 +326,11 @@ 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.
- For more information on JSONP, see the original post detailing its use.
+ For more information on JSONP, see the original post detailing its use.
Sending Data to the Server
By default, Ajax requests are sent using the GET HTTP method. If the POST method is required, the method can be specified by setting a value for the type
option. This option affects how the contents of the data
option are sent to the server. POST data will always be transmitted to the server using UTF-8 charset, per the W3C XMLHTTPRequest standard.
The data
option can contain either a query string of the form key1=value1&key2=value2
, or an object of the form {key1: 'value1', key2: 'value2'}
. If the latter form is used, the data is converted into a query string using jQuery.param()
before it is sent. This processing can be circumvented by setting processData
to false
. The processing might be undesirable if you wish to send an XML object to the server; in this case, change the contentType
option from application/x-www-form-urlencoded
to a more appropriate MIME type.
diff --git a/entries/jQuery.ajaxPrefilter.xml b/entries/jQuery.ajaxPrefilter.xml
index f82d8d02..708ca829 100644
--- a/entries/jQuery.ajaxPrefilter.xml
+++ b/entries/jQuery.ajaxPrefilter.xml
@@ -40,11 +40,11 @@ $.ajaxPrefilter(function( options, originalOptions, jqXHR ) {
}
});
- Prefilters can also be used to modify existing options. For example, the following proxies cross-domain requests through http://mydomain.net/proxy/:
+Prefilters can also be used to modify existing options. For example, the following proxies cross-domain requests through https://mydomain.net/proxy/:
$.ajaxPrefilter(function( options ) {
if ( options.crossDomain ) {
- options.url = "http://mydomain.net/proxy/" + encodeURIComponent( options.url );
+ options.url = "https://mydomain.net/proxy/" + encodeURIComponent( options.url );
options.crossDomain = false;
}
});
diff --git a/entries/jQuery.boxModel.xml b/entries/jQuery.boxModel.xml
index f260538a..ac464850 100644
--- a/entries/jQuery.boxModel.xml
+++ b/entries/jQuery.boxModel.xml
@@ -4,7 +4,7 @@
1.0
- States if the current page, in the user's browser, is being rendered using the W3C CSS Box Model. This property was removed in jQuery 1.8. Please try to use feature detection instead.
+ States if the current page, in the user's browser, is being rendered using the W3C CSS Box Model. This property was removed in jQuery 1.8. Please try to use feature detection instead.
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 42edb4ae..b28ec2e0 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.fx.interval.xml b/entries/jQuery.fx.interval.xml
index 5516d75c..2dfd1719 100644
--- a/entries/jQuery.fx.interval.xml
+++ b/entries/jQuery.fx.interval.xml
@@ -6,7 +6,7 @@
1.4.3
- This property is deprecated as of version 3.0, and has no effect in browsers that support the requestAnimationFrame
method.
+ This property is deprecated as of version 3.0, and has no effect in browsers that support the requestAnimationFrame
method.
On browsers that do not support requestAnimationFrame
, this property can be changed to adjust the interval at which animations will run. The default is 13 milliseconds.
Since jQuery uses one global interval, no animation should be running or all animations should stop for the change of this property to take effect.
diff --git a/entries/jQuery.getJSON.xml b/entries/jQuery.getJSON.xml
index b8a5ee49..11a26341 100644
--- a/entries/jQuery.getJSON.xml
+++ b/entries/jQuery.getJSON.xml
@@ -56,7 +56,7 @@ $.getJSON( "ajax/test.json", function( data ) {
The success
callback is passed the returned data, which is typically a JavaScript object or array as defined by the JSON structure and parsed using the $.parseJSON()
method. It is also passed the text status of the response.
As of jQuery 1.5, the success
callback function receives a "jqXHR" object (in jQuery 1.4, it received the XMLHttpRequest
object). However, since JSONP and cross-domain GET requests do not use XHR, in those cases the jqXHR
and textStatus
parameters passed to the success callback are undefined.
- Important: As of jQuery 1.4, if the JSON file contains a syntax error, the request will usually fail silently. Avoid frequent hand-editing of JSON data for this reason. JSON is a data-interchange format with syntax rules that are stricter than those of JavaScript's object literal notation. For example, all strings represented in JSON, whether they are properties or values, must be enclosed in double-quotes. For details on the JSON format, see http://json.org/.
+ Important: As of jQuery 1.4, if the JSON file contains a syntax error, the request will usually fail silently. Avoid frequent hand-editing of JSON data for this reason. JSON is a data-interchange format with syntax rules that are stricter than those of JavaScript's object literal notation. For example, all strings represented in JSON, whether they are properties or values, must be enclosed in double-quotes. For details on the JSON format, see http://json.org/.
JSONP
If the URL includes the string "callback=?" (or similar, as defined by the server-side API), the request is treated as JSONP instead. See the discussion of the jsonp
data type in $.ajax()
for more details.
diff --git a/entries/jQuery.parseJSON.xml b/entries/jQuery.parseJSON.xml
index 054663df..d47eab4b 100644
--- a/entries/jQuery.parseJSON.xml
+++ b/entries/jQuery.parseJSON.xml
@@ -25,7 +25,7 @@
"NaN"
(NaN
cannot be represented in a JSON string; direct representation of Infinity
is also not permitted).
The JSON standard does not permit "control characters" such as a tab or newline. An example like $.parseJSON( '{ "testing":"1\t2\n3" }' )
will throw an error in most implementations because the JavaScript parser converts the string's tab and newline escapes into literal tab and newline; doubling the backslashes like "1\\t2\\n3"
yields expected results. This problem is often seen when injecting JSON into a JavaScript file from a server-side language such as PHP.
- Where the browser provides a native implementation of JSON.parse
, jQuery uses it to parse the string. For details on the JSON format, see http://json.org/.
+ Where the browser provides a native implementation of JSON.parse
, jQuery uses it to parse the string. For details on the JSON format, see http://json.org/.
Prior to jQuery 1.9, $.parseJSON
returned null
instead of throwing an error if it was passed an empty string, null
, or undefined
, even though those are not valid JSON.
diff --git a/entries/jQuery.support.xml b/entries/jQuery.support.xml
index c44b2b42..636ec72e 100644
--- a/entries/jQuery.support.xml
+++ b/entries/jQuery.support.xml
@@ -4,7 +4,7 @@
1.3
- A collection of properties that represent the presence of different browser features or bugs. Intended for jQuery's internal use; specific properties may be removed when they are no longer needed internally to improve page startup performance. For your own project's feature-detection needs, we strongly recommend the use of an external library such as Modernizr instead of dependency on properties in jQuery.support
.
+ A collection of properties that represent the presence of different browser features or bugs. Intended for jQuery's internal use; specific properties may be removed when they are no longer needed internally to improve page startup performance. For your own project's feature-detection needs, we strongly recommend the use of an external library such as Modernizr instead of dependency on properties in jQuery.support
.
diff --git a/entries/jQuery.xml b/entries/jQuery.xml
index 80e5bf19..a0ff76d1 100644
--- a/entries/jQuery.xml
+++ b/entries/jQuery.xml
@@ -177,9 +177,9 @@ $( myForm.elements ).hide();
By default, elements are created with an .ownerDocument
matching the document into which the jQuery library was loaded. Elements being injected into a different document should be created using that document, e.g., $("<p>hello iframe</p>", $("#myiframe").prop("contentWindow").document)
.
If the HTML is more complex than a single tag without attributes, as it is in the above example, the actual creation of the elements is handled by the browser's .innerHTML
mechanism. In most cases, jQuery creates a new <div>
element and sets the innerHTML
property of the element to the HTML snippet that was passed in. When the parameter has a single tag (with optional closing tag or quick-closing) — $( "<img />" )
or $( "<img>" )
, $( "<a></a>" )
or $( "<a>" )
— jQuery creates the element using the native JavaScript .createElement()
function.
When passing in complex HTML, some browsers may not generate a DOM that exactly replicates the HTML source provided. As mentioned, jQuery uses the browser's .innerHTML
property to parse the passed HTML and insert it into the current document. During this process, some browsers filter out certain elements such as <html>
, <title>
, or <head>
elements. As a result, the elements inserted may not be representative of the original string passed.
- Filtering isn't, however, limited to these tags. For example, Internet Explorer prior to version 8 will also 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.
+ Filtering isn't, however, limited to these tags. For example, Internet Explorer prior to version 8 will also 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 ensure cross-platform compatibility, the snippet must be well-formed. Tags that can contain other elements should be paired with a closing tag:
- $( "<a href='http://jquery.com'></a>" );
+ $( "<a href='https://jquery.com'></a>" );
Tags that cannot contain elements may be quick-closed or not:
$( "<img>" );
diff --git a/entries/keypress.xml b/entries/keypress.xml
index 96b6b6c6..0fd28cf3 100644
--- a/entries/keypress.xml
+++ b/entries/keypress.xml
@@ -61,7 +61,7 @@ $( "#other" ).click(function() {
- Show the event object when a key is pressed in the input. Note: This demo relies on a simple $.print() plugin (http://api.jquery.com/resources/events.js) for the event object's output.
+ Show the event object when a key is pressed in the input. Note: This demo relies on a simple $.print() plugin (https://api.jquery.com/resources/events.js) for the event object's output.