From 03ea98efd98179a44c41126d6abc4a034bcb10ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?= Date: Thu, 9 Apr 2020 00:16:45 +0200 Subject: [PATCH] All: Updates for jQuery 1.12/2.2-3.5 Fixes #947 Fixes #949 Fixes #950 Fixes #1142 Ref #970 Ref #972 --- categories.xml | 41 ++++++++++++++++++- entries/addClass.xml | 33 +++++++++++++++- entries/contents.xml | 2 + entries/css.xml | 4 ++ entries/eq-selector.xml | 4 +- entries/even-selector.xml | 5 ++- entries/even.xml | 47 ++++++++++++++++++++++ entries/filter.xml | 4 +- entries/first-selector.xml | 4 +- entries/first.xml | 19 ++++----- entries/gt-selector.xml | 4 +- entries/hover.xml | 4 +- entries/jQuery.ajax.xml | 3 +- entries/jQuery.extend.xml | 2 + entries/jQuery.get.xml | 3 +- entries/jQuery.getScript.xml | 2 + entries/jQuery.holdReady.xml | 13 +++++- entries/jQuery.htmlPrefilter.xml | 68 ++------------------------------ entries/jQuery.isArray.xml | 6 ++- entries/jQuery.isFunction.xml | 4 +- entries/jQuery.isNumeric.xml | 6 ++- entries/jQuery.isWindow.xml | 6 +++ entries/jQuery.now.xml | 10 +++-- entries/jQuery.post.xml | 3 +- entries/jQuery.proxy.xml | 6 ++- entries/jQuery.trim.xml | 6 ++- entries/jQuery.type.xml | 14 ++++--- entries/last-selector.xml | 4 +- entries/last.xml | 11 ++++-- entries/lt-selector.xml | 4 +- entries/not.xml | 4 +- entries/nth-child-selector.xml | 13 ++++-- entries/odd-selector.xml | 5 ++- entries/odd.xml | 47 ++++++++++++++++++++++ entries/removeClass.xml | 44 +++++++++++++++++++-- entries/toggleClass.xml | 31 +++++++++++---- entries2html.xsl | 2 +- 37 files changed, 364 insertions(+), 124 deletions(-) create mode 100644 entries/even.xml create mode 100644 entries/odd.xml diff --git a/categories.xml b/categories.xml index 78f012b1..6b752af5 100644 --- a/categories.xml +++ b/categories.xml @@ -71,6 +71,11 @@

For more information, see the Release Notes/Changelog at https://blog.jquery.com/2016/06/09/jquery-3-0-final-released/

]]> + + For more information, see the Release Notes/Changelog at https://blog.jquery.com/2017/03/16/jquery-3-2-0-is-out/

+ ]]>
+
For more information, see the Release Notes/Changelog at https://blog.jquery.com/2018/01/19/jquery-3-3-0-a-fragrant-bouquet-of-deprecations-and-is-that-a-new-feature/

@@ -81,6 +86,11 @@

For more information, see the Release Notes/Changelog at https://blog.jquery.com/2019/04/10/jquery-3-4-0-released/

]]>
+ + For more information, see the Release Notes/Changelog at https://blog.jquery.com/2020/04/10/jquery-3-5-0-released/

+ ]]>
+
@@ -447,7 +457,36 @@ var files = event.originalEvent.dataTransfer.files; jQuery.readyException was added.

+

Aspects of the API that were changed in the corresponding version of jQuery. Version 3.1 added the jQuery.readyException API.

+

For more information, see the Release Notes/Changelog

+
+ ]]>
+
+ + Aspects of the API that were changed in the corresponding version of jQuery. Version 3.2 added support for custom CSS properties, made .contents() work on the <template> element & made .width() & .height() ignore CSS transforms. A few APIs were deprecated. The deprecated module was added back to the slim build.

+

For more information, see the Release Notes/Changelog

+
+ ]]>
+
+ + Aspects of the API that were changed in the corresponding version of jQuery. .addClass(), .removeClass() & .toggleClass() now work on arrays of classes; a few APIs were deprecated.

+

For more information, see the Release Notes/Changelog

+
+ ]]>
+
+ + Aspects of the API that were changed in the corresponding version of jQuery. nonce & nomodule attributes are now preserved during script manipulation, layout thrashing was eliminated in some cases in .width() & .height() APIs. Radio elements state is now updated before event handlers run. Passing data now works when triggering all events, including focus. A minor security fix is also included.

+

For more information, see the Release Notes/Changelog

+
+ ]]>
+
+ + Aspects of the API that were changed in the corresponding version of jQuery. Security fixes, new .even() & .odd() methods; jQuery.globalEval now accepts context; unsuccessful HTTP script responses are no longer evaluated; performance improvements. jQuery.trim is now deprecated.

+

For more information, see the jQuery Core 3.5 Upgrade guide and the Release Notes/Changelog


]]>
diff --git a/entries/addClass.xml b/entries/addClass.xml index 3b28a708..819f8e14 100644 --- a/entries/addClass.xml +++ b/entries/addClass.xml @@ -7,10 +7,16 @@ One or more space-separated classes to be added to the class attribute of each matched element. + + 3.3 + + An array of classes to be added to the class attribute of each matched element. + + 1.4 - A function returning one or more space-separated class names to be added to the existing class name(s). Receives the index position of the element in the set and the existing class name(s) as arguments. Within the function, this refers to the current element in the set. + A function returning one or more space-separated classes or an array of classes to be added to the existing class name(s). Receives the index position of the element in the set and the existing class name(s) as arguments. Within the function, this refers to the current element in the set. @@ -82,6 +88,29 @@ $( "p" ).last().addClass( "selected highlight" );

Hello

and

Goodbye

+]]> + + + Add the classes "selected" and "highlight" to the matched elements (3.3+ syntax). + + + Hello

+

and

+

Goodbye

]]>
@@ -122,4 +151,6 @@ $( "div" ).addClass(function( index, currentClass ) { + + diff --git a/entries/contents.xml b/entries/contents.xml index f4118e0c..950411ba 100644 --- a/entries/contents.xml +++ b/entries/contents.xml @@ -8,6 +8,7 @@

Given a jQuery object that represents a set of DOM elements, the .contents() method allows us to search through the immediate children of these elements in the DOM tree and construct a new jQuery object from the matching elements. The .contents() and .children() methods are similar, except that the former includes text nodes and comment nodes as well as HTML elements in the resulting jQuery object. Please note that most jQuery operations don't support text nodes and comment nodes. The few that do will have an explicit note on their API documentation page.

The .contents() method can also be used to get the content document of an iframe, if the iframe is on the same domain as the main page.

+

As of jQuery 3.2, .contents() returns contents of <template> elements as well.

Consider a simple <div> with a number of text nodes, each of which is separated by two line break elements (<br>):


 <div class="container">
@@ -60,4 +61,5 @@ $( "#frameDemo" ).contents().find( "a" ).css( "background-color", "#BADA55" );
   
   
   
+  
 
diff --git a/entries/css.xml b/entries/css.xml
index 34fc7237..0fd97457 100644
--- a/entries/css.xml
+++ b/entries/css.xml
@@ -23,6 +23,7 @@
       

Retrieval of shorthand CSS properties (e.g., margin, background, border), although functional with some browsers, is not guaranteed. For example, if you want to retrieve the rendered border-width, use: $( elem ).css( "borderTopWidth" ), $( elem ).css( "borderBottomWidth" ), and so on.

An element should be connected to the DOM when calling .css() on it. If it isn't, jQuery may throw an error.

As of jQuery 1.9, passing an array of style properties to .css() will result in an object of property-value pairs. For example, to retrieve all four rendered border-width values, you could use $( elem ).css([ "borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth" ]).

+

As of jQuery 3.2, CSS Custom Properties (also called CSS Variables) are supported: $( "p" ).css( "--custom-property" ). Note that you need to provide the property name as-is, camelCasing it won't work as it does for regular CSS properties.

Get the background color of a clicked div. @@ -106,6 +107,7 @@ $( "div" ).click(function() { + @@ -157,6 +159,7 @@ $( "div.example" ).css( "width", function( index ) {

This example sets the widths of the matched elements to incrementally larger values.

Note: If nothing is returned in the setter function (ie. function( index, style ){} ), or if undefined is returned, the current value is not changed. This is useful for selectively setting values only when certain criteria are met.

+

As of jQuery 3.2, CSS Custom Properties (also called CSS Variables) are supported: $( "p" ).css( "--custom-property", "value" ). Note that you need to provide the property name as-is, camelCasing it won't work as it does for regular CSS properties.

Change the color of any paragraph to red on mouseover event. @@ -282,5 +285,6 @@ $( "div" ).on( "click", function() { + diff --git a/entries/eq-selector.xml b/entries/eq-selector.xml index 0c985fca..a191d31b 100644 --- a/entries/eq-selector.xml +++ b/entries/eq-selector.xml @@ -17,7 +17,9 @@
Select the element at index n within the matched set. -

As of jQuery 3.4, the :eq pseudo-class is deprecated. Remove it from your selectors and filter the results later using .eq().

+
+

As of jQuery 3.4, the :eq pseudo-class is deprecated. Remove it from your selectors and filter the results later using .eq().

+

The index-related selectors (:eq(), :lt(), :gt(), :even, :odd) filter the set of elements that have matched the expressions that precede them. They narrow the set down based on the order of the elements within this matched set. For example, if elements are first selected with a class selector (.myclass) and four elements are returned, these elements are given indices 0 through 3 for the purposes of these selectors.

Note that since JavaScript arrays use 0-based indexing, these selectors reflect that fact. This is why $( ".myclass:eq(1)" ) selects the second element in the document with the class myclass, rather than the first. In contrast, :nth-child(n) uses 1-based indexing to conform to the CSS specification.

Prior to jQuery 1.8, the :eq(index) selector did not accept a negative value for index (though the .eq(index) method did).

diff --git a/entries/even-selector.xml b/entries/even-selector.xml index ba2dc5d5..bfc8038a 100644 --- a/entries/even-selector.xml +++ b/entries/even-selector.xml @@ -5,8 +5,11 @@ 1.0 - Selects even elements, zero-indexed. See also odd. + Selects even elements, zero-indexed. See also :odd. +
+

As of jQuery 3.4, the :even pseudo-class is deprecated. Remove it from your selectors and filter the results later using .even() (available in jQuery 3.5.0 or newer).

+

In particular, note that the 0-based indexing means that, counter-intuitively, :even selects the first element, third element, and so on within the matched set.

diff --git a/entries/even.xml b/entries/even.xml new file mode 100644 index 00000000..cecff9e4 --- /dev/null +++ b/entries/even.xml @@ -0,0 +1,47 @@ + + + .even() + + 3.5 + + Reduce the set of matched elements to the even ones in the set, numbered from zero. + +

Given a jQuery object that represents a set of DOM elements, the .even() method constructs a new jQuery object from the even elements in that set. Counting starts from zero!

+

Consider a page with a simple list on it:

+

+<ul>
+  <li>list item 1</li>
+  <li>list item 2</li>
+  <li>list item 3</li>
+  <li>list item 4</li>
+  <li>list item 5</li>
+</ul>
+    
+

We can apply this method to the set of list items:

+

+$( "li" ).even().css( "background-color", "red" );
+    
+

The result of this call is a red background for the first, third & 5th items.

+
+ + Highlight the even items in a list. + + + +
  • Look:
  • +
  • This is some text in a list.
  • +
  • This is a note about it.
  • +
  • This is another note about it.
  • + +]]> +
    + + +
    diff --git a/entries/filter.xml b/entries/filter.xml index 01489193..ed92d385 100644 --- a/entries/filter.xml +++ b/entries/filter.xml @@ -42,9 +42,9 @@

    We can apply this method to the set of list items:

    
    -$( "li" ).filter( ":even" ).css( "background-color", "red" );
    +$( "li" ).filter( ":nth-child(2n)" ).css( "background-color", "red" );
         
    -

    The result of this call is a red background for items 1, 3, and 5, as they match the selector (recall that :even and :odd use 0-based indexing).

    +

    The result of this call is a red background for items 2, 4, and 6, as they match the selector.

    Using a Filter Function

    The second form of this method allows us to filter elements against a function rather than a selector. For each element, if the function returns true (or a "truthy" value), the element will be included in the filtered set; otherwise, it will be excluded. Suppose we have a somewhat more involved HTML snippet:

    
    diff --git a/entries/first-selector.xml b/entries/first-selector.xml
    index ded45ccb..1308ff5e 100644
    --- a/entries/first-selector.xml
    +++ b/entries/first-selector.xml
    @@ -7,7 +7,9 @@
       
       Selects the first matched DOM element.
       
    -    

    As of jQuery 3.4, the :first pseudo-class is deprecated. Remove it from your selectors and filter the results later using .first().

    +
    +

    As of jQuery 3.4, the :first pseudo-class is deprecated. Remove it from your selectors and filter the results later using .first().

    +

    The :first pseudo-class is equivalent to :eq( 0 ). It could also be written as :lt( 1 ). While this matches only a single element, :first-child can match more than one: One for each parent.

    diff --git a/entries/first.xml b/entries/first.xml index f73f8f10..90ac489c 100644 --- a/entries/first.xml +++ b/entries/first.xml @@ -24,21 +24,22 @@ $( "li" ).first().css( "background-color", "red" );

    The result of this call is a red background for the first item.

    - Highlight the first span in a paragraph. + Highlight the first item in a list. - Look: - This is some text in a paragraph. - This is a note about it. -

    +
      +
    • Look:
    • +
    • This is some text in a list.
    • +
    • This is a note about it.
    • +
    • This is another note about it.
    • +
    ]]>
    diff --git a/entries/gt-selector.xml b/entries/gt-selector.xml index 8ad903fc..1aad2e3d 100644 --- a/entries/gt-selector.xml +++ b/entries/gt-selector.xml @@ -17,7 +17,9 @@ Select all elements at an index greater than index within the matched set. -

    As of jQuery 3.4, the :gt pseudo-class is deprecated. Remove it from your selectors and filter the results later using .slice(). For example, :gt(3) can be replaced with a call to .slice( 4 ) (the provided index needs to be increased by one).

    +
    +

    As of jQuery 3.4, the :gt pseudo-class is deprecated. Remove it from your selectors and filter the results later using .slice(). For example, :gt(3) can be replaced with a call to .slice( 4 ) (the provided index needs to be increased by one).

    +

    index-related selectors

    diff --git a/entries/hover.xml b/entries/hover.xml index f6656b0c..2ddab1fa 100644 --- a/entries/hover.xml +++ b/entries/hover.xml @@ -102,10 +102,10 @@ $( selector ).on( "mouseenter mouseleave", handlerInOut ); Slide the next sibling LI up or down on hover, and toggle a class.
  • "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.
  • +
  • "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. Prior to jQuery 3.5.0, unsuccessful HTTP responses with a script Content-Type were still executed.
  • "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.
  • @@ -457,4 +457,5 @@ $.ajax({ + diff --git a/entries/jQuery.extend.xml b/entries/jQuery.extend.xml index b28ec2e0..56fbab89 100644 --- a/entries/jQuery.extend.xml +++ b/entries/jQuery.extend.xml @@ -35,6 +35,7 @@

    Keep in mind that the target object (first argument) will be modified, and will also be returned from $.extend(). If, however, you want to preserve both of the original objects, you can do so by passing an empty object as the target:

    var object = $.extend({}, object1, object2);

    The merge performed by $.extend() is not recursive by default; if a property of the first object is itself an object or array, it will be completely overwritten by a property with the same key in the second or subsequent object. The values are not merged. This can be seen in the example below by examining the value of banana. However, by passing true for the first function argument, objects will be recursively merged.

    +

    Warning: Versions prior to 3.4 had a security issue where calling jQuery.extend(true, {}, object) on an unsanitized object containing a __proto__ property would extend Object.prototype.

    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.

    @@ -106,4 +107,5 @@ $( "#log" ).append( "
    settings -- " + JSON.stringify( settings ) + "< + diff --git a/entries/jQuery.get.xml b/entries/jQuery.get.xml index be1e25a2..89b698dc 100644 --- a/entries/jQuery.get.xml +++ b/entries/jQuery.get.xml @@ -22,7 +22,7 @@ - 1.12/2.2 + 1.12-2.2 A set of key/value pairs that configure the Ajax request. All properties except for url are optional. A default can be set for any option with $.ajaxSetup(). See jQuery.ajax( settings ) for a complete list of all settings. The type option will automatically be set to GET. @@ -128,4 +128,5 @@ $.get( "test.php", function( data ) { + diff --git a/entries/jQuery.getScript.xml b/entries/jQuery.getScript.xml index be884042..357b9e1a 100644 --- a/entries/jQuery.getScript.xml +++ b/entries/jQuery.getScript.xml @@ -56,6 +56,7 @@ $( "div.log" ).ajaxError(function( e, jqxhr, settings, exception ) { } });
    +

    Prior to jQuery 3.5.0, unsuccessful HTTP responses with a script Content-Type were still executed.

    Caching Responses

    By default, $.getScript() sets the cache setting to false. This appends a timestamped query parameter to the request URL to ensure that the browser downloads the script each time it is requested. You can override this feature by setting the cache property globally using $.ajaxSetup():

    
    @@ -125,4 +126,5 @@ $.getScript( url, function() {
       
       
       
    +  
     
    diff --git a/entries/jQuery.holdReady.xml b/entries/jQuery.holdReady.xml
    index 016e951a..0ba8ceb0 100644
    --- a/entries/jQuery.holdReady.xml
    +++ b/entries/jQuery.holdReady.xml
    @@ -1,5 +1,5 @@
     
    -
    +
       jQuery.holdReady()
       Holds or releases the execution of jQuery's ready event.
       
    @@ -9,6 +9,16 @@
         
       
       
    +    
    +

    Note: This API has been deprecated in jQuery 3.2. Instead of relying on this global switch, it's better to put explicitly wait for required code. If you need to wait both for the ready state & for a custom promise, use the following pattern:

    + +

    The $.holdReady() method allows the caller to delay jQuery's ready event. This advanced feature would typically be used by dynamic script loaders that want to load additional JavaScript such as jQuery plugins before allowing the ready event to occur, even though the DOM may be ready. This method must be called early in the document, such as in the <head> immediately after the jQuery script tag. Calling this method after the ready event has already fired will have no effect.

    To delay the ready event, first call $.holdReady( true ). When the ready event should be released to execute, call $.holdReady( false ). Note that multiple holds can be put on the ready event, one for each $.holdReady( true ) call. The ready event will not actually fire until all holds have been released with a corresponding number of $.holdReady( false ) calls and the normal document ready conditions are met. (See ready for more information.)

    @@ -25,4 +35,5 @@ $.getScript( "myplugin.js", function() { +
    diff --git a/entries/jQuery.htmlPrefilter.xml b/entries/jQuery.htmlPrefilter.xml index 3682ed5b..75cdca38 100644 --- a/entries/jQuery.htmlPrefilter.xml +++ b/entries/jQuery.htmlPrefilter.xml @@ -3,75 +3,15 @@ jQuery.htmlPrefilter() Modify and filter HTML strings passed through jQuery manipulation methods. - 1.12/2.2 + 1.12-2.2 The HTML string on which to operate. -

    This method rarely needs to be called directly. Instead, use it as an entry point to modify existing jQuery manipulation methods. For instance, to remove all <del> tags from incoming HTML strings, do this:

    -
    
    -var htmlPrefilter = $.htmlPrefilter,
    -  rdel = /<(del)(?=[\s>])[\w\W]*?<\/\1\s*>/gi;
    -
    -$.htmlPrefilter = function( html ) {
    -  return htmlPrefilter.call( this, html ).replace( rdel, "" );
    -};
    -    
    -

    This function can also be overwritten in order to bypass certain edge case issues. The default htmlPrefilter function in jQuery will greedily ensure that all tags are XHTML-compliant. This includes anything that looks like an HTML tag, but is actually within a string (e.g.

    <a title="<div />"><>
    ). The jQuery.htmlPrefilter() function can be used to bypass this:

    -
    
    -$.htmlPrefilter = function( html ) {
    -  // Return HTML strings unchanged
    -  return html;
    -};
    -    
    -

    However, while the above fix is short and simple, it puts the burden on you to ensure XHTML-compliant tags in any HTML strings. A more thorough fix for this issue would be this:

    -
    
    -var panything = "[\\w\\W]*?",
    -
    -  // Whitespace
    -  // https://html.spec.whatwg.org/multipage/infrastructure.html#space-character
    -  pspace = "[\\x20\\t\\r\\n\\f]",
    -
    -  // End of tag name (whitespace or greater-than)
    -  pnameEnd = pspace.replace( "]", ">]" ),
    -
    -  // Tag name (a leading letter, then almost anything)
    -  // https://html.spec.whatwg.org/multipage/syntax.html#tag-open-state
    -  // https://html.spec.whatwg.org/multipage/syntax.html#tag-name-state
    -  pname = "[a-z]" + pnameEnd.replace( "[", "[^/\\0" ) + "*",
    -
    -  // Void element (end tag prohibited)
    -  // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
    -  pvoidName = "(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|" +
    -    "source|track|wbr)(?=" + pnameEnd + ")",
    -
    -  // Attributes (double-quoted value, single-quoted value, unquoted value, or no value)
    -  // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
    -  pattrs = "(?:" + pspace + "+[^\\0-\\x20\\x7f-\\x9f=\"'/>]+(?:" + pspace + "*=" + pspace +
    -    "*(?:\"" + panything + "\"|'" + panything + "'|" +
    -    pnameEnd.replace( "[", "[^" ) + "*(?!/)" +
    -    ")|))*" + pspace + "*",
    -
    -  // Trailing content of a close tag
    -  pcloseTail = "(?:" + pspace + panything + "|)",
    -
    -  rspecialHtml = new RegExp(
    -    // Non-void element that self-closes: $1–$5
    -    "(<)(?!" + pvoidName + ")(" + pname + ")(" + pattrs + ")(\\/)(>)|" +
    -      // No-innerHTML container (element, comment, or CDATA): $6
    -      "(<(script|style|textarea)" + pattrs + ">" + panything + "<\\/\\7" + pcloseTail + ">|" +
    -      "<!--" + panything + "--)",
    -    "gi"
    -  ),
    -
    -  // "<"; element name; attributes; ">"; "<"; "/"; element name; ">"; no-innerHTML container
    -  pspecialReplacement = "$1$2$3$5$1$4$2$5$6";
    -
    -$.htmlPrefilter = function( html ) {
    -  return ( html + "" ).replace( rspecialHtml, pspecialReplacement );
    -};
    -    
    +

    This method rarely needs to be called directly. Instead, use it as an entry point to modify existing jQuery manipulation methods. jQuery calls this method on input HTML before processing it further: it accepts an HTML string & should return a HTML string as well.

    +

    This function can also be overwritten in order to bypass certain edge case issues. The default htmlPrefilter function in jQuery leaves input unmodified since 3.5.0. Older versions would greedily ensure that all tags were XHTML-compliant. This included anything that looked like an HTML tag, but was actually within a string (e.g. <a title="<div />"><>), leading to potential security issues. For more information, see the jQuery Core 3.5 Upgrade guide.

    +
    diff --git a/entries/jQuery.isArray.xml b/entries/jQuery.isArray.xml index 6f040c4e..6ce958df 100644 --- a/entries/jQuery.isArray.xml +++ b/entries/jQuery.isArray.xml @@ -1,5 +1,5 @@ - + jQuery.isArray() 1.3 @@ -9,6 +9,9 @@ Determine whether the argument is an array. +
    +

    Note: This API has been deprecated in jQuery 3.2; please use the native Array.isArray method instead.

    +

    $.isArray() returns a Boolean indicating whether the object is a JavaScript array (not an array-like object, such as a jQuery object).

    @@ -22,4 +25,5 @@ Is [] an Array? +
    diff --git a/entries/jQuery.isFunction.xml b/entries/jQuery.isFunction.xml index 7aed5574..3524ace2 100644 --- a/entries/jQuery.isFunction.xml +++ b/entries/jQuery.isFunction.xml @@ -9,7 +9,9 @@ Determines if its argument is callable as a function. -

    As of jQuery 3.3, jQuery.isFunction() has been deprecated. In most cases, its use can be replaced by typeof x === "function".

    +
    +

    As of jQuery 3.3, jQuery.isFunction() has been deprecated. In most cases, its use can be replaced by typeof x === "function".

    +

    Note: As of jQuery 1.3, functions provided by the browser like alert() and DOM element methods like getAttribute() are not guaranteed to be detected as functions in browsers such as Internet Explorer.

    diff --git a/entries/jQuery.isNumeric.xml b/entries/jQuery.isNumeric.xml index b51eb84d..7e64d4b7 100644 --- a/entries/jQuery.isNumeric.xml +++ b/entries/jQuery.isNumeric.xml @@ -1,5 +1,5 @@ - + jQuery.isNumeric() Determines whether its argument represents a JavaScript number. @@ -9,6 +9,9 @@ +
    +

    Note: This API has been deprecated in jQuery 3.3.

    +

    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.

    @@ -39,4 +42,5 @@ $.isNumeric( undefined )
    +
    diff --git a/entries/jQuery.isWindow.xml b/entries/jQuery.isWindow.xml index ee8ed3b1..e79a95a7 100644 --- a/entries/jQuery.isWindow.xml +++ b/entries/jQuery.isWindow.xml @@ -9,6 +9,12 @@ Determine whether the argument is a window. +
    +

    Note: This API has been deprecated in jQuery 3.3; if you need this function, reimplement it by yourself:

    + +

    This is used in a number of places in jQuery to determine if we're operating against a browser window (such as the current window or an iframe).

    diff --git a/entries/jQuery.now.xml b/entries/jQuery.now.xml index 6c41af36..b482637c 100644 --- a/entries/jQuery.now.xml +++ b/entries/jQuery.now.xml @@ -1,13 +1,17 @@ - + jQuery.now() 1.4.3 Return a number representing the current time. -

    The $.now() method is a shorthand for the number returned by the expression (new Date).getTime().

    +
    +

    Note: This API has been deprecated in jQuery 3.3; please use the native Date.now() method instead.

    +
    +

    The $.now() method is an alias for Date.now().

    -
    \ No newline at end of file + +
    diff --git a/entries/jQuery.post.xml b/entries/jQuery.post.xml index 06e353f8..707aaf34 100644 --- a/entries/jQuery.post.xml +++ b/entries/jQuery.post.xml @@ -22,7 +22,7 @@ - 1.12/2.2 + 1.12-2.2 A set of key/value pairs that configure the Ajax request. All properties except for url are optional. A default can be set for any option with $.ajaxSetup(). See jQuery.ajax( settings ) for a complete list of all settings. Type will automatically be set to POST. @@ -167,4 +167,5 @@ $( "#searchForm" ).submit(function( event ) { + diff --git a/entries/jQuery.proxy.xml b/entries/jQuery.proxy.xml index e7c5f0ff..d00748b9 100644 --- a/entries/jQuery.proxy.xml +++ b/entries/jQuery.proxy.xml @@ -1,5 +1,5 @@ - + jQuery.proxy() 1.4 @@ -46,6 +46,9 @@ Takes a function and returns a new one that will always have a particular context. +
    +

    Note: This API has been deprecated in jQuery 3.3; please use the native Function.prototype.bind method instead.

    +

    This method is most useful for attaching event handlers to an element where the context is pointing back to a different object. Additionally, jQuery makes sure that even if you bind the function returned from jQuery.proxy() it will still unbind the correct function if passed the original.

    Be aware, however, that jQuery's event binding subsystem assigns a unique id to each event handling function in order to track it when it is used to specify the function to be unbound. The function represented by jQuery.proxy() is seen as a single function by the event subsystem, even when it is used to bind different contexts. To avoid unbinding the wrong handler, use a unique event namespace for binding and unbinding (e.g., "click.myproxy1") rather than specifying the proxied function during unbinding.

    As of jQuery 1.6, any number of additional arguments may be supplied to $.proxy(), and they will be passed to the function whose context will be changed.

    @@ -170,4 +173,5 @@ $( "#test" ) +
    diff --git a/entries/jQuery.trim.xml b/entries/jQuery.trim.xml index d0dcfa68..cac7e358 100644 --- a/entries/jQuery.trim.xml +++ b/entries/jQuery.trim.xml @@ -1,5 +1,5 @@ - + jQuery.trim() 1.0 @@ -9,6 +9,9 @@ Remove the whitespace from the beginning and end of a string. +
    +

    Note: This API has been deprecated in jQuery 3.5; please use the native String.prototype.trim method instead.

    +

    The $.trim() function removes all newlines, spaces (including non-breaking spaces), and tabs from the beginning and end of the supplied string. If these whitespace characters occur in the middle of the string, they are preserved.

    @@ -34,4 +37,5 @@ $.trim(" hello, how are you? "); +
    diff --git a/entries/jQuery.type.xml b/entries/jQuery.type.xml index 26dbe913..b9ce8a8e 100644 --- a/entries/jQuery.type.xml +++ b/entries/jQuery.type.xml @@ -1,5 +1,5 @@ - + jQuery.type() 1.4.3 @@ -9,6 +9,9 @@ Determine the internal JavaScript [[Class]] of an object. +
    +

    Note: This API has been deprecated in jQuery 3.3.

    +

    A number of techniques are used to determine the exact return value for an object. The [[Class]] is determined as follows:

    • If the object is undefined or null, then "undefined" or "null" is returned accordingly. @@ -24,16 +27,16 @@
    • jQuery.type( true ) === "boolean"
    • jQuery.type( new Boolean() ) === "boolean"
    • jQuery.type( 3 ) === "number"
    • -
    • jQuery.type( new Number(3) ) === "number"
    • +
    • jQuery.type( new Number( 3 ) ) === "number"
    • jQuery.type( "test" ) === "string"
    • -
    • jQuery.type( new String("test") ) === "string"
    • -
    • jQuery.type( function(){} ) === "function"
    • +
    • jQuery.type( new String( "test" ) ) === "string"
    • +
    • jQuery.type( function() {} ) === "function"
    • jQuery.type( [] ) === "array"
    • jQuery.type( new Array() ) === "array"
    • jQuery.type( new Date() ) === "date"
    • jQuery.type( new Error() ) === "error" // as of jQuery 1.9
    • jQuery.type( Symbol() ) === "symbol" // as of jQuery 1.9
    • -
    • jQuery.type( Object(Symbol()) ) === "symbol" // as of jQuery 1.12
    • +
    • jQuery.type( Object( Symbol() ) ) === "symbol" // as of jQuery 1.12
    • jQuery.type( /test/ ) === "regexp"
    @@ -51,4 +54,5 @@ Is it a RegExp?
    + diff --git a/entries/last-selector.xml b/entries/last-selector.xml index 42cd8490..128eec49 100644 --- a/entries/last-selector.xml +++ b/entries/last-selector.xml @@ -7,7 +7,9 @@ Selects the last matched element. -

    As of jQuery 3.4, the :last pseudo-class is deprecated. Remove it from your selectors and filter the results later using .last().

    +
    +

    As of jQuery 3.4, the :last pseudo-class is deprecated. Remove it from your selectors and filter the results later using .last().

    +

    Note that :last selects a single element by filtering the current jQuery collection and matching the last element within it.

    diff --git a/entries/last.xml b/entries/last.xml index 4f9b59df..73ddafa5 100644 --- a/entries/last.xml +++ b/entries/last.xml @@ -24,17 +24,22 @@ $( "li" ).last().css( "background-color", "red" );

    The result of this call is a red background for the final item.

    - Highlight the last span in a paragraph. + Highlight the last item in a list. Look: This is some text in a paragraph. This is a note about it.

    +
      +
    • Look:
    • +
    • This is some text in a list.
    • +
    • This is a note about it.
    • +
    • This is another note about it.
    • +
    ]]>
    diff --git a/entries/lt-selector.xml b/entries/lt-selector.xml index d8c893ea..703c427f 100644 --- a/entries/lt-selector.xml +++ b/entries/lt-selector.xml @@ -17,7 +17,9 @@ Select all elements at an index less than index within the matched set. -

    As of jQuery 3.4, the :lt pseudo-class is deprecated. Remove it from your selectors and filter the results later using .slice(). For example, :lt(3) can be replaced with a call to .slice( 0, 3 ).

    +
    +

    As of jQuery 3.4, the :lt pseudo-class is deprecated. Remove it from your selectors and filter the results later using .slice(). For example, :lt(3) can be replaced with a call to .slice( 0, 3 ).

    +

    index-related selectors

    diff --git a/entries/not.xml b/entries/not.xml index a9a0880d..8a41ddf1 100644 --- a/entries/not.xml +++ b/entries/not.xml @@ -40,9 +40,9 @@

    We can apply this method to the set of list items:

    
    -$( "li" ).not( ":even" ).css( "background-color", "red" );
    +$( "li" ).not( ":nth-child(2n)" ).css( "background-color", "red" );
         
    -

    The result of this call is a red background for items 2 and 4, as they do not match the selector (recall that :even and :odd use 0-based indexing).

    +

    The result of this call is a red background for items 1, 3 and 5, as they do not match the selector.

    Removing Specific Elements

    The second version of the .not() method allows us to remove elements from the matched set, assuming we have found those elements previously by some other means. For example, suppose our list had an id applied to one of its items:

    
    diff --git a/entries/nth-child-selector.xml b/entries/nth-child-selector.xml
    index 7ea6c417..741052a1 100644
    --- a/entries/nth-child-selector.xml
    +++ b/entries/nth-child-selector.xml
    @@ -51,12 +51,17 @@ $( "ul li:nth-child(2)" ).append( " - 2nd!" );
     ]]>
       
       
    -    This is a playground to see how the selector works with different strings.  Notice that this is different from the :even and :odd which have no regard for parent and just filter the list of elements to every other one.  The :nth-child, however, counts the index of the child to its particular parent.  In any case, it's easier to see than explain so...
    +    This is a playground to see how the selector works with different strings.  Notice that this is different from the even and odd which have no regard for parent and just filter the list of elements to every other one.  The :nth-child, however, counts the index of the child to its particular parent.  In any case, it's easier to see than explain so...
         
    @@ -94,8 +99,8 @@ $( "button" ).click(function() {
     
    - - + +
    diff --git a/entries/odd-selector.xml b/entries/odd-selector.xml index 029f2e72..8b907e15 100644 --- a/entries/odd-selector.xml +++ b/entries/odd-selector.xml @@ -5,8 +5,11 @@ 1.0 - Selects odd elements, zero-indexed. See also even. + Selects odd elements, zero-indexed. See also :even. +
    +

    As of jQuery 3.4, the :odd pseudo-class is deprecated. Remove it from your selectors and filter the results later using .odd() (available in jQuery 3.5.0 or newer).

    +

    In particular, note that the 0-based indexing means that, counter-intuitively, :odd selects the second element, fourth element, and so on within the matched set.

    diff --git a/entries/odd.xml b/entries/odd.xml new file mode 100644 index 00000000..52fe3baf --- /dev/null +++ b/entries/odd.xml @@ -0,0 +1,47 @@ + + + .odd() + + 3.5 + + Reduce the set of matched elements to the odd ones in the set, numbered from zero. + +

    Given a jQuery object that represents a set of DOM elements, the .odd() method constructs a new jQuery object from the odd elements in that set. Counting starts from zero!

    +

    Consider a page with a simple list on it:

    +
    
    +<ul>
    +  <li>list item 1</li>
    +  <li>list item 2</li>
    +  <li>list item 3</li>
    +  <li>list item 4</li>
    +  <li>list item 5</li>
    +</ul>
    +    
    +

    We can apply this method to the set of list items:

    +
    
    +$( "li" ).odd().css( "background-color", "red" );
    +    
    +

    The result of this call is a red background for the second & 4th items.

    +
    + + Highlight the odd items in a list. + + + +
  • Look:
  • +
  • This is some text in a list.
  • +
  • This is a note about it.
  • +
  • This is another note about it.
  • + +]]> +
    + + +
    diff --git a/entries/removeClass.xml b/entries/removeClass.xml index c6171f2e..1cb0f240 100644 --- a/entries/removeClass.xml +++ b/entries/removeClass.xml @@ -7,18 +7,24 @@ One or more space-separated classes to be removed from the class attribute of each matched element. + + 3.3 + + An array of classes to be removed from the class attribute of each matched element. + + 1.4 - A function returning one or more space-separated class names to be removed. Receives the index position of the element in the set and the old class value as arguments. + A function returning one or more space-separated classes or an array of classes to be removed. Receives the index position of the element in the set and the old class value as arguments. 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.

    +

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

    Before jQuery version 1.12/2.2, 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 1.12/2.2, 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:

    @@ -42,7 +48,7 @@ $( "li" ).last().removeClass(function() { Remove the class 'blue' from the matched elements. Remove the class 'blue' and 'under' from the matched elements. + + Hello

    +

    and

    +

    then

    +

    Goodbye

    +]]> +
    + + Remove the class 'blue' and 'under' from the matched elements (3.3+ syntax). + + + diff --git a/entries/toggleClass.xml b/entries/toggleClass.xml index 51bdf746..ee266c1f 100644 --- a/entries/toggleClass.xml +++ b/entries/toggleClass.xml @@ -5,16 +5,31 @@ 1.0 - One or more class names (separated by spaces) to be toggled for each element in the matched set. + One or more classes (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. + One or more classes (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. + A boolean (not just truthy/falsy) value to determine whether the class should be added or removed. + + + + 3.3 + + An array of classes to be toggled for each element in the matched set. + + + + 3.3 + + An array of classes 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. @@ -24,7 +39,7 @@ - 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 function that returns one or more space-separated classes or an array of classes 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. @@ -32,7 +47,7 @@ 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>:

    +

    This method takes one or more classes 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>
           
    @@ -55,7 +70,7 @@ if ( addOrRemove ) { $( "#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 classes 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" ) ) {
    @@ -197,6 +212,8 @@ $( "a" ).on( "click", function( event ) {
         
         
         
    +    
    +    
       
       
         
    @@ -210,4 +227,4 @@ $( "a" ).on( "click", function( event ) {
         
         
       
    -
    \ No newline at end of file
    +
    diff --git a/entries2html.xsl b/entries2html.xsl
    index 8237a92f..44ddfdbf 100755
    --- a/entries2html.xsl
    +++ b/entries2html.xsl
    @@ -12,7 +12,7 @@
     	<meta charset="utf-8">
     	<title> demo</title>
     	<style>	</style>
    -	<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
    +	<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
     	<script>
     	
     	</script>