From 12bd7c4fda85f1842bc46fd041080cbbfae81efe Mon Sep 17 00:00:00 2001 From: Aurelio De Rosa Date: Tue, 30 Jan 2018 02:30:57 +0000 Subject: [PATCH 01/25] Added note about the deprecation of jQuery.isWindow in version 3.3 Closes gh-1082 Fixes gh-1050 --- entries/jQuery.isWindow.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/entries/jQuery.isWindow.xml b/entries/jQuery.isWindow.xml index 15453599..ee8ed3b1 100644 --- a/entries/jQuery.isWindow.xml +++ b/entries/jQuery.isWindow.xml @@ -1,5 +1,5 @@ - + jQuery.isWindow() 1.4.3 @@ -22,4 +22,5 @@ Is 'window' a window? + From 05caac8968b98aa45d066a382d45d4ce0510bae5 Mon Sep 17 00:00:00 2001 From: Daniil Zhilin Date: Mon, 26 Mar 2018 19:43:40 +0300 Subject: [PATCH 02/25] jQuery.ajax: Change DataType to dataType Closes #1088 --- entries/jQuery.ajax.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entries/jQuery.ajax.xml b/entries/jQuery.ajax.xml index 393bc83c..fa77edcd 100644 --- a/entries/jQuery.ajax.xml +++ b/entries/jQuery.ajax.xml @@ -15,7 +15,7 @@ 1.0 A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup(). - + A set of key/value pairs that map a given dataType to its MIME type, which gets sent in the Accept request header. This header tells the server what kind of response it will accept in return. For example, the following defines a custom type mycustomtype to be sent with the request:

 $.ajax({

From 82380a70f10728b4274afe387b742b24f97a9dfa Mon Sep 17 00:00:00 2001
From: Brahim Arkni 
Date: Mon, 26 Mar 2018 17:44:56 +0100
Subject: [PATCH 03/25] data: Replace URL markdown syntax with HTML

Ref #943
Closes #1087
---
 entries/data.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/entries/data.xml b/entries/data.xml
index 3606395d..66ed7253 100644
--- a/entries/data.xml
+++ b/entries/data.xml
@@ -89,7 +89,7 @@ alert( $( "body" ).data( "foo" ) ); // undefined
 $( "body" ).data( "bar", "foobar" );
 alert( $( "body" ).data( "bar" ) ); // foobar
       
-

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](http://www.w3.org/TR/html5/dom.html#dom-dataset). 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" }.

HTML5 data-* Attributes

From 0998d12d4e12ec6b89028aeb89661187421384a4 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Mon, 26 Mar 2018 12:48:56 -0400 Subject: [PATCH 04/25] jQuery.ajax: Adjust note about cross-domain ajax request with 'JSON' datatype Fixes #959 Closes #1021 --- entries/jQuery.ajax.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entries/jQuery.ajax.xml b/entries/jQuery.ajax.xml index fa77edcd..8d92e0f8 100644 --- a/entries/jQuery.ajax.xml +++ b/entries/jQuery.ajax.xml @@ -98,7 +98,7 @@ $.ajax({
  • "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 are converted to "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.)
  • +
  • "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.
  • multiple, space-separated values: As of jQuery 1.5, jQuery can convert a dataType from what it received in the Content-Type header to what you require. For example, if you want a text response to be treated as XML, use "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.
  • From 8e67f74e434adf26ab72903caae040fd85baf749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?= Date: Mon, 26 Mar 2018 19:10:30 +0200 Subject: [PATCH 05/25] Misc: Change HTTP links to HTTPS where possible Closes #1089 --- CONTRIBUTING.md | 6 +++--- LICENSE.txt | 4 ++-- README.md | 6 +++--- categories.xml | 6 +++--- entries/animate.xml | 6 +++--- entries/attr.xml | 2 +- entries/contents.xml | 2 +- entries/data.xml | 8 ++++---- entries/empty-selector.xml | 2 +- entries/event.isImmediatePropagationStopped.xml | 2 +- entries/event.isPropagationStopped.xml | 2 +- entries/event.metaKey.xml | 4 ++-- entries/event.preventDefault.xml | 2 +- entries/fadeIn.xml | 2 +- entries/fadeOut.xml | 2 +- entries/fadeToggle.xml | 2 +- entries/hidden-selector.xml | 2 +- entries/hide.xml | 2 +- entries/html.xml | 2 +- entries/id-selector.xml | 2 +- entries/jQuery.ajax.xml | 10 +++++----- entries/jQuery.ajaxPrefilter.xml | 4 ++-- entries/jQuery.boxModel.xml | 2 +- entries/jQuery.browser.xml | 2 +- entries/jQuery.extend.xml | 2 +- entries/jQuery.fx.interval.xml | 2 +- entries/jQuery.getJSON.xml | 2 +- entries/jQuery.parseJSON.xml | 2 +- entries/jQuery.support.xml | 2 +- entries/jQuery.xml | 4 ++-- entries/keypress.xml | 2 +- entries/lang-selector.xml | 2 +- entries/map.xml | 2 +- entries/nth-child-selector.xml | 2 +- entries/nth-last-child-selector.xml | 2 +- entries/nth-last-of-type-selector.xml | 2 +- entries/nth-of-type-selector.xml | 2 +- entries/on.xml | 4 ++-- entries/parent-selector.xml | 2 +- entries/prop.xml | 2 +- entries/ready.xml | 2 +- entries/serialize.xml | 2 +- entries/serializeArray.xml | 2 +- entries/show.xml | 2 +- entries/slideDown.xml | 2 +- entries/slideToggle.xml | 2 +- entries/slideUp.xml | 2 +- entries/target-selector.xml | 4 ++-- entries/toggle.xml | 2 +- entries/visible-selector.xml | 2 +- notes.xsl | 4 ++-- pages/Types.html | 11 +++-------- 52 files changed, 76 insertions(+), 81 deletions(-) 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 @@ @@ -428,7 +428,7 @@ var files = event.originalEvent.dataTransfer.files; diff --git a/entries/animate.xml b/entries/animate.xml index 5db2dcf6..97cac616 100644 --- a/entries/animate.xml +++ b/entries/animate.xml @@ -72,10 +72,10 @@ $( "#clickme" ).click(function() {

    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.

    Step Function

    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.

    @@ -96,7 +96,7 @@ $( "li" ).animate({ });

    Easing

    -

    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.

    Per-property Easing

    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:

    diff --git a/entries/attr.xml b/entries/attr.xml index 2a963254..1628ec72 100644 --- a/entries/attr.xml +++ b/entries/attr.xml @@ -69,7 +69,7 @@
    -

    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:

    • diff --git a/entries/contents.xml b/entries/contents.xml index 5bfe9fc6..70188f7b 100644 --- a/entries/contents.xml +++ b/entries/contents.xml @@ -46,7 +46,7 @@ $( "p" ) .wrap( "" ); ]]> diff --git a/entries/data.xml b/entries/data.xml index 66ed7253..71c6c10f 100644 --- a/entries/data.xml +++ b/entries/data.xml @@ -31,7 +31,7 @@ $( "body" ).data(); // { foo: 52, bar: { myType: "test", count: 40 }, baz: [ 1,

      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.

      @@ -89,11 +89,11 @@ alert( $( "body" ).data( "foo" ) ); // undefined $( "body" ).data( "bar", "foobar" ); alert( $( "body" ).data( "bar" ) ); // foobar -

      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" }.

      HTML5 data-* Attributes

      -

      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:

      diff --git a/entries/empty-selector.xml b/entries/empty-selector.xml index 8e06d87c..165e2112 100644 --- a/entries/empty-selector.xml +++ b/entries/empty-selector.xml @@ -9,7 +9,7 @@

      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.

      Finds all elements that are empty - they don't have child elements or text. diff --git a/entries/event.isImmediatePropagationStopped.xml b/entries/event.isImmediatePropagationStopped.xml index 44235564..4d8f3ad1 100644 --- a/entries/event.isImmediatePropagationStopped.xml +++ b/entries/event.isImmediatePropagationStopped.xml @@ -6,7 +6,7 @@ Returns whether event.stopImmediatePropagation() was ever called on this event object. -

      This property was introduced in DOM level 3.

      +

      This property was introduced in DOM level 3.

      Checks whether event.stopImmediatePropagation() was called. diff --git a/entries/event.isPropagationStopped.xml b/entries/event.isPropagationStopped.xml index ff7f7451..26a85b76 100644 --- a/entries/event.isPropagationStopped.xml +++ b/entries/event.isPropagationStopped.xml @@ -6,7 +6,7 @@ Returns whether event.stopPropagation() was ever called on this event object. -

      This event method is described in the W3C DOM Level 3 specification.

      +

      This event method is described in the W3C DOM Level 3 specification.

      Checks whether event.stopPropagation() was called diff --git a/entries/event.metaKey.xml b/entries/event.metaKey.xml index b83eeadd..f27b6e46 100644 --- a/entries/event.metaKey.xml +++ b/entries/event.metaKey.xml @@ -8,8 +8,8 @@

      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.

      Determine whether the META key was pressed when the event fired. diff --git a/entries/event.preventDefault.xml b/entries/event.preventDefault.xml index 68f0a43a..ac534fcb 100644 --- a/entries/event.preventDefault.xml +++ b/entries/event.preventDefault.xml @@ -19,7 +19,7 @@ $( "a" ).click(function( event ) { }); ]]> diff --git a/entries/fadeIn.xml b/entries/fadeIn.xml index f3b2e9e2..0f4b6888 100644 --- a/entries/fadeIn.xml +++ b/entries/fadeIn.xml @@ -43,7 +43,7 @@ $( "#clickme" ).click(function() {
      Figure 1 - Illustration of the fadeIn() effect

      Easing

      -

      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.

      Callback Function

      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() ).

      diff --git a/entries/fadeOut.xml b/entries/fadeOut.xml index 1bdddaf6..186056eb 100644 --- a/entries/fadeOut.xml +++ b/entries/fadeOut.xml @@ -47,7 +47,7 @@ $( "#clickme" ).click(function() {

      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.

      Easing

      -

      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.

      Callback Function

      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() ).

      diff --git a/entries/fadeToggle.xml b/entries/fadeToggle.xml index 93bac084..f3906b45 100644 --- a/entries/fadeToggle.xml +++ b/entries/fadeToggle.xml @@ -17,7 +17,7 @@

      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.

      Easing

      -

      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.

      Callback Function

      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() ).

      diff --git a/entries/hidden-selector.xml b/entries/hidden-selector.xml index 47c0bf6c..e44d732b 100644 --- a/entries/hidden-selector.xml +++ b/entries/hidden-selector.xml @@ -18,7 +18,7 @@

      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.

      diff --git a/entries/hide.xml b/entries/hide.xml index 3a68ca15..b90aed05 100644 --- a/entries/hide.xml +++ b/entries/hide.xml @@ -35,7 +35,7 @@ $( ".target" ).hide();

      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.

      diff --git a/entries/id-selector.xml b/entries/id-selector.xml index 20aab992..3cc8b926 100644 --- a/entries/id-selector.xml +++ b/entries/id-selector.xml @@ -13,7 +13,7 @@

      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.

      Select the element with the id "myDiv" and give it a red border. diff --git a/entries/jQuery.ajax.xml b/entries/jQuery.ajax.xml index 8d92e0f8..80157d28 100644 --- a/entries/jQuery.ajax.xml +++ b/entries/jQuery.ajax.xml @@ -98,8 +98,8 @@ $.ajax({
    • "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.
    • multiple, space-separated values: As of jQuery 1.5, jQuery can convert a dataType from what it received in the Content-Type header to what you require. For example, if you want a text response to be treated as XML, use "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.
    @@ -217,7 +217,7 @@ $.ajax();

    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.
         
       
    diff --git a/entries/nth-child-selector.xml b/entries/nth-child-selector.xml
    index 40d46787..68da261d 100644
    --- a/entries/nth-child-selector.xml
    +++ b/entries/nth-child-selector.xml
    @@ -12,7 +12,7 @@
       
         

    Because jQuery's implementation of :nth- selectors is strictly derived from the CSS specification, the value of n is "1-indexed", meaning that the counting starts at 1. For other selector expressions such as :eq() or :even jQuery follows JavaScript's "0-indexed" counting. Given a single <ul> containing two <li>s, $( "li:nth-child(1)" ) selects the first <li> while $( "li:eq(1)" ) selects the second.

    The :nth-child(n) pseudo-class is easily confused with :eq(n), even though the two can result in dramatically different matched elements. With :nth-child(n), all children are counted, regardless of what they are, and the specified element is selected only if it matches the selector attached to the pseudo-class. With :eq(n) only the selector attached to the pseudo-class is counted, not limited to children of any other element, and the (n+1)th one (n is 0-based) is selected.

    -

    Further discussion of this unusual usage can be found in the W3C CSS specification.

    +

    Further discussion of this unusual usage can be found in the W3C CSS specification.

    Find the second li in each matched ul and note it. diff --git a/entries/nth-last-child-selector.xml b/entries/nth-last-child-selector.xml index ce21de1f..9d63636a 100644 --- a/entries/nth-last-child-selector.xml +++ b/entries/nth-last-child-selector.xml @@ -11,7 +11,7 @@ Selects all elements that are the nth-child of their parent, counting from the last element to the first.

    Because jQuery's implementation of :nth- selectors is strictly derived from the CSS specification, the value of n is "1-indexed", meaning that the counting starts at 1. For other selector expressions such as :eq() or :even jQuery follows JavaScript's "0-indexed" counting. Given a single <ul> containing three <li>s, $( "li:nth-last-child(1)" ) selects the third, last, <li>.

    -

    Further discussion of this usage can be found in the W3C CSS specification.

    +

    Further discussion of this usage can be found in the W3C CSS specification.

    Find the second to last li in each matched ul and note it. diff --git a/entries/nth-last-of-type-selector.xml b/entries/nth-last-of-type-selector.xml index eb96db43..602d430a 100644 --- a/entries/nth-last-of-type-selector.xml +++ b/entries/nth-last-of-type-selector.xml @@ -11,7 +11,7 @@ Selects all the elements that are the nth-child of their parent in relation to siblings with the same element name, counting from the last element to the first.

    Because jQuery's implementation of :nth- selectors is strictly derived from the CSS specification, the value of n is "1-indexed", meaning that the counting starts at 1. For other selector expressions such as :eq() or :even jQuery follows JavaScript's "0-indexed" counting. Given a single <ul> containing three <li>s, $('li:nth-last-of-type(1)') selects the third, last, <li>.

    -

    Further discussion of this usage can be found in the W3C CSS specification.

    +

    Further discussion of this usage can be found in the W3C CSS specification.

    Find the second to last li in each matched ul and note it. diff --git a/entries/nth-of-type-selector.xml b/entries/nth-of-type-selector.xml index 839cb8f0..89e6d452 100644 --- a/entries/nth-of-type-selector.xml +++ b/entries/nth-of-type-selector.xml @@ -11,7 +11,7 @@ Selects all elements that are the nth child of their parent in relation to siblings with the same element name.

    Because jQuery's implementation of :nth- selectors is strictly derived from the CSS specification, the value of n is "1-indexed", meaning that the counting starts at 1. For other selector expressions such as :eq() or :even jQuery follows JavaScript's "0-indexed" counting.

    -

    Further discussion of this usage can be found in the W3C CSS specification.

    +

    Further discussion of this usage can be found in the W3C CSS specification.

    Find each span that is second in relation to its sibling spans. diff --git a/entries/on.xml b/entries/on.xml index 18a17cae..622fff6a 100644 --- a/entries/on.xml +++ b/entries/on.xml @@ -66,7 +66,7 @@ $( "button" ).on( "click", notify );

    When the browser triggers an event or other JavaScript calls jQuery's .trigger() method, jQuery passes the handler an Event object it can use to analyze and change the status of the event. This object is a normalized subset of data provided by the browser; the browser's unmodified native event object is available in event.originalEvent. For example, event.type contains the event name (e.g., "resize") and event.target indicates the deepest (innermost) element where the event occurred.

    By default, most events bubble up from the original event target to the document element. At each element along the way, jQuery calls any matching event handlers that have been attached. A handler can prevent the event from bubbling further up the document tree (and thus prevent handlers on those elements from running) by calling event.stopPropagation(). Any other handlers attached on the current element will run however. To prevent that, call event.stopImmediatePropagation(). (Event handlers bound to an element are called in the same order that they were bound.)

    -

    Similarly, a handler can call event.preventDefault() to cancel any default action that the browser may have for this event; for example, the default action on a click event is to follow the link. Not all browser events have default actions, and not all default actions can be canceled. See the W3C Events Specification for details.

    +

    Similarly, a handler can call event.preventDefault() to cancel any default action that the browser may have for this event; for example, the default action on a click event is to follow the link. Not all browser events have default actions, and not all default actions can be canceled. See the W3C Events Specification for details.

    Returning false from an event handler will automatically call event.stopPropagation() and event.preventDefault(). A false value can also be passed for the handler as a shorthand for function(){ return false; }. So, $( "a.disabled" ).on( "click", false ); attaches an event handler to all links with class "disabled" that prevents them from being followed when they are clicked and also stops the event from bubbling.

    When jQuery calls a handler, the this keyword is a reference to the element where the event is being delivered; for directly bound events this is the element where the event was attached and for delegated events this is an element matching selector. (Note that this may not be equal to event.target if the event has bubbled from a descendant element.) To create a jQuery object from the element so that it can be used with jQuery methods, use $( this ).

    Passing data to the handler

    @@ -96,7 +96,7 @@ $( "button" ).on( "click", {

    The focus and blur events are specified by the W3C to not bubble, but jQuery defines cross-browser focusin and focusout events that do bubble. When focus and blur are used to attach delegated event handlers, jQuery maps the names and delivers them as focusin and focusout respectively. For consistency and clarity, use the bubbling event type names.

    In all browsers, the load, scroll, and error events (e.g., on an <img> element) do not bubble. In Internet Explorer 8 and lower, the paste and reset events do not bubble. Such events are not supported for use with delegation, but they can be used when the event handler is directly attached to the element generating the event.

    The error event on the window object uses nonstandard arguments and return value conventions, so it is not supported by jQuery. Instead, assign a handler function directly to the window.onerror property.

    -

    The handler list for an element is set when the event is first delivered. Adding or removing event handlers on the current element won't take effect until the next time the event is handled. To prevent any further event handlers from executing on an element within an event handler, call event.stopImmediatePropagation(). This behavior goes against the W3C events specification. To better understand this case, consider the following code:

    +

    The handler list for an element is set when the event is first delivered. Adding or removing event handlers on the current element won't take effect until the next time the event is handled. To prevent any further event handlers from executing on an element within an event handler, call event.stopImmediatePropagation(). This behavior goes against the W3C events specification. To better understand this case, consider the following code:

    var $test = $( "#test" );
     
     function handler1() {
    diff --git a/entries/parent-selector.xml b/entries/parent-selector.xml
    index 424cd36e..72832a23 100644
    --- a/entries/parent-selector.xml
    +++ b/entries/parent-selector.xml
    @@ -9,7 +9,7 @@
       
         

    This is the inverse of :empty.

    One important thing to note regarding the use of :parent (and :empty) is that child nodes 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 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.

    To obtain the parents or ancestors of an existing jQuery set, see the .parent() and .parents() methods.

    diff --git a/entries/prop.xml b/entries/prop.xml index 419c3cc2..49ccceda 100644 --- a/entries/prop.xml +++ b/entries/prop.xml @@ -62,7 +62,7 @@
    -

    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:

    • diff --git a/entries/ready.xml b/entries/ready.xml index 9f14ae52..20cdafa6 100644 --- a/entries/ready.xml +++ b/entries/ready.xml @@ -11,7 +11,7 @@

      The .ready() method offers a way to run JavaScript code as soon as the page's Document Object Model (DOM) becomes safe to manipulate. This will often be a good time to perform tasks that are needed before the user views or interacts with the page, for example to add event handlers and initialize plugins. When multiple functions are added via successive calls to this method, they run when the DOM is ready in the order in which they are added. As of jQuery 3.0, jQuery ensures that an exception occuring in one handler does not prevent subsequently added handlers from executing.

      -

      Most browsers provide similar functionality in the form of a DOMContentLoaded event. However, jQuery's .ready() method differs in an important and useful way: If the DOM becomes ready and the browser fires DOMContentLoaded before the code calls .ready( handler ), the function handler will still be executed. In contrast, a DOMContentLoaded event listener added after the event fires is never executed.

      +

      Most browsers provide similar functionality in the form of a DOMContentLoaded event. However, jQuery's .ready() method differs in an important and useful way: If the DOM becomes ready and the browser fires DOMContentLoaded before the code calls .ready( handler ), the function handler will still be executed. In contrast, a DOMContentLoaded event listener added after the event fires is never executed.

      Browsers also provide the load event on the window object. When this event fires it indicates that all assets on the page have loaded, including images. This event can be watched in jQuery using $( window ).on( "load", handler ). In cases where code relies on loaded assets (for example, if the dimensions of an image are required), the code should be placed in a handler for the load event instead.

      diff --git a/entries/serialize.xml b/entries/serialize.xml index c5c99ccb..55dd099f 100644 --- a/entries/serialize.xml +++ b/entries/serialize.xml @@ -15,7 +15,7 @@ $( "form" ).on( "submit", function( event ) { });

    In this case, jQuery serializes the successful controls within the form. Only form elements are examined for inputs they contain, in all other cases the input elements to be serialized should be part of the set passed to the .serialize() method. Selecting both the form and its children in a set will cause duplicates in the serialized string.

    -

    Note: Only "successful controls" are serialized to the string. No submit button value is serialized since the form was not submitted using a button. For a form element's value to be included in the serialized string, the element must have a name attribute. Values from checkboxes and radio buttons (inputs of type "radio" or "checkbox") are included only if they are checked. Data from file select elements is not serialized.

    +

    Note: Only "successful controls" are serialized to the string. No submit button value is serialized since the form was not submitted using a button. For a form element's value to be included in the serialized string, the element must have a name attribute. Values from checkboxes and radio buttons (inputs of type "radio" or "checkbox") are included only if they are checked. Data from file select elements is not serialized.

    Serialize a form to a query string that could be sent to a server in an Ajax request. diff --git a/entries/serializeArray.xml b/entries/serializeArray.xml index 4a836265..b2df233e 100644 --- a/entries/serializeArray.xml +++ b/entries/serializeArray.xml @@ -28,7 +28,7 @@ </div> </form>
    -

    The .serializeArray() method uses the standard W3C rules for successful controls to determine which elements it should include; in particular the element cannot be disabled and must contain a name attribute. No submit button value is serialized since the form was not submitted using a button. Data from file select elements is not serialized. Elements that do not contain a value attribute are represented with the empty string value.

    +

    The .serializeArray() method uses the standard W3C rules for successful controls to determine which elements it should include; in particular the element cannot be disabled and must contain a name attribute. No submit button value is serialized since the form was not submitted using a button. Data from file select elements is not serialized. Elements that do not contain a value attribute are represented with the empty string value.

    This method can act on a jQuery object that has selected individual form controls, such as <input>, <textarea>, and <select>. However, it is typically easier to select the <form> element itself for serialization:

    
     $( "form" ).submit(function( event ) {
    diff --git a/entries/show.xml b/entries/show.xml
    index 535b9c5d..c47faccc 100644
    --- a/entries/show.xml
    +++ b/entries/show.xml
    @@ -37,7 +37,7 @@ $( ".target" ).show();
         It is recommended to use different classes with .addClass(), .removeClass() or .toggleClass(). Another approach is using .attr( "style", "display: block !important;" ); be careful, though, as it overwrites the style attribute of the element.

    When a duration, a plain object, or a "complete" function is provided, .show() becomes an animation method. The .show() method animates the width, height, and opacity of the matched elements simultaneously.

    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.

    -

    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/slideDown.xml b/entries/slideDown.xml index 7ca77825..d4f27544 100644 --- a/entries/slideDown.xml +++ b/entries/slideDown.xml @@ -44,7 +44,7 @@ $( "#clickme" ).click(function() {
    Figure 1 - Illustration of the slideDown() effect

    Easing

    -

    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.

    Callback Function

    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() ).

    diff --git a/entries/slideToggle.xml b/entries/slideToggle.xml index 12b97ad1..ecf801a6 100644 --- a/entries/slideToggle.xml +++ b/entries/slideToggle.xml @@ -53,7 +53,7 @@ $( "#clickme" ).click(function() {
    Figure 2 - Illustration of the slideToggle() effect when showing the image

    Easing

    -

    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.

    Callback Function

    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() ).

    diff --git a/entries/slideUp.xml b/entries/slideUp.xml index 8db63468..648665c9 100644 --- a/entries/slideUp.xml +++ b/entries/slideUp.xml @@ -44,7 +44,7 @@ $( "#clickme" ).click(function() {
    Figure 1 - Illustration of the slideUp() effect

    Easing

    -

    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.

    Callback Function

    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() ).

    diff --git a/entries/target-selector.xml b/entries/target-selector.xml index 5d60f3da..b010a5ce 100644 --- a/entries/target-selector.xml +++ b/entries/target-selector.xml @@ -7,8 +7,8 @@ Selects the target element indicated by the fragment identifier of the document's URI. -

    If the document's URI contains a fragment identifier, or hash, then the :target selector will match the element with an ID that matches the identifier. For example, given a document with a URI of http://example.com/#foo, $( "p:target" ) will select the <p id="foo"> element.

    -

    Further discussion of this usage can be found in the W3C CSS specification.

    +

    If the document's URI contains a fragment identifier, or hash, then the :target selector will match the element with an ID that matches the identifier. For example, given a document with a URI of https://example.com/#foo, $( "p:target" ) will select the <p id="foo"> element.

    +

    Further discussion of this usage can be found in the W3C CSS specification.

    diff --git a/entries/toggle.xml b/entries/toggle.xml index 6c290220..deb0224d 100644 --- a/entries/toggle.xml +++ b/entries/toggle.xml @@ -40,7 +40,7 @@ $( ".target" ).toggle();

    The matched elements will be revealed or hidden immediately, with no animation, by changing the CSS display property. If the element is initially displayed, it will be hidden; if hidden, it will be shown. The display property is saved and restored as needed. If an element has a display value of inline, then is hidden and shown, it will once again be displayed inline.

    When a duration, a plain object, or a single "complete" function is provided, .toggle() becomes an animation method. The .toggle() method animates the width, height, and opacity of the matched elements simultaneously. When these properties reach 0 after a hiding animation, 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.

    -

    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/visible-selector.xml b/entries/visible-selector.xml
    index 6b159740..45c5b973 100644
    --- a/entries/visible-selector.xml
    +++ b/entries/visible-selector.xml
    @@ -13,7 +13,7 @@
         

    This selector is the opposite of the :hidden selector. So, every element selected by :visible isn't selected by :hidden and vice versa.

    All option elements are considered hidden, regardless of their selected state.

    During animations that hide an element, the element is considered visible until the end of the animation. During animations to show an element, the element is considered visible at the start at the animation.

    -

    How :visible is calculated was changed in jQuery 1.3.2. The release notes outline the changes in more detail.

    +

    How :visible is calculated was changed in jQuery 1.3.2. The release notes outline the changes in more detail.

    jQuery 3 slightly modifies the meaning of :visible (and therefore of :hidden). Starting with this version, elements will be considered :visible if they have any layout boxes, including those of zero width and/or height. For example, br elements and inline elements with no content will be selected by the :visible selector.

    diff --git a/notes.xsl b/notes.xsl index 50f94fc0..cfaf9bfb 100644 --- a/notes.xsl +++ b/notes.xsl @@ -17,7 +17,7 @@ Selected elements are in the order of their appearance in the document. - Forms and their child elements should not use input names or ids that conflict with properties of a form, such as submit, length, or method. Name conflicts can cause confusing failures. For a complete list of rules and to check your markup for these problems, see DOMLint. + Forms and their child elements should not use input names or ids that conflict with properties of a form, such as submit, length, or method. Name conflicts can cause confusing failures. For a complete list of rules and to check your markup for these problems, see DOMLint. The value reported by is not guaranteed to be accurate when the element or its parent is hidden. To get an accurate value, ensure the element is visible before using . jQuery will attempt to temporarily show and then re-hide an element in order to measure its dimensions, but this is unreliable and (even when accurate) can significantly impact page performance. This show-and-rehide measurement feature may be removed in a future version of jQuery. @@ -44,7 +44,7 @@ The method removes all data and event handlers associated with the removed nodes. - Due to browser security restrictions, most "Ajax" requests are subject to the same origin policy; the request can not successfully retrieve data from a different domain, subdomain, port, or protocol. + Due to browser security restrictions, most "Ajax" requests are subject to the same origin policy; the request can not successfully retrieve data from a different domain, subdomain, port, or protocol. Script and JSONP requests are not subject to the same origin policy restrictions. diff --git a/pages/Types.html b/pages/Types.html index b31c47ee..612caa10 100644 --- a/pages/Types.html +++ b/pages/Types.html @@ -11,7 +11,7 @@

    This page documents data types appearing in jQuery function signatures, whether defined by JavaScript itself or further restricted by jQuery. Unless explicitly stated otherwise, jQuery functions require primitive values where applicable, and do not accept their Object-wrapped forms. If you want to study these concepts in depth, take a look at MDN.

    -

    You should be able to try out most of the examples below by just copying them to your browser's JavaScript Console (Chrome, Safari with Develop menu activated, IE 8+) or Firebug console (Firefox). +

    You should be able to try out most of the examples below by just copying them to your browser's JavaScript Console.

    Whenever an example mentions that a type defaults to a boolean value, the result is good to know when using that type in a boolean context:

    @@ -645,16 +645,11 @@

    jQuery

    XMLHttpRequest

    Some of jQuery's Ajax functions return the native XMLHttpRequest (XHR) object, or pass it as an argument to success/error/complete handlers, so that you can do additional processing or monitoring on the request. Note that Ajax functions only return or pass an XHR object when an XHR object is actually used in the request. For example, JSONP requests and cross-domain GET requests use a script element rather than an XHR object.

    -

    Although the XHR object is a standard, there are variations in its behavior on different browsers. Refer to the WHATWG site and browsers' documentation for more information: +

    Although the XHR object is a standard, there are variations in its behavior on different browsers. Refer to the WHATWG site and Mozilla Developer Network for more information:

    -

    Google does not appear to have an official page for their XHR documentation for Chrome. As of version 5, Chrome does not support the use of the file protocol for XHR requests. -

    jqXHR

    As of jQuery 1.5, the $.ajax() method returns the jqXHR object, which is a superset of the XMLHTTPRequest object. For more information, see the jqXHR section of the $.ajax entry

    From fb25247da95dc147faa36800143e0d8cd2092dfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?= Date: Fri, 30 Mar 2018 16:42:11 +0200 Subject: [PATCH 06/25] 1.12.30 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3fb8caf1..c473dadc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "api.jquery.com", - "version": "1.12.29", + "version": "1.12.30", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index fcf103c2..cf6a5be8 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "api.jquery.com", "title": "jQuery API Docs", "description": "API reference documentation for the jQuery JavaScript Library.", - "version": "1.12.29", + "version": "1.12.30", "homepage": "https://github.com/jquery/api.jquery.com", "author": { "name": "jQuery Foundation and other contributors" From d2d71d72d85ac117d5f0927204290bbdca9f321d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?= Date: Fri, 30 Mar 2018 16:47:37 +0200 Subject: [PATCH 07/25] Misc: Convert a few remaining HTTP links to HTTPS --- entries/attr.xml | 2 +- entries/data.xml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/entries/attr.xml b/entries/attr.xml index 1628ec72..2dc8a25e 100644 --- a/entries/attr.xml +++ b/entries/attr.xml @@ -69,7 +69,7 @@
    -

    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:

    • diff --git a/entries/data.xml b/entries/data.xml index 71c6c10f..a8ff396c 100644 --- a/entries/data.xml +++ b/entries/data.xml @@ -31,7 +31,7 @@ $( "body" ).data(); // { foo: 52, bar: { myType: "test", count: 40 }, baz: [ 1,

    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.

    @@ -89,11 +89,11 @@ alert( $( "body" ).data( "foo" ) ); // undefined $( "body" ).data( "bar", "foobar" ); alert( $( "body" ).data( "bar" ) ); // foobar
    -

    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" }.

    HTML5 data-* Attributes

    -

    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.

    From 385c4db76d613a6409c7e0aa69a65c821d0c2ca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?= Date: Fri, 30 Mar 2018 16:55:44 +0200 Subject: [PATCH 08/25] 1.12.31 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index c473dadc..fb070fc4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "api.jquery.com", - "version": "1.12.30", + "version": "1.12.31", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index cf6a5be8..4bfeeb70 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "api.jquery.com", "title": "jQuery API Docs", "description": "API reference documentation for the jQuery JavaScript Library.", - "version": "1.12.30", + "version": "1.12.31", "homepage": "https://github.com/jquery/api.jquery.com", "author": { "name": "jQuery Foundation and other contributors" From bcdb151494299fa840db8b7bb7721985684c26e3 Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Tue, 24 Apr 2018 05:03:23 -0400 Subject: [PATCH 09/25] Event: Clarify valid chars for events and namespaces Fixes #1086 Fixes #1085 Closes #1093 --- entries/on.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/entries/on.xml b/entries/on.xml index 622fff6a..735f82b4 100644 --- a/entries/on.xml +++ b/entries/on.xml @@ -35,14 +35,14 @@

    The .on() method attaches event handlers to the currently selected set of elements in the jQuery object. As of jQuery 1.7, the .on() method provides all functionality required for attaching event handlers. For help in converting from older jQuery event methods, see .bind(), .delegate(), and .live(). To remove events bound with .on(), see .off(). To attach an event that runs only once and then removes itself, see .one()

    Event names and namespaces

    Any event names can be used for the events argument. jQuery will pass through the browser's standard JavaScript event types, calling the handler function when the browser generates events due to user actions such as click. In addition, the .trigger() method can trigger both standard browser event names and custom event names to call attached handlers. Event names should only contain alphanumerics, underscore, and colon characters.

    -

    An event name can be qualified by event namespaces that simplify removing or triggering the event. For example, "click.myPlugin.simple" defines both the myPlugin and simple namespaces for this particular click event. A click event handler attached via that string could be removed with .off("click.myPlugin") or .off("click.simple") without disturbing other click handlers attached to the elements. Namespaces are similar to CSS classes in that they are not hierarchical; only one name needs to match. Namespaces beginning with an underscore are reserved for jQuery's use.

    +

    An event name can be qualified by event namespaces that simplify removing or triggering the event. For example, "click.myPlugin.simple" defines both the myPlugin and simple namespaces for this particular click event. A click event handler attached via that string could be removed with .off("click.myPlugin") or .off("click.simple") without disturbing other click handlers attached to the elements. Namespaces are similar to CSS classes in that they are not hierarchical; only one name needs to match. Namespaces should contain upper/lowercase letters and digits only.

    In the second form of .on(), the events argument is a plain object. The keys are strings in the same form as the events argument with space-separated event type names and optional namespaces. The value for each key is a function (or false value) that is used as the handler instead of the final argument to the method. In other respects, the two forms are identical in their behavior as described below.

    -

    Direct and delegated events

    +

    Direct and delegated event handlers

    The majority of browser events bubble, or propagate, from the deepest, innermost element (the event target) in the document where they occur all the way up to the body and the document element. In Internet Explorer 8 and lower, a few events such as change and submit do not natively bubble but jQuery patches these to bubble and create consistent cross-browser behavior.

    If selector is omitted or is null, the event handler is referred to as direct or directly-bound. The handler is called every time an event occurs on the selected elements, whether it occurs directly on the element or bubbles from a descendant (inner) element.

    When a selector is provided, the event handler is referred to as delegated. The handler is not called when the event occurs directly on the bound element, but only for descendants (inner elements) that match the selector. jQuery bubbles the event from the event target up to the element where the handler is attached (i.e., innermost to outermost element) and runs the handler for any elements along that path matching the selector.

    Event handlers are bound only to the currently selected elements; they must exist at the time your code makes the call to .on(). To ensure the elements are present and can be selected, place scripts after the elements in the HTML markup or perform event binding inside a document ready handler. Alternatively, use delegated events to attach event handlers.

    -

    Delegated events have the advantage that they can process events from descendant elements that are added to the document at a later time. By picking an element that is guaranteed to be present at the time the delegated event handler is attached, you can use delegated events to avoid the need to frequently attach and remove event handlers. This element could be the container element of a view in a Model-View-Controller design, for example, or document if the event handler wants to monitor all bubbling events in the document. The document element is available in the head of the document before loading any other HTML, so it is safe to attach events there without waiting for the document to be ready.

    +

    Delegated event handlers have the advantage that they can process events from descendant elements that are added to the document at a later time. By picking an element that is guaranteed to be present at the time the delegated event handler is attached, you can use delegated events to avoid the need to frequently attach and remove event handlers. This element could be the container element of a view in a Model-View-Controller design, for example, or document if the event handler wants to monitor all bubbling events in the document. The document element is available in the head of the document before loading any other HTML, so it is safe to attach events there without waiting for the document to be ready.

    In addition to their ability to handle events on descendant elements not yet created, another advantage of delegated events is their potential for much lower overhead when many elements must be monitored. On a data table with 1,000 rows in its tbody, this example attaches a handler to 1,000 elements:

    
     $( "#dataTable tbody tr" ).on( "click", function() {
    @@ -55,7 +55,7 @@ $( "#dataTable tbody" ).on( "click", "tr", function() {
       console.log( $( this ).text() );
     });
         
    -

    Note: Delegated events do not work for SVG.

    +

    Note: Delegated event handlers do not work for SVG.

    The event handler and its environment

    The handler argument is a function (or the value false, see below), and is required unless you pass an object for the events argument. You can provide an anonymous handler function at the point of the .on() call, as the examples have done above, or declare a named function and pass its name:

    
    
    From 07fab9b17cb8727bee1d60e5d2b122ee75f3a538 Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?=
     
    Date: Wed, 13 Jun 2018 14:29:59 +0200
    Subject: [PATCH 10/25] Misc: Convert a few more remaining links to HTTPS
    
    ---
     README.md                    | 2 +-
     categories.xml               | 2 +-
     entries/contents.xml         | 2 +-
     entries/jQuery.getJSON.xml   | 2 +-
     entries/jQuery.parseJSON.xml | 2 +-
     entries/parent-selector.xml  | 2 +-
     pages/Types.html             | 2 +-
     7 files changed, 7 insertions(+), 7 deletions(-)
    
    diff --git a/README.md b/README.md
    index 1141cd22..f7920803 100644
    --- a/README.md
    +++ b/README.md
    @@ -2,7 +2,7 @@
     
     ## 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](https://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
     
    diff --git a/categories.xml b/categories.xml
    index b08956d9..d247f835 100644
    --- a/categories.xml
    +++ b/categories.xml
    @@ -68,7 +68,7 @@
         
         
           
         
     	
    diff --git a/entries/contents.xml b/entries/contents.xml
    index 70188f7b..f4118e0c 100644
    --- a/entries/contents.xml
    +++ b/entries/contents.xml
    @@ -55,7 +55,7 @@ $( "p" )
     $( "#frameDemo" ).contents().find( "a" ).css( "background-color", "#BADA55" );
     ]]>
         
       
       
    diff --git a/entries/jQuery.getJSON.xml b/entries/jQuery.getJSON.xml
    index 11a26341..07a926cc 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 https://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 d47eab4b..16e1f6dd 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 https://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/parent-selector.xml b/entries/parent-selector.xml index 72832a23..bd3fd743 100644 --- a/entries/parent-selector.xml +++ b/entries/parent-selector.xml @@ -9,7 +9,7 @@

    This is the inverse of :empty.

    One important thing to note regarding the use of :parent (and :empty) is that child nodes 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.

    To obtain the parents or ancestors of an existing jQuery set, see the .parent() and .parents() methods.

    diff --git a/pages/Types.html b/pages/Types.html index 612caa10..de56ce02 100644 --- a/pages/Types.html +++ b/pages/Types.html @@ -666,4 +666,4 @@

    Callbacks Object

    XML Document

    A document object created by the browser's XML DOM parser, usually from a string representing XML. XML documents have different semantics than HTML documents, but most of the traversing and manipulation methods provided by jQuery will work with them.

    Assert

    -

    A reference to or instance of the object holding all of QUnit's assertions. See the API documentation for QUnit.assert for details.

    +

    A reference to or instance of the object holding all of QUnit's assertions. See the API documentation for QUnit.assert for details.

    From 6cbafd74922ba8de0f88bf1fc5f8198902e26bd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?= Date: Wed, 13 Jun 2018 14:30:07 +0200 Subject: [PATCH 11/25] 1.12.32 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index fb070fc4..3704bcb7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "api.jquery.com", - "version": "1.12.31", + "version": "1.12.32", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4bfeeb70..3de1003d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "api.jquery.com", "title": "jQuery API Docs", "description": "API reference documentation for the jQuery JavaScript Library.", - "version": "1.12.31", + "version": "1.12.32", "homepage": "https://github.com/jquery/api.jquery.com", "author": { "name": "jQuery Foundation and other contributors" From 613f22cd40f8b2a9af772b0ac8c0072cd545ed43 Mon Sep 17 00:00:00 2001 From: Andy Li Date: Mon, 23 Jul 2018 16:11:01 +0800 Subject: [PATCH 12/25] Categories: Fix a syntax error in a link to the blogpost Closes #1100 --- categories.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/categories.xml b/categories.xml index d247f835..c02b93b3 100644 --- a/categories.xml +++ b/categories.xml @@ -73,7 +73,7 @@
    From 53308ef90ca423e35b101aea27055a48c1c67b54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?= Date: Mon, 23 Jul 2018 10:12:50 +0200 Subject: [PATCH 13/25] 1.12.33 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3704bcb7..5e1b2f79 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "api.jquery.com", - "version": "1.12.32", + "version": "1.12.33", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 3de1003d..509a4a72 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "api.jquery.com", "title": "jQuery API Docs", "description": "API reference documentation for the jQuery JavaScript Library.", - "version": "1.12.32", + "version": "1.12.33", "homepage": "https://github.com/jquery/api.jquery.com", "author": { "name": "jQuery Foundation and other contributors" From 3a94c501985adee0c01af01df4bc79968d82bb7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?= Date: Mon, 23 Jul 2018 19:09:21 +0200 Subject: [PATCH 14/25] 1.12.34 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5e1b2f79..95efd8ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "api.jquery.com", - "version": "1.12.33", + "version": "1.12.34", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 509a4a72..9584d1eb 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "api.jquery.com", "title": "jQuery API Docs", "description": "API reference documentation for the jQuery JavaScript Library.", - "version": "1.12.33", + "version": "1.12.34", "homepage": "https://github.com/jquery/api.jquery.com", "author": { "name": "jQuery Foundation and other contributors" From 8407a384caf4895692bb3786cdaf0c6ec8b2ba68 Mon Sep 17 00:00:00 2001 From: Sakthipriyan Vairamani Date: Wed, 26 Sep 2018 02:03:05 +0530 Subject: [PATCH 15/25] deferred.catch: Add a missing word Closes gh-1106 --- entries/deferred.catch.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entries/deferred.catch.xml b/entries/deferred.catch.xml index 17df8dda..e6e3d95a 100644 --- a/entries/deferred.catch.xml +++ b/entries/deferred.catch.xml @@ -15,7 +15,7 @@

    deferred.catch( fn ) is an alias to deferred.then( null, fn ). Read its page for more information.

    - Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can rejection handlers using the .catch method. + Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can add rejection handlers using the .catch method. + diff --git a/entries/jQuery.unique.xml b/entries/jQuery.unique.xml index b31ce023..56a8ced5 100644 --- a/entries/jQuery.unique.xml +++ b/entries/jQuery.unique.xml @@ -43,4 +43,5 @@ $( "div:eq(2)" ).text( "Post-unique there are " + divs.length + " elements." ) + diff --git a/entries/toggleClass.xml b/entries/toggleClass.xml index dfe45f2d..51bdf746 100644 --- a/entries/toggleClass.xml +++ b/entries/toggleClass.xml @@ -208,5 +208,6 @@ $( "a" ).on( "click", function( event ) {
    This signature (only!) is deprecated as of jQuery 3.0.
    + \ No newline at end of file From ed497086495d7cb6f7379b42c8cc2fb77bc6812b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?= Date: Tue, 13 Nov 2018 17:52:48 +0100 Subject: [PATCH 17/25] 1.12.35 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 95efd8ae..a3cc492e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "api.jquery.com", - "version": "1.12.34", + "version": "1.12.35", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 9584d1eb..f06fac96 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "api.jquery.com", "title": "jQuery API Docs", "description": "API reference documentation for the jQuery JavaScript Library.", - "version": "1.12.34", + "version": "1.12.35", "homepage": "https://github.com/jquery/api.jquery.com", "author": { "name": "jQuery Foundation and other contributors" From 3d88fc63dc82f5d4ddf390076f537dcadbe4cf64 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Wed, 21 Nov 2018 10:51:43 -0500 Subject: [PATCH 18/25] data: Explicitly disavow writing data-* attributes (#1112) Also includes general cleanup. Fixes gh-1023 Closes gh-1112 --- entries/data.xml | 54 ++++++++++++++++++++---------------------------- 1 file changed, 22 insertions(+), 32 deletions(-) diff --git a/entries/data.xml b/entries/data.xml index a8ff396c..7e742da1 100644 --- a/entries/data.xml +++ b/entries/data.xml @@ -24,14 +24,14 @@

    We can set several distinct values for a single element and retrieve them later:

    
     $( "body" ).data( "foo", 52 );
    -$( "body" ).data( "bar", { myType: "test", count: 40 } );
    +$( "body" ).data( "bar", { isManual: true } );
     $( "body" ).data( { baz: [ 1, 2, 3 ] } );
     $( "body" ).data( "foo" ); // 52
    -$( "body" ).data(); // { foo: 52, bar: { myType: "test", count: 40 }, baz: [ 1, 2, 3 ] }
    +$( "body" ).data(); // { foo: 52, bar: { isManual: true }, baz: [ 1, 2, 3 ] }
           
    -

    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" }.

    +

    Using the data() method to update data does not affect attributes in the DOM. To set a data-* attribute value, use attr.

    +

    Prior to jQuery 1.4.3, .data( obj ) completely replaced all data. Since jQuery 1.4.3, data is instead extended by shallow merge.

    +

    Since jQuery 3, every two-character sequence of "-" (U+002D) followed by a lowercase ASCII letter in a key is replaced by the uppercase version of the letter, in alignment with the HTML dataset API. 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.

    @@ -76,46 +76,36 @@ $( "span:last" ).text( $( "div" ).data( "test" ).last ); 1.4 - Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. + Return arbitrary data associated with the first element in the jQuery collection, as set by data() or by an HTML5 data-* attribute. -

    The .data() method allows us to attach data of any type to DOM elements in a way that is safe from circular references and therefore from memory leaks. We can retrieve several distinct values for a single element one at a time, or as a set:

    +

    The .data() method allows us to read data previously associated with DOM elements. We can retrieve several distinct values for a single element one at a time, or as a set:

    
    -alert( $( "body" ).data( "foo" ) );
    -alert( $( "body" ).data() );
    -      
    -

    The above lines alert the data values that were set on the body element. If no data at all was set on that element, undefined is returned.

    -
    
    -alert( $( "body" ).data( "foo" ) ); // undefined
    -$( "body" ).data( "bar", "foobar" );
    -alert( $( "body" ).data( "bar" ) ); // foobar
    +var elem = document.createElement( "span" );
    +$( elem ).data( "foo" ); // undefined
    +$( elem ).data(); // {}
    +
    +$( elem ).data( "foo", 42 );
    +$( elem ).data( "foo" ); // 42
    +$( elem ).data(); // { foo: 42 }
           
    -

    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" }.

    +

    Calling .data() with no parameters returns a JavaScript object containing each stored value as a property. The object can be used directly to get data values (but note that property names originally containing dashes will have been modified as described below).

    +

    Since jQuery 3, every two-character sequence of "-" (U+002D) followed by a lowercase ASCII letter in a key is replaced by the uppercase version of the letter, in alignment with the HTML dataset API. A statement like $( "body" ).data( { "my-name": "aValue" } ).data(); will return { myName: "aValue" }.

    - HTML5 data-* Attributes + HTML5 data-* Attributes

    -

    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.

    +

    Since jQuery 1.4.3, data-* attributes are used to initialize jQuery data. An element's data-* attributes are retrieved the first time the data() method is invoked upon it, and then are no longer accessed or mutated (all values are stored internally by jQuery).

    +

    Every attempt is made to convert the attribute's string value to a JavaScript value (this includes booleans, numbers, objects, arrays, and null). A string is only converted to a number if doing so doesn't change its representation (for example, the string "100" is converted to the number 100, but "1E02" and "100.000" are left as strings because their numeric value of 100 serializes to "100"). When a string starts with '{' or '[', then jQuery.parseJSON is used to parse it; it must follow valid JSON syntax including quoted property names. A string not parseable as a JavaScript value is not converted.

    +

    To retrieve a data-* attribute value as an unconverted string, use the attr() method.

    +

    Since jQuery 1.6, dashes in data-* attribute names have been processed in alignment with the HTML dataset API.

    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.

    +

    The following comparisons are all true:

    
     $( "div" ).data( "role" ) === "page";
     $( "div" ).data( "lastValue" ) === 43;
     $( "div" ).data( "hidden" ) === true;
     $( "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.

    -

    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:

    -
    
    -var mydata = $( "#mydiv" ).data();
    -if ( mydata.count < 9 ) {
    -  mydata.count = 43;
    -  mydata.status = "embiggened";
    -}
    -    
    From fb2edb2c941ef7a44cac66a0e4be45e630ae48d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?= Date: Wed, 21 Nov 2018 16:52:32 +0100 Subject: [PATCH 19/25] 1.12.36 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index a3cc492e..e3059772 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "api.jquery.com", - "version": "1.12.35", + "version": "1.12.36", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index f06fac96..34ef2b83 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "api.jquery.com", "title": "jQuery API Docs", "description": "API reference documentation for the jQuery JavaScript Library.", - "version": "1.12.35", + "version": "1.12.36", "homepage": "https://github.com/jquery/api.jquery.com", "author": { "name": "jQuery Foundation and other contributors" From 812e1326b3323bbf6c32ac284e3e50be17b3cff4 Mon Sep 17 00:00:00 2001 From: Matt Doyle Date: Wed, 28 Nov 2018 08:19:06 +1100 Subject: [PATCH 20/25] width: Add quotes around .css() width argument (#1118) Fixes gh-1102 Closes gh-1118 --- entries/width.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entries/width.xml b/entries/width.xml index f073145a..c197119c 100644 --- a/entries/width.xml +++ b/entries/width.xml @@ -8,7 +8,7 @@ Get the current computed width for the first element in the set of matched elements. -

    The difference between .css(width) and .width() is that the latter returns a unit-less pixel value (for example, 400) while the former returns a value with units intact (for example, 400px). The .width() method is recommended when an element's width needs to be used in a mathematical calculation.

    +

    The difference between .css( "width" ) and .width() is that the latter returns a unit-less pixel value (for example, 400) while the former returns a value with units intact (for example, 400px). The .width() method is recommended when an element's width needs to be used in a mathematical calculation.

    Figure 1 - Illustration of the measured width
    From e56c5736cc65dd9ee7d6b08584afaf7387e1fe9c Mon Sep 17 00:00:00 2001 From: Philippe Cloutier Date: Sun, 10 Feb 2019 18:06:13 -0500 Subject: [PATCH 21/25] load: Fix singular references to matched elements Fixes #1125 Closes #1126 --- entries/load.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entries/load.xml b/entries/load.xml index 3444cb90..c0f6a46f 100644 --- a/entries/load.xml +++ b/entries/load.xml @@ -18,12 +18,12 @@ A callback function that is executed when the request completes. - Load data from the server and place the returned HTML into the matched element. + Load data from the server and place the returned HTML into the matched elements.

    Note: Prior to jQuery 3.0, the event handling suite also had a method named .load(). Older versions of jQuery determined which method to fire based on the set of arguments passed to it.

    -

    This method is the simplest way to fetch data from the server. It is roughly equivalent to $.get(url, data, success) except that it is a method rather than global function and it has an implicit callback function. When a successful response is detected (i.e. when textStatus is "success" or "notmodified"), .load() sets the HTML contents of the matched element to the returned data. This means that most uses of the method can be quite simple:

    +

    This method is the simplest way to fetch data from the server. It is roughly equivalent to $.get(url, data, success) except that it is a method rather than global function and it has an implicit callback function. When a successful response is detected (i.e. when textStatus is "success" or "notmodified"), .load() sets the HTML contents of the matched elements to the returned data. This means that most uses of the method can be quite simple:

    
     $( "#result" ).load( "ajax/test.html" );
         
    From 4b6b1e9f08412e892cfb6a76db36898114f1a04a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?= Date: Mon, 8 Apr 2019 11:06:08 +0200 Subject: [PATCH 22/25] 1.12.37 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index e3059772..a70406ed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "api.jquery.com", - "version": "1.12.36", + "version": "1.12.37", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 34ef2b83..11fc459d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "api.jquery.com", "title": "jQuery API Docs", "description": "API reference documentation for the jQuery JavaScript Library.", - "version": "1.12.36", + "version": "1.12.37", "homepage": "https://github.com/jquery/api.jquery.com", "author": { "name": "jQuery Foundation and other contributors" From 51f3979e25b4dc0c13d38e588fef602d8d288415 Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Mon, 15 Apr 2019 11:20:39 -0400 Subject: [PATCH 23/25] Ajax: Add scriptAttrs Fixes #1091 Closes #1092 Can be landed once https://github.com/jquery/jquery/issues/3028 is closed and we know a specific version for the feature. I've assume 3.4.0 here. --- entries/jQuery.ajax.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/entries/jQuery.ajax.xml b/entries/jQuery.ajax.xml index 80157d28..f75de949 100644 --- a/entries/jQuery.ajax.xml +++ b/entries/jQuery.ajax.xml @@ -145,8 +145,11 @@ $.ajax({ By default, data passed in to the data option as an object (technically, anything other than a 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 a DOMDocument, or other non-processed data, set this option to false. + + Defines an object with additional attributes to be used in a "script" or "jsonp" request. The key represents the name of the attribute and the value is the attribute's value. If this object is provided it will force the use of a script-tag transport. For example, this can be used to set nonce, integrity, or crossorigin attributes to satisfy Content Security Policy requirements. + - Only applies when the "script" transport is used (e.g., cross-domain requests with "jsonp" or "script" dataType and "GET" type). Sets the charset attribute on the script tag used in the request. Used when the character set on the local page is not the same as the one on the remote script. + Only applies when the "script" transport is used. Sets the charset attribute on the script tag used in the request. Used when the character set on the local page is not the same as the one on the remote script. Alternatively, the charset attribute can be specified in scriptAttrs instead, which will also ensure the use of the "script" transport. From 05e21403b1a807adb0e3bae152cee68773996100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82=C4=99biowski-Owczarek?= Date: Mon, 29 Apr 2019 18:49:13 +0200 Subject: [PATCH 24/25] jQuery.globalEval: Document the nonce option Fixes #1123 Closes #1131 --- entries/jQuery.globalEval.xml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/entries/jQuery.globalEval.xml b/entries/jQuery.globalEval.xml index ad6b7d1e..1900cd78 100644 --- a/entries/jQuery.globalEval.xml +++ b/entries/jQuery.globalEval.xml @@ -7,6 +7,17 @@ The JavaScript code to execute. + + 3.4.0 + + The JavaScript code to execute. + + + + The nonce attribute passed to the executed script. + + + Execute some JavaScript code globally.

    This method behaves differently from using a normal JavaScript eval() in that it's executed within the global context (which is important for loading external scripts dynamically).

    @@ -15,7 +26,19 @@ Execute a script in the global context. + + + Execute a script with a nonce value on a site with Content Security Policy enabled. +