From 71d8a0894a9e62f86d8e3d294a65be6fcb6e2205 Mon Sep 17 00:00:00 2001 From: Arthur Verschaeve Date: Wed, 11 Feb 2015 20:20:56 +0100 Subject: [PATCH 01/16] removeAttr: update note on support in IE Fixes gh-642 Closes gh-652 --- entries/removeAttr.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entries/removeAttr.xml b/entries/removeAttr.xml index 0dd1abea..73665aeb 100644 --- a/entries/removeAttr.xml +++ b/entries/removeAttr.xml @@ -10,7 +10,7 @@ Remove an attribute from each element in the set of matched elements.

The .removeAttr() method uses the JavaScript removeAttribute() function, but it has the advantage of being able to be called directly on a jQuery object and it accounts for different attribute naming across browsers.

-

Note: Removing an inline onclick event handler using .removeAttr() doesn't achieve the desired effect in Internet Explorer 6, 7, or 8. To avoid potential problems, use .prop() instead:

+

Note: Removing an inline onclick event handler using .removeAttr() doesn't achieve the desired effect in Internet Explorer 8, 9 and 11. To avoid potential problems, use .prop() instead:


 $element.prop( "onclick", null );
 console.log( "onclick property: ", $element[ 0 ].onclick );

From 7ac9ef58309526069247b730aefd5f634af480c7 Mon Sep 17 00:00:00 2001
From: Arthur Verschaeve 
Date: Tue, 24 Feb 2015 07:27:16 +0100
Subject: [PATCH 02/16] child-selector: remove sentence about browser support

Closes gh-662
---
 entries/child-selector.xml | 1 -
 1 file changed, 1 deletion(-)

diff --git a/entries/child-selector.xml b/entries/child-selector.xml
index 5016a1b3..1b1b27c2 100644
--- a/entries/child-selector.xml
+++ b/entries/child-selector.xml
@@ -13,7 +13,6 @@
   
   Selects all direct child elements specified by "child" of elements specified by "parent".
   
-    

As a CSS selector, the child combinator is supported by all modern web browsers including Safari, Firefox, Opera, Chrome, and Internet Explorer 7 and above, but notably not by Internet Explorer versions 6 and below. However, in jQuery, this selector (along with all others) works across all supported browsers, including IE6.

The child combinator (E > F) can be thought of as a more specific form of the descendant combinator (E F) in that it selects only first-level descendants.

From 0669a93695eb8033e07725d6f9fbcbbbf205c3c0 Mon Sep 17 00:00:00 2001 From: Arthur Verschaeve Date: Mon, 2 Mar 2015 17:52:39 +0100 Subject: [PATCH 03/16] Ajax: Update notes about jqXHR.success(), .error() and .complete() Fixes gh-650 Closes gh-677 --- entries/jQuery.ajax.xml | 6 +++--- entries/jQuery.get.xml | 2 +- entries/jQuery.getJSON.xml | 2 +- entries/jQuery.post.xml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/entries/jQuery.ajax.xml b/entries/jQuery.ajax.xml index d7b49447..72b3fbb6 100644 --- a/entries/jQuery.ajax.xml +++ b/entries/jQuery.ajax.xml @@ -19,7 +19,7 @@ The content type sent in the request header that tells the server what kind of response it will accept in return. - By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. As of jQuery 1.8, the use of async: false with jqXHR ($.Deferred) is deprecated; you must use the success/error/complete callback options instead of the corresponding methods of the jqXHR object such as jqXHR.done() or the deprecated jqXHR.success(). + By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. As of jQuery 1.8, the use of async: false with jqXHR ($.Deferred) is deprecated; you must use the success/error/complete callback options instead of the corresponding methods of the jqXHR object such as jqXHR.done(). @@ -203,7 +203,7 @@ $.ajax({
  • jqXHR.done(function( data, textStatus, jqXHR ) {}); -

    An alternative construct to the success callback option, the .done() method replaces the deprecated jqXHR.success() method. Refer to deferred.done() for implementation details.

    +

    An alternative construct to the success callback option, refer to deferred.done() for implementation details.

  • jqXHR.fail(function( jqXHR, textStatus, errorThrown ) {}); @@ -222,7 +222,7 @@ $.ajax({
-

Deprecation Notice: The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callbacks are deprecated as of jQuery 1.8. To prepare your code for their eventual removal, use jqXHR.done(), jqXHR.fail(), and jqXHR.always() instead.

+

Deprecation Notice: The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callbacks are removed as of jQuery 3.0. You can use jqXHR.done(), jqXHR.fail(), and jqXHR.always() instead.


 // Assign handlers immediately after making the request,
diff --git a/entries/jQuery.get.xml b/entries/jQuery.get.xml
index 51b50c64..6e17c416 100644
--- a/entries/jQuery.get.xml
+++ b/entries/jQuery.get.xml
@@ -75,7 +75,7 @@ jqxhr.always(function() {
 });
     

Deprecation Notice

-

The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callback methods introduced in jQuery 1.5 are deprecated as of jQuery 1.8. To prepare your code for their eventual removal, use jqXHR.done(), jqXHR.fail(), and jqXHR.always() instead.

+

The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callback methods are removed as of jQuery 3.0. You can use jqXHR.done(), jqXHR.fail(), and jqXHR.always() instead.

diff --git a/entries/jQuery.getJSON.xml b/entries/jQuery.getJSON.xml index 97c8b0a9..1fbc4484 100644 --- a/entries/jQuery.getJSON.xml +++ b/entries/jQuery.getJSON.xml @@ -87,7 +87,7 @@ jqxhr.complete(function() { });

Deprecation Notice

-

The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callback methods introduced in jQuery 1.5 are deprecated as of jQuery 1.8. To prepare your code for their eventual removal, use jqXHR.done(), jqXHR.fail(), and jqXHR.always() instead.

+

The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callback methods are removed as of jQuery 3.0. You can use jqXHR.done(), jqXHR.fail(), and jqXHR.always() instead.

diff --git a/entries/jQuery.post.xml b/entries/jQuery.post.xml index 2300cbe7..e1f42f4f 100644 --- a/entries/jQuery.post.xml +++ b/entries/jQuery.post.xml @@ -77,7 +77,7 @@ jqxhr.always(function() {

Deprecation Notice

-

The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callback methods introduced in jQuery 1.5 are deprecated as of jQuery 1.8. To prepare your code for their eventual removal, use jqXHR.done(), jqXHR.fail(), and jqXHR.always() instead.

+

The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callback methods are removed as of jQuery 3.0. You can use jqXHR.done(), jqXHR.fail(), and jqXHR.always() instead.

From 5065c15679624ad4efb81b5b4f121ecdde64c07d Mon Sep 17 00:00:00 2001 From: Arthur Verschaeve Date: Thu, 9 Apr 2015 15:15:12 +0200 Subject: [PATCH 04/16] unwrap: add `selector` argument Fixes gh-689 Closes gh-711 --- entries/unwrap.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/entries/unwrap.xml b/entries/unwrap.xml index d966952c..d3a7b405 100644 --- a/entries/unwrap.xml +++ b/entries/unwrap.xml @@ -4,6 +4,12 @@ 1.4 + + 3.0 + + A selector to check the parent element against. If an element's parent does not match the selector, the element won't be unwrapped. + + Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.

The .unwrap() method removes the element's parent. This is effectively the inverse of the .wrap() method. The matched elements (and their siblings, if any) replace their parents within the DOM structure.

From 2a82d396dcbd3d967762ec12eb2ac0f5ff15edf3 Mon Sep 17 00:00:00 2001 From: Arthur Verschaeve Date: Mon, 6 Apr 2015 16:06:09 +0200 Subject: [PATCH 05/16] Selector: correct `removed` version number Fixes gh-696 Ref gh-702 --- entries/selector.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entries/selector.xml b/entries/selector.xml index 971a2535..e9e61c1e 100644 --- a/entries/selector.xml +++ b/entries/selector.xml @@ -1,5 +1,5 @@ - + .selector 1.3 From b3d0a3f99d9efd444010feb82724293d1db128f3 Mon Sep 17 00:00:00 2001 From: Arthur Verschaeve Date: Thu, 9 Apr 2015 19:19:50 +0200 Subject: [PATCH 06/16] Context: removed in 3.0 Closes gh-702 --- entries/context.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entries/context.xml b/entries/context.xml index a7377fa1..0cf0f7b4 100644 --- a/entries/context.xml +++ b/entries/context.xml @@ -1,5 +1,5 @@ - + .context 1.3 From 742c377f469ffd43afa6c7bc94b2156d99e3c83b Mon Sep 17 00:00:00 2001 From: Arthur Verschaeve Date: Thu, 7 May 2015 21:55:42 +0200 Subject: [PATCH 07/16] jQuery.uniqueSort: add new entry, deprecate `jQuery.unique()` Fixes gh-731 Closes gh-736 --- entries/jQuery.unique.xml | 3 ++- entries/jQuery.uniqueSort.xml | 45 +++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 entries/jQuery.uniqueSort.xml diff --git a/entries/jQuery.unique.xml b/entries/jQuery.unique.xml index 0546cfa7..b31ce023 100644 --- a/entries/jQuery.unique.xml +++ b/entries/jQuery.unique.xml @@ -1,5 +1,5 @@ - + jQuery.unique() 1.1.3 @@ -9,6 +9,7 @@ Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers. +

As of jQuery 3.0, this method is deprecated and just an alias of jQuery.uniqueSort(). Please use that method instead.

The $.unique() function searches through an array of objects, sorting the array, and removing any duplicate nodes. A node is considered a duplicate if it is the exact same node as one already in the array; two different nodes with identical attributes are not considered to be duplicates. This function only works on plain JavaScript arrays of DOM elements, and is chiefly used internally by jQuery. You probably will never need to use it.

As of jQuery 1.4 the results will always be returned in document order.

diff --git a/entries/jQuery.uniqueSort.xml b/entries/jQuery.uniqueSort.xml new file mode 100644 index 00000000..0bccb245 --- /dev/null +++ b/entries/jQuery.uniqueSort.xml @@ -0,0 +1,45 @@ + + + jQuery.uniqueSort() + + 3.0 + + The Array of DOM elements. + + + Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers. + +

The $.uniqueSort() function searches through an array of objects, sorting the array, and removing any duplicate nodes. A node is considered a duplicate if it is the exact same node as one already in the array; two different nodes with identical attributes are not considered to be duplicates. This function only works on plain JavaScript arrays of DOM elements, and is chiefly used internally by jQuery. You probably will never need to use it.

+

Prior to jQuery 3.0, this method was called jQuery.unique().

+

As of jQuery 1.4 the results will always be returned in document order.

+
+ + Removes any duplicate elements from the array of divs. + + + + + +
From 66a42ea670be1ee3173191c1c4132d8fe2e03716 Mon Sep 17 00:00:00 2001 From: Arthur Verschaeve Date: Sun, 24 May 2015 22:06:17 +0200 Subject: [PATCH 08/16] wrapAll: change description of function argument Fixes gh-605 Closes gh-745 --- entries/wrapAll.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/entries/wrapAll.xml b/entries/wrapAll.xml index c6dc02ca..7d8c741d 100644 --- a/entries/wrapAll.xml +++ b/entries/wrapAll.xml @@ -14,8 +14,7 @@ 1.4 - A callback function returning the HTML content or jQuery object to wrap around the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. - + A callback function returning the HTML content or jQuery object to wrap around all the matched elements. Within the function, this refers to the first element in the set. Prior to jQuery 3.0, the callback was incorrectly called for every element in the set and received the index position of the element in the set as an argument. From 270b51818cf5e07f70b1d0cd1689f83518579663 Mon Sep 17 00:00:00 2001 From: Aurelio De Rosa Date: Sun, 14 Jun 2015 14:55:40 +0100 Subject: [PATCH 09/16] data: Document behavior changes Document changes that align the method to the Dataset API's behavior Fixes gh-730 Closes gh-758 --- entries/data.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/entries/data.xml b/entries/data.xml index f54a229c..80ccee99 100644 --- a/entries/data.xml +++ b/entries/data.xml @@ -31,6 +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](http://www.w3.org/TR/html5/dom.html#dom-dataset). 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.

@@ -88,6 +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" }.

HTML5 data-* Attributes

From d0e7282d4c0e9c02263ebcb15ecd419a25113941 Mon Sep 17 00:00:00 2001 From: Aurelio De Rosa Date: Mon, 27 Jul 2015 14:03:43 +0100 Subject: [PATCH 10/16] Visibility filters: Specified new behavior Fixes gh-737 Closes gh-789 --- entries/hidden-selector.xml | 1 + entries/visible-selector.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/entries/hidden-selector.xml b/entries/hidden-selector.xml index 6712c736..3653643e 100644 --- a/entries/hidden-selector.xml +++ b/entries/hidden-selector.xml @@ -18,6 +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.

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.

+

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

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.

+

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.

From 4e65b6dfa6c6f2d486572c30dbf5c436b1524030 Mon Sep 17 00:00:00 2001 From: Aurelio De Rosa Date: Mon, 19 Oct 2015 00:47:01 +0100 Subject: [PATCH 11/16] isNumeric: Updated description based on new behavior Fixes gh-817 Closes gh-819 --- entries/jQuery.isNumeric.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/entries/jQuery.isNumeric.xml b/entries/jQuery.isNumeric.xml index 80edc02d..d449e785 100644 --- a/entries/jQuery.isNumeric.xml +++ b/entries/jQuery.isNumeric.xml @@ -10,6 +10,7 @@

The $.isNumeric() method checks whether its argument represents a numeric value. If so, it returns true. Otherwise it returns false. The argument can be of any type.

+

As of jQuery 3.0 $.isNumeric() returns true only if the argument is of type number, or if it's of type string and it can be coerced into finite numbers. In all other cases, it returns false.

Sample return values of $.isNumeric with various inputs. From 4651f4415ca00b8f9862d3a39a3eeea8600ddfff Mon Sep 17 00:00:00 2001 From: Aurelio De Rosa Date: Mon, 14 Dec 2015 02:04:06 +0000 Subject: [PATCH 12/16] Document that addClass and removeClass change the attribute Fixes gh-814 Closes gh-846 --- entries/addClass.xml | 2 ++ entries/removeClass.xml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/entries/addClass.xml b/entries/addClass.xml index 476251d8..8b8a0564 100644 --- a/entries/addClass.xml +++ b/entries/addClass.xml @@ -19,6 +19,8 @@ Adds the specified class(es) to each element in the set of matched elements.

It's important to note that this method does not replace a class. It simply adds the class, appending it to any which may already be assigned to the elements.

+

Before jQuery version 3.0, the .addClass() method manipulated the className property of the selected elements, not the class attribute. Once the property was changed, it was the browser that updated the attribute accordingly. An implication of this behavior was that this method only worked for documents with HTML DOM semantics (e.g., not pure XML documents).

+

As of jQuery 3.0 this behavior is changed to improve the support for XML documents, including SVG. Starting from this version, the class attribute is used instead. So, .addClass() can be used on XML or SVG documents.

More than one class may be added at a time, separated by a space, to the set of matched elements, like so:


 $( "p" ).addClass( "myClass yourClass" );
diff --git a/entries/removeClass.xml b/entries/removeClass.xml
index 8bb11196..6a85ea72 100644
--- a/entries/removeClass.xml
+++ b/entries/removeClass.xml
@@ -19,6 +19,8 @@
   Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
   
     

If a class name is included as a parameter, then only that class will be removed from the set of matched elements. If no class names are specified in the parameter, all classes will be removed.

+

Before jQuery version 3.0, the .removeClass() method manipulated the className property of the selected elements, not the class attribute. Once the property was changed, it was the browser that updated the attribute accordingly. This means that when the class attribute was updated and the last class name was removed, the browser might have set the attribute's value to an empty string instead of removing the attribute completely. An implication of this behavior was that this method only worked for documents with HTML DOM semantics (e.g., not pure XML documents).

+

As of jQuery 3.0 this behavior is changed to improve the support for XML documents, including SVG. Starting from this version, the class attribute is used instead. So, .removeClass() can be used on XML or SVG documents.

More than one class may be removed at a time, separated by a space, from the set of matched elements, like so:


 $( "p" ).removeClass( "myClass yourClass" )

From 0e81757e88af8cb820cf294513d0004c63068629 Mon Sep 17 00:00:00 2001
From: Aurelio De Rosa 
Date: Fri, 8 Jan 2016 00:33:39 +0000
Subject: [PATCH 13/16] toggleClass: Document deprecation of a signature

Fixes gh-851
Closes gh-860
---
 entries/toggleClass.xml | 174 +++++++++++++++++++++-------------------
 1 file changed, 90 insertions(+), 84 deletions(-)

diff --git a/entries/toggleClass.xml b/entries/toggleClass.xml
index 1d034d86..5a18aa05 100644
--- a/entries/toggleClass.xml
+++ b/entries/toggleClass.xml
@@ -1,67 +1,62 @@
 
-
-  .toggleClass()
-  
-    1.0
-    
-      One or more class names (separated by spaces) to be toggled for each element in the matched set.
-    
-  
-  
-    1.3
-    
-      One or more class names (separated by spaces) to be toggled for each element in the matched set.
-    
-    
-      A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed.
-    
-  
-  
-    1.4
-    
-      A boolean value to determine whether the class should be added or removed.
-    
-  
-  
-    1.4
-    
-      
-      
-      
-        
-      A function that returns class names to be toggled in the class attribute of each element in the matched set. Receives the index position of the element in the set, the old class value, and the state as arguments.
-    
-    
-      A boolean value to determine whether the class should be added or removed.
-    
-  
-  Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the state argument.
-  
-    

This method takes one or more class names as its parameter. In the first version, if an element in the matched set of elements already has the class, then it is removed; if an element does not have the class, then it is added. For example, we can apply .toggleClass() to a simple <div>:

-

+
+  
+    .toggleClass()
+    
+      1.0
+      
+        One or more class names (separated by spaces) to be toggled for each element in the matched set.
+      
+    
+    
+      1.3
+      
+        One or more class names (separated by spaces) to be toggled for each element in the matched set.
+      
+      
+        A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed.
+      
+    
+    
+      1.4
+      
+        
+        
+        
+        
+        A function that returns class names to be toggled in the class attribute of each element in the matched set. Receives the index position of the element in the set, the old class value, and the state as arguments.
+      
+      
+        A boolean value to determine whether the class should be added or removed.
+      
+    
+    Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the state argument.
+    
+      

This method takes one or more class names as its parameter. In the first version, if an element in the matched set of elements already has the class, then it is removed; if an element does not have the class, then it is added. For example, we can apply .toggleClass() to a simple <div>:

+

 <div class="tumble">Some text.</div>
-    
-

The first time we apply $( "div.tumble" ).toggleClass( "bounce" ), we get the following:

-

+      
+

The first time we apply $( "div.tumble" ).toggleClass( "bounce" ), we get the following:

+

 <div class="tumble bounce">Some text.</div>
-    
-

The second time we apply $( "div.tumble" ).toggleClass( "bounce" ), the <div> class is returned to the single tumble value:

-
<div class="tumble">Some text.</div>
-

Applying .toggleClass( "bounce spin" ) to the same <div> alternates between <div class="tumble bounce spin"> and <div class="tumble">.

-

The second version of .toggleClass() uses the second parameter for determining whether the class should be added or removed. If this parameter's value is true, then the class is added; if false, the class is removed. In essence, the statement:

-

+      
+

The second time we apply $( "div.tumble" ).toggleClass( "bounce" ), the <div> class is returned to the single tumble value:

+
<div class="tumble">Some text.</div>
+

Applying .toggleClass( "bounce spin" ) to the same <div> alternates between <div class="tumble bounce spin"> and <div class="tumble">.

+

The second version of .toggleClass() uses the second parameter for determining whether the class should be added or removed. If this parameter's value is true, then the class is added; if false, the class is removed. In essence, the statement:

+

 $( "#foo" ).toggleClass( className, addOrRemove );
-    
-

is equivalent to:

-

+      
+

is equivalent to:

+

 if ( addOrRemove ) {
   $( "#foo" ).addClass( className );
 } else {
   $( "#foo" ).removeClass( className );
 }
-    
-

As of jQuery 1.4, if no arguments are passed to .toggleClass(), all class names on the element the first time .toggleClass() is called will be toggled. Also as of jQuery 1.4, the class name to be toggled can be determined by passing in a function.

-

+      
+

As of jQuery 1.4, if no arguments are passed to .toggleClass(), all class names on the element the first time .toggleClass() is called will be toggled. Also as of jQuery 1.4, the class name to be toggled can be determined by passing in a function.

+

 $( "div.foo" ).toggleClass(function() {
   if ( $( this ).parent().is( ".bar" ) ) {
     return "happy";
@@ -69,17 +64,17 @@ $( "div.foo" ).toggleClass(function() {
     return "sad";
   }
 });
-
-

This example will toggle the happy class for <div class="foo"> elements if their parent element has a class of bar; otherwise, it will toggle the sad class.

-
- - Toggle the class 'highlight' when a paragraph is clicked. - - - - - - Add the "highlight" class to the clicked paragraph on every third click of that paragraph, remove it every first and second click. - - - - - - Toggle the class name(s) indicated on the buttons for each div. - - - - - - - - - - - -
+ + + + + + + + + + + 1.4 + + A boolean value to determine whether the class should be added or removed. + + + +
This signature (only!) is deprecated as of jQuery 3.0.
+
+
+
\ No newline at end of file From d3b74ac4c6f5b28bc6535c814c145eb73aa910fb Mon Sep 17 00:00:00 2001 From: Aurelio De Rosa Date: Fri, 11 Mar 2016 01:12:46 +0000 Subject: [PATCH 14/16] jQuery.parseJSON: Added deprecation note for jQuery 3 Fixes gh-898 Closes gh-899 --- entries/jQuery.parseJSON.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/entries/jQuery.parseJSON.xml b/entries/jQuery.parseJSON.xml index bc9dcc78..d0965e41 100644 --- a/entries/jQuery.parseJSON.xml +++ b/entries/jQuery.parseJSON.xml @@ -1,5 +1,5 @@ - + @@ -26,6 +26,7 @@

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/.

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.

+

As of jQuery 3.0, $.parseJSON is deprecated. To parse JSON objects, use the native JSON.parse method instead.

Parse a JSON string. From 853a06b97d738c406b6fb7267b5040b8674e682d Mon Sep 17 00:00:00 2001 From: Aurelio De Rosa Date: Thu, 7 Apr 2016 01:03:27 +0100 Subject: [PATCH 15/16] jQuery.parseHTML: Specified behavior of version 3 Fixes gh-903 Closes gh-907 --- entries/jQuery.parseHTML.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/entries/jQuery.parseHTML.xml b/entries/jQuery.parseHTML.xml index 06f59937..9ffcba73 100644 --- a/entries/jQuery.parseHTML.xml +++ b/entries/jQuery.parseHTML.xml @@ -17,6 +17,7 @@

jQuery.parseHTML uses native methods to convert the string to a set of DOM nodes, which can then be inserted into the document. These methods do render all trailing or leading text (even if that's just whitespace). To prevent trailing/leading whitespace from being converted to text nodes you can pass the HTML string through jQuery.trim.

By default, the context is the current document if not specified or given as null or undefined. If the HTML was to be used in another document such as an iframe, that frame's document could be used.

+

As of 3.0 the default behavior is changed. If the context is not specified or given as null or undefined, a new document is used. This can potentially improve security because inline events will not execute when the HTML is parsed. Once the parsed HTML is injected into a document it does execute, but this gives tools a chance to traverse the created DOM and remove anything deemed unsafe. This improvement does not apply to internal uses of jQuery.parseHTML as they usually pass in the current document. Therefore, a statement like $( "#log" ).append( $( htmlString ) ) is still subject to the injection of malicious code.

Security Considerations

Most jQuery APIs that accept HTML strings will run scripts that are included in the HTML. jQuery.parseHTML does not run script in the parsed HTML unless keepScripts is explicitly true. However, it is still possible in most environments to execute script indirectly, for example via the <img onerror> attribute. The caller should be aware of this and guard against it by cleaning or escaping any untrusted inputs from sources such as the URL or cookies. For future compatibility, callers should not depend on the ability to run any script content when keepScripts is unspecified or false.

From 4791120eebd71fb0fbd2cbbe29bc8fdf073c8f69 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Thu, 5 May 2016 18:05:26 -0400 Subject: [PATCH 16/16] jQuery.when: Document changes in 3.0 Ref https://github.com/jquery/jquery/commit/356a3bccb0e7468a2c8ce7d8c9c6cd0c5d436b8b Fixes gh-921 --- entries/jQuery.when.xml | 59 ++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/entries/jQuery.when.xml b/entries/jQuery.when.xml index 7f053618..5614f998 100644 --- a/entries/jQuery.when.xml +++ b/entries/jQuery.when.xml @@ -3,60 +3,69 @@ jQuery.when() 1.5 - - One or more Deferred objects, or plain JavaScript objects. + + A Promise-like object to resolve a Deferred object, or any value to encapsulate within a Deferred object. + + + + 1.5 + + Two or values to resolve or encapsulate with Deferred objects for Promise.all-like fulfillment aggregation. Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events. -

If a single Deferred is passed to jQuery.when(), its Promise object (a subset of the Deferred methods) is returned by the method. Additional methods of the Promise object can be called to attach callbacks, such as deferred.then. When the Deferred is resolved or rejected, usually by the code that created the Deferred originally, the appropriate callbacks will be called. For example, the jqXHR object returned by jQuery.ajax() is a Promise-compatible object and can be used this way:

+

If no arguments are provided, jQuery.when() will return a resolved Promise.

+

+$.when().then(function( x ) {
+  alert( "I fired immediately" );
+});
+    
+

If a single argument is provided and it is a Promise or has a then method, jQuery.when() will return a Promise that will resolve or reject identically to the argument.


 $.when( $.ajax( "test.aspx" ) ).then(function( data, textStatus, jqXHR ) {
   alert( jqXHR.status ); // Alerts 200
 });
     
-

If a single argument is passed to jQuery.when() and it is not a Deferred or a Promise, it will be treated as a resolved Deferred and any doneCallbacks attached will be executed immediately. The doneCallbacks are passed the original argument. In this case any failCallbacks you might set are never called since the Deferred is never rejected. For example:

+

If any other single argument is provided, jQuery.when() will return a Promise that is resolved to it.


 $.when( { testing: 123 } ).done(function( x ) {
   alert( x.testing ); // Alerts "123"
 });
     
-

If you don't pass it any arguments at all, jQuery.when() will return a resolved promise.

-

-$.when().then(function( x ) {
-  alert( "I fired immediately" );
-});
-    
-

In the case where multiple Deferred objects are passed to jQuery.when(), the method returns the Promise from a new "master" Deferred object that tracks the aggregate state of all the Deferreds it has been passed. The method will resolve its master Deferred as soon as all the Deferreds resolve, or reject the master Deferred as soon as one of the Deferreds is rejected. If the master Deferred is resolved, the doneCallbacks for the master Deferred are executed. The arguments passed to the doneCallbacks provide the resolved values for each of the Deferreds, and matches the order the Deferreds were passed to jQuery.when(). For example:

+

If more than one argument is provided, jQuery.when() will return the Promise from a new "master" Deferred object that tracks their aggregate state (upgrading each to a Deferred object as in the single-argument case where necessary). The master Deferred will resolve as soon as all subordinates resolve, or reject as soon as one is rejected. If the master Deferred is resolved, the resolution context and values of each subordinate are preserved in its resolution context (an array of all the resolution contexts) and resolution values (the resolution values of each subordinate appear as a single value, with multi-valued resolutions theirselves becoming arrays), each preserving the order in which the subordinate was provided to jQuery.when(). For example:


 var d1 = $.Deferred();
 var d2 = $.Deferred();
+var d3 = $.Deferred();
 
-$.when( d1, d2 ).done(function ( v1, v2 ) {
-    console.log( v1 ); // "Fish"
-    console.log( v2 ); // "Pizza"
+$.when( d1, d2 ).done(function ( v1, v2, v3 ) {
+    console.log( v1 );   // "Fish"
+    console.log( v2 );   // ["Pizza", "Pie"]
+    console.log( v3 );   // undefined
+    console.log( this ); // [{ where: "Ocean" }, undefined, undefined]
 });
 
-d1.resolve( "Fish" );
-d2.resolve( "Pizza" );
+d1.resolveWith( { where: "Ocean" }, [ "Fish" ] );
+d2.resolve( "Pizza", "Pie" );
+d3.resolve();
     
-

In the event a Deferred was resolved with no value, the corresponding doneCallback argument will be undefined. If a Deferred resolved to a single value, the corresponding argument will hold that value. In the case where a Deferred resolved to multiple values, the corresponding argument will be an array of those values. For example:

+

If more than one argument is provided and one of the arguments is rejected, jQuery.when() immediately rejects with corresponding context and values. Note that some of the subordinates may still be unresolved at that point. For example:


 var d1 = $.Deferred();
 var d2 = $.Deferred();
 var d3 = $.Deferred();
 
-$.when( d1, d2, d3 ).done(function ( v1, v2, v3 ) {
-    console.log( v1 ); // v1 is undefined
-    console.log( v2 ); // v2 is "abc"
-    console.log( v3 ); // v3 is an array [ 1, 2, 3, 4, 5 ]
+$.when( d1, d2 ).fail(function ( rejection ) {
+    console.log( rejection ); // "Pie"
+    console.log( this );      // { type: "Pizza" }
 });
 
-d1.resolve();
-d2.resolve( "abc" );
-d3.resolve( 1, 2, 3, 4, 5 );
+d1.resolve( "Fish" );
+d2.rejectWith( { type: "Pizza" }, [ "Pie" ] );
+d3.resolve();
     
-

In the multiple-Deferreds case where one of the Deferreds is rejected, jQuery.when() immediately fires the failCallbacks for its master Deferred. Note that some of the Deferreds may still be unresolved at that point. The arguments passed to the failCallbacks match the signature of the failCallback for the Deferred that was rejected. If you need to perform additional processing for this case, such as canceling any unfinished ajax requests, you can keep references to the underlying jqXHR objects in a closure and inspect/cancel them in the failCallback.

+

Regardless of provided arguments, methods of the returned Promise object can be called to attach callbacks, such as deferred.then. When the Deferred is resolved or rejected, usually by the code that created the Deferred originally, the appropriate callbacks will be called.

Execute a function after two ajax requests are successful. (See the jQuery.ajax() documentation for a complete description of success and error cases for an ajax request).