diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..8b808995d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +# editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.js, *.xsl] +indent_style = tab diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..b7ca95b5b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# JS files must always use LF for tools to work +*.js eol=lf diff --git a/.github/configs/hydra-config.json b/.github/configs/hydra-config.json new file mode 100644 index 000000000..2173722b4 --- /dev/null +++ b/.github/configs/hydra-config.json @@ -0,0 +1,10 @@ +{ + "//": [ + "2023-05: twitter.com serves broken redirect-loop", + "2025-04: The oembed endpoint responds HTTP 429 Too Many Requests too often; perhaps because almost every page links to one" + ], + "exclude_scheme_prefixes": [ + "https://twitter.com/", + "https://api.jquery.com/wp-json/oembed/1.0/embed" + ] +} diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..aa2f74565 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: monthly + + # Group all dependabot version update PRs into one + groups: + github-actions: + applies-to: version-updates + patterns: + - "*" diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 000000000..30412870c --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,32 @@ +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Node.js CI + +on: + pull_request: + push: + branches-ignore: "dependabot/**" + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x, 20.x] + + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Update apt-get cache + run: sudo apt-get update + - name: Install xmllint + run: sudo apt-get install -y libxml2-utils + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm test diff --git a/.github/workflows/spider-check.yaml b/.github/workflows/spider-check.yaml new file mode 100644 index 000000000..95ea1ea24 --- /dev/null +++ b/.github/workflows/spider-check.yaml @@ -0,0 +1,32 @@ +name: spider-check +on: + # Once a week on Friday at 00:00 + schedule: + - cron: '0 0 * * 5' + # Or manually + workflow_dispatch: + # Or when developing this workflow + push: + paths: + - .github/workflows/spider-check.yaml + - .github/configs/hydra-config.json + pull_request: + paths: + - .github/workflows/spider-check.yaml + - .github/configs/hydra-config.json + +jobs: + spider-check: + if: ${{ github.repository_owner == 'jquery' }} # skip on forks + runs-on: ubuntu-latest + env: + # Site address to crawl + MY_SITE: https://api.jquery.com + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Run hydra-link-checker + run: | + curl -O https://raw.githubusercontent.com/jquery/hydra-link-checker/v2.0.0/hydra.py + python3 hydra.py "$MY_SITE" --config .github/configs/hydra-config.json diff --git a/.github/workflows/typesense.yaml b/.github/workflows/typesense.yaml new file mode 100644 index 000000000..de973410d --- /dev/null +++ b/.github/workflows/typesense.yaml @@ -0,0 +1,30 @@ +name: typesense +on: + # Once a day at 11:30 UTC + schedule: + - cron: '30 11 * * *' + # Or after a deployment + push: + branches: + - main + # Or manually + workflow_dispatch: + +jobs: + typesense: + name: Update Typesense + if: ${{ github.repository_owner == 'jquery' }} # skip on forks + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Docsearch Scraper + shell: bash + run: | + docker run \ + -e TYPESENSE_API_KEY=${{ secrets.TYPESENSE_ADMIN_KEY }} \ + -e TYPESENSE_HOST="${{ secrets.TYPESENSE_HOST }}" \ + -e TYPESENSE_PORT="443" \ + -e TYPESENSE_PROTOCOL="https" \ + -e CONFIG="$(cat docsearch.config.json | jq -r tostring)" \ + typesense/docsearch-scraper:0.9.1 diff --git a/.gitignore b/.gitignore index 2dc8b339c..633f1bdef 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,3 @@ -dist -entries_tmp -node_modules -config.json -.project -*~ -*.diff -*.patch -.DS_Store -.settings \ No newline at end of file +/dist/ +/node_modules/ +config.js* diff --git a/.mailmap b/.mailmap new file mode 100644 index 000000000..5f931fbce --- /dev/null +++ b/.mailmap @@ -0,0 +1,6 @@ +Matic Potočnik +Michał Gołębiowski-Owczarek +Timmy Willison +Timmy Willison <4timmywil@gmail.com> +Timmy Willison +Timo Tijhof diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 000000000..3c032078a --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +18 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f6ce8293f..9a004cd36 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](irc://irc.freenode.net/#jquery-dev) and [#jquery-content](irc://irc.freenode.net/#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/Gruntfile.js b/Gruntfile.js new file mode 100644 index 000000000..10aa18ab0 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,48 @@ +module.exports = function( grunt ) { + +grunt.loadNpmTasks( "grunt-jquery-content" ); + +grunt.initConfig({ + xmllint: { + all: [ + "entries/**", + "includes/**", + "categories.xml", + "entries2html.xsl", + "notes.xsl" + ] + }, + "build-posts": { + page: "pages/**" + }, + "build-xml-entries": { + all: "entries/**" + }, + "build-resources": { + all: "resources/**" + }, + wordpress: (function() { + + // There's no config for CI, but we don't need one for basic testing + var config = {}; + try { + config = require( "./config" ); + } catch ( error ) {} + config.dir = "dist/wordpress"; + return config; + })() +}); + +grunt.registerTask( "lint", [ "xmllint" ]); + +grunt.registerTask( "build", [ + "build-posts", + "build-resources", + "build-xml-entries", + "build-xml-categories", + "build-xml-full" +]); + +grunt.registerTask( "deploy", [ "wordpress-deploy", "deploy-redirects" ] ); + +}; diff --git a/LICENSE-MIT.txt b/LICENSE.txt similarity index 61% rename from LICENSE-MIT.txt rename to LICENSE.txt index 091e6f076..203b68a7b 100644 --- a/LICENSE-MIT.txt +++ b/LICENSE.txt @@ -1,9 +1,14 @@ -Copyright (c) 2009 Packt Publishing, http://packtpub.com/ -Copyright (c) 2013 jQuery Foundation, http://jquery.org/ +Copyright Packt Publishing (https://www.packtpub.com/), +jQuery Foundation (https://jquery.org/), and other contributors. This software consists of voluntary contributions made by many individuals. For exact contribution history, see the revision history -and logs, available at http://github.com/jquery/api.jquery.com +available at https://github.com/jquery/api.jquery.com + +The following license applies to all parts of this software except as +documented below: + +==== Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -23,3 +28,18 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +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: https://creativecommons.org/publicdomain/zero/1.0/ + +==== + +All files located in the node_modules directory are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/README.md b/README.md index 9c25bb246..f79208030 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,17 @@ -## Referencing Bug Tracker Tickets +# api.jquery.com -* Pull requests for changes that were requested or recommended via the [jQuery Bug Tracker](http://bugs.jquery.com) should include a link back to the relevant ticket. +## Building and Deploying -## Building +To build and deploy your changes for previewing in a [`jquery-wp-content`](https://github.com/jquery/jquery-wp-content) instance, follow the [workflow instructions](https://contribute.jquery.org/web-sites/#workflow) from our documentation on [contributing to jQuery Foundation web sites](https://contribute.jquery.org/web-sites/). ### Requirements -* libxml2 -* 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. +* [libxml2](http://xmlsoft.org/) +* [libxslt](http://xmlsoft.org/libxslt/) -### Build +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. -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/). +**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. ## Style Guidelines @@ -35,7 +34,7 @@ To build and deploy your changes for previewing in a [jquery-wp-content](https:/ #### Pronoun Usage * Use second-person pronoun ("you") when necessary, but try to avoid it. -* Favor the definite article ("the") over second-person possesive ("your"). +* Favor the definite article ("the") over second-person possessive ("your"). * **Yes**: Insert the paragraph after the unordered list. * **No**: Insert your paragraph after the unordered list. * When editing current entries, change first-person plural pronouns ("we," "our," "us") to second-person. @@ -50,7 +49,7 @@ To build and deploy your changes for previewing in a [jquery-wp-content](https:/ ### 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. @@ -86,5 +85,5 @@ Code in the API documentation should follow the [jQuery Core Style Guide](http:/ * Strong in English writing * Tone * Middle ground between formal and familiar. Err on the side of formality. - * Authoritive + * Authoritative * Tactful diff --git a/categories.xml b/categories.xml index 5a94e2360..0f7d4df12 100644 --- a/categories.xml +++ b/categories.xml @@ -1,18 +1,18 @@ - + - + - + - + - + @@ -37,33 +37,86 @@ - - - - - - + + + + + + + + + + + + + + + + + + + + + - + @@ -93,7 +146,7 @@ @@ -161,15 +213,15 @@ jQuery.event.props.push( "dataTransfer" ); - + + A few of these methods—such as .attr(), .html(), and .val()—also act as "getters," retrieving information from DOM elements for later use. + ]]> @@ -234,13 +286,13 @@ jQuery.event.props.push( "dataTransfer" ); ) as a literal part of a name, it must be escaped with with two backslashes: \\. For example, an element with id="foo.bar", can use the selector $("#foo\\.bar"). The W3C CSS specification contains the complete set of rules regarding valid CSS selectors. Also useful is the blog entry by Mathias Bynens on CSS character escape sequences for identifiers.

+

To use any of the meta-characters ( such as !"#$%&'()*+,./:;<=>?@[\]^`{|}~ ) as a literal part of a name, it must be escaped with with two backslashes: \\. For example, an element with id="foo.bar", can use the selector $("#foo\\.bar"). The W3C CSS specification contains the complete set of rules regarding valid CSS selectors. Also useful is the blog entry by Mathias Bynens on CSS character escape sequences for identifiers.

]]>
, will select <a href="example.html" rel="nofollow">Some text</a> but not <a href="example.html" rel="nofollow foe">Some text</a>.

-

Attribute values in selector expressions must follow the rules for W3C CSS selectors; in general, that means anything other than a valid identifier should be surrounded by quotation marks.

+

Attribute values in selector expressions must follow the rules for W3C CSS selectors; in general, that means anything other than a valid identifier should be surrounded by quotation marks.

  • double quotes inside single quotes: $('a[rel="nofollow self"]')
  • single quotes inside double quotes: $("a[rel='nofollow self']")
  • @@ -254,7 +306,7 @@ jQuery.event.props.push( "dataTransfer" ); - + @@ -272,7 +324,7 @@ jQuery.event.props.push( "dataTransfer" ); - + @@ -297,116 +349,284 @@ jQuery.event.props.push( "dataTransfer" ); - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config-sample.json b/config-sample.json index 85f8556b9..2a56329c3 100644 --- a/config-sample.json +++ b/config-sample.json @@ -1,5 +1,5 @@ { - "url": "local.api.jquery.com", - "username": "admin", - "password": "secret" + "url": "http://local.api.jquery.com", + "username": "dev", + "password": "dev" } diff --git a/docsearch.config.json b/docsearch.config.json new file mode 100644 index 000000000..f420af4af --- /dev/null +++ b/docsearch.config.json @@ -0,0 +1,52 @@ +{ + "index_name": "jquery_com", + "start_urls": [ + { "url": "https://api.jquery.com", "selectors_key": "api", "page_rank": 20 }, + { "url": "https://jquery.com", "page_rank": 10 } + ], + "stop_urls": [ + ".com/category/" + ], + "selectors": { + "default": { + "lvl0": { + "selector": "#menu-top .menu-item.current > a", + "global": true, + "default_value": "Documentation" + }, + "lvl1": "#content h1", + "lvl2": "#content h2", + "lvl3": "#content h3", + "lvl4": "#content h4", + "lvl5": "#content h5", + "text": "#content p, #content li, #content tr" + }, + "api": { + "lvl0": { + "selector": "#categories .cat-item.current-cat > a", + "global": true, + "default_value": "API" + }, + "lvl1": "#content h1", + "lvl2": "#content h2, #content h4.name", + "lvl3": "#content h3, #content h4:not(.name)", + "lvl4": "#content h5, #content strong:first-child", + "text": ".entry-content p, .entry-content li" + } + }, + "custom_settings": { + "token_separators": ["_", "-", "."] + }, + "selectors_exclude": [ + "header ~ article", + ".returns", + ".version-details", + ".section-title", + ".icon-link.toc-link", + "[class^=toclevel]", + "#toctitle", + ".desc strong:first-child" + ], + "min_indexed_level": 2, + "scrape_start_urls": false +} diff --git a/entries/add.xml b/entries/add.xml index ba7bd7230..bb95b0f0b 100644 --- a/entries/add.xml +++ b/entries/add.xml @@ -9,7 +9,7 @@ 1.0 - + One or more elements to add to the set of matched elements. @@ -20,8 +20,8 @@ - 1.3.2 - + 1.1 + An existing jQuery object to add to the set of matched elements. @@ -34,10 +34,10 @@ The point in the document at which the selector should begin matching; similar to the context argument of the $(selector, context) method. - Add elements to the set of matched elements. + Create a new jQuery object with elements added to the set of matched elements.

    Given a jQuery object that represents a set of DOM elements, the .add() method constructs a new jQuery object from the union of those elements and the ones passed into the method. The argument to .add() can be pretty much anything that $() accepts, including a jQuery selector expression, references to DOM elements, or an HTML snippet.

    -

    Do not assume that this method appends the elements to the existing collection in the order they are passed to the .add() method. When all elements are members of the same document, the resulting collection from .add() will be sorted in document order; that is, in order of each element's appearance in the document. If the collection consists of elements from different documents or ones not in any document, the sort order is undefined. To create a jQuery object with elements in a well-defined order, use the $(array_of_DOM_elements) signature.

    +

    Do not assume that this method appends the elements to the existing collection in the order they are passed to the .add() method. When all elements are members of the same document, the resulting collection from .add() will be sorted in document order; that is, in order of each element's appearance in the document. If the collection consists of elements from different documents or ones not in any document, the sort order is undefined. To create a jQuery object with elements in a well-defined order and without sorting overhead, use the $(array_of_DOM_elements) signature.

    The updated set of elements can be used in a following (chained) method, or assigned to a variable for later use. For example:

    
     $( "p" ).add( "div" ).addClass( "widget" );
    diff --git a/entries/addClass.xml b/entries/addClass.xml
    index 7d299dba9..39d6a0bf5 100644
    --- a/entries/addClass.xml
    +++ b/entries/addClass.xml
    @@ -7,15 +7,36 @@
           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.
    +      
    +      
    +      
         
       
    -  Adds the specified class(es) to each of the set of matched elements.
    +  
    +    3.3
    +    
    +      A function returning one or more space-separated class names or an array of 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.
    +      
    +      
    +      
    +      
    +    
    +  
    +  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 1.12/2.2, 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 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, .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" );
    @@ -59,7 +80,30 @@ $( "p" ).last().addClass( "selected" );
       
         Add the classes "selected" and "highlight" to the matched elements.
         
    +    
    +    
    +  
    +  
    +    Add the classes "selected" and "highlight" to the matched elements (3.3+ syntax).
    +    
         

    Since .after() can accept any number of additional arguments, the same result can be achieved by passing in the three <div>s as three separate arguments, like so: $( "p" ).first().after( $newdiv1, newdiv2, existingdiv1 ). The type and number of arguments will largely depend on the elements that are collected in the code.

    + + Inserts some HTML after all paragraphs. + diff --git a/entries/ajaxError-shorthand.xml b/entries/ajaxError-shorthand.xml new file mode 100644 index 000000000..f36ac54a8 --- /dev/null +++ b/entries/ajaxError-shorthand.xml @@ -0,0 +1,19 @@ + + + .ajaxError() + Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event. + + 1.0 + + The function to be invoked. + + + +
    +

    This API is deprecated. Use .on( "ajaxError", handler ) instead.

    +
    +
    + + + +
    diff --git a/entries/ajaxError.xml b/entries/ajaxError.xml index 801fef62c..d18cf9775 100644 --- a/entries/ajaxError.xml +++ b/entries/ajaxError.xml @@ -1,15 +1,25 @@ - - .ajaxError() + + ajaxError event + Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event. - 1.0 - + 1.7 + + The string "ajaxError". + + The function to be invoked. + + + + - Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event. -

    Whenever an Ajax request completes with an error, jQuery triggers the ajaxError event. Any and all handlers that have been registered with the .ajaxError() method are executed at this time. Note: This handler is not called for cross-domain script and cross-domain JSONP requests.

    +
    +

    This page describes the ajaxError event. For the deprecated .ajaxError() method, see .ajaxError().

    +
    +

    Whenever an Ajax request completes with an error, jQuery triggers the ajaxError event. Any and all registered ajaxError handlers are executed at this time. Note: This handler is not called for cross-domain script and cross-domain JSONP requests.

    To observe this method in action, set up a basic Ajax load request.

    
     <button class="trigger">Trigger</button>
    @@ -18,35 +28,37 @@
         

    Attach the event handler to the document:

    
    -$( document ).ajaxError(function() {
    -  $( "div.log" ).text( "Triggered ajaxError handler." );
    -});
    +$( document ).on( "ajaxError", function() {
    +  $( ".log" ).text( "Triggered ajaxError handler." );
    +} );
         

    Now, make an Ajax request using any jQuery method:

    
     $( "button.trigger" ).on( "click", function() {
       $( "div.result" ).load( "ajax/missing.html" );
    -});
    +} );
         

    When the user clicks the button and the Ajax request fails, because the requested file is missing, the log message is displayed.

    -

    As of jQuery 1.8, the .ajaxError() method should only be attached to document.

    All ajaxError handlers are invoked, regardless of what Ajax request was completed. To differentiate between the requests, use the parameters passed to the handler. Each time an ajaxError handler is executed, it is passed the event object, the jqXHR object (prior to jQuery 1.5, the XHR object), and the settings object that was used in the creation of the request. When an HTTP error occurs, the fourth argument (thrownError) receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." For example, to restrict the error callback to only handling events dealing with a particular URL:

    
    -$( document ).ajaxError(function( event, jqxhr, settings, exception ) {
    +$( document ).on( "ajaxError", function( event, jqxhr, settings, thrownError ) {
       if ( settings.url == "ajax/missing.html" ) {
         $( "div.log" ).text( "Triggered ajaxError handler." );
       }
    -});
    +} ); +
    - + + Show a message when an Ajax request fails. + diff --git a/entries/ajaxSend-shorthand.xml b/entries/ajaxSend-shorthand.xml new file mode 100644 index 000000000..a9ae031e7 --- /dev/null +++ b/entries/ajaxSend-shorthand.xml @@ -0,0 +1,19 @@ + + + .ajaxSend() + Attach a function to be executed before an Ajax request is sent. This is an Ajax Event. + + 1.0 + + The function to be invoked. + + + +
    +

    This API is deprecated. Use .on( "ajaxSend", handler ) instead.

    +
    +
    + + + +
    diff --git a/entries/ajaxSend.xml b/entries/ajaxSend.xml index dd2dc44b8..cbd1641cd 100644 --- a/entries/ajaxSend.xml +++ b/entries/ajaxSend.xml @@ -1,15 +1,24 @@ - - .ajaxSend() + + ajaxSend event + Attach a function to be executed before an Ajax request is sent. This is an Ajax Event. - 1.0 - + 1.7 + + The string "ajaxSend". + + The function to be invoked. + + + - Attach a function to be executed before an Ajax request is sent. This is an Ajax Event. -

    Whenever an Ajax request is about to be sent, jQuery triggers the ajaxSend event. Any and all handlers that have been registered with the .ajaxSend() method are executed at this time.

    +
    +

    This page describes the ajaxSend event. For the deprecated .ajaxSend() method, see .ajaxSend().

    +
    +

    Whenever an Ajax request is about to be sent, jQuery triggers the ajaxSend event. Any and all registerd ajaxSend handlers are executed at this time.

    To observe this method in action, set up a basic Ajax load request:

    
     <div class="trigger">Trigger</div>
    @@ -18,36 +27,37 @@
         

    Attach the event handler to the document:

    
    -$( document ).ajaxSend(function() {
    +$( document ).on( "ajaxSend", function() {
       $( ".log" ).text( "Triggered ajaxSend handler." );
    -});
    +} );
         

    Now, make an Ajax request using any jQuery method:

    
    -$( ".trigger" ).click(function() {
    +$( ".trigger" ).on( "click", function() {
       $( ".result" ).load( "ajax/test.html" );
    -});
    +} );
         

    When the user clicks the element with class trigger and the Ajax request is about to begin, the log message is displayed.

    -

    As of jQuery 1.8, the .ajaxSend() method should only be attached to document.

    All ajaxSend handlers are invoked, regardless of what Ajax request is to be sent. If you must differentiate between the requests, use the parameters passed to the handler. Each time an ajaxSend handler is executed, it is passed the event object, the jqXHR object (in version 1.4, XMLHttpRequestobject), and the settings object that was used in the creation of the Ajax request. For example, you can restrict the callback to only handling events dealing with a particular URL:

    
    -$( document ).ajaxSend(function( event, jqxhr, settings ) {
    +$( document ).on( "ajaxSend", function( event, jqxhr, settings ) {
       if ( settings.url == "ajax/test.html" ) {
         $( ".log" ).text( "Triggered ajaxSend handler." );
       }
    -});
    +} );
         
    - + + Show a message before an Ajax request is sent. +
    diff --git a/entries/ajaxStart-shorthand.xml b/entries/ajaxStart-shorthand.xml new file mode 100644 index 000000000..51b2fc9e3 --- /dev/null +++ b/entries/ajaxStart-shorthand.xml @@ -0,0 +1,19 @@ + + + .ajaxStart() + Register a handler to be called when the first Ajax request begins. This is an Ajax Event. + + 1.0 + + The function to be invoked. + + + +
    +

    This API is deprecated. Use .on( "ajaxStart", handler ) instead.

    +
    +
    + + + +
    diff --git a/entries/ajaxStart.xml b/entries/ajaxStart.xml index 854ad0198..3d8f4df4f 100644 --- a/entries/ajaxStart.xml +++ b/entries/ajaxStart.xml @@ -1,15 +1,21 @@ - - .ajaxStart() + + ajaxStart event + Register a handler to be called when the first Ajax request begins. This is an Ajax Event. - 1.0 - + 1.7 + + The string "ajaxStart". + + The function to be invoked. - Register a handler to be called when the first Ajax request begins. This is an Ajax Event. -

    Whenever an Ajax request is about to be sent, jQuery checks whether there are any other outstanding Ajax requests. If none are in progress, jQuery triggers the ajaxStart event. Any and all handlers that have been registered with the .ajaxStart() method are executed at this time.

    +
    +

    This page describes the ajaxStart event. For the deprecated .ajaxStart() method, see .ajaxStart().

    +
    +

    Whenever an Ajax request is about to be sent, jQuery checks whether there are any other outstanding Ajax requests. If none are in progress, jQuery triggers the ajaxStart event. Any and all handlers that have been registered with .on( "ajaxStart", ... ) are executed at this time.

    To observe this method in action, set up a basic Ajax load request:

    
     <div class="trigger">Trigger</div>
    @@ -18,28 +24,29 @@
         

    Attach the event handler to any element:

    
    -$( document ).ajaxStart(function() {
    +$( document ).on( "ajaxStart", function() {
       $( ".log" ).text( "Triggered ajaxStart handler." );
    -});
    +} );
         

    Now, make an Ajax request using any jQuery method:

    
    -$( ".trigger" ).click(function() {
    +$( ".trigger" ).on( "click", function() {
       $( ".result" ).load( "ajax/test.html" );
    -});
    +} );
         

    When the user clicks the element with class trigger and the Ajax request is sent, the log message is displayed.

    -

    As of jQuery 1.8, the .ajaxStart() method should only be attached to document.

    - + + Show a loading message whenever an Ajax request starts (and none is already active). +
    diff --git a/entries/ajaxStop-shorthand.xml b/entries/ajaxStop-shorthand.xml new file mode 100644 index 000000000..781216575 --- /dev/null +++ b/entries/ajaxStop-shorthand.xml @@ -0,0 +1,19 @@ + + + .ajaxStop() + Register a handler to be called when all Ajax requests have completed. This is an Ajax Event. + + 1.0 + + The function to be invoked. + + + +
    +

    This API is deprecated. Use .on( "ajaxStop", handler ) instead.

    +
    +
    + + + +
    diff --git a/entries/ajaxStop.xml b/entries/ajaxStop.xml index 88d318e51..f42c74448 100644 --- a/entries/ajaxStop.xml +++ b/entries/ajaxStop.xml @@ -1,15 +1,21 @@ - - .ajaxStop() + + ajaxStop event Register a handler to be called when all Ajax requests have completed. This is an Ajax Event. - 1.0 - + 1.7 + + The string "ajaxStop". + + The function to be invoked. -

    Whenever an Ajax request completes, jQuery checks whether there are any other outstanding Ajax requests. If none remain, jQuery triggers the ajaxStop event. Any and all handlers that have been registered with the .ajaxStop() method are executed at this time. The ajaxStop event is also triggered if the last outstanding Ajax request is cancelled by returning false within the beforeSend callback function.

    +
    +

    This page describes the ajaxStop event. For the deprecated .ajaxStop() method, see .ajaxStop().

    +
    +

    Whenever an Ajax request completes, jQuery checks whether there are any other outstanding Ajax requests. If none remain, jQuery triggers the ajaxStop event. Any and all registered ajaxStop handlers are executed at this time. The ajaxStop event is also triggered if the last outstanding Ajax request is cancelled by returning false within the beforeSend callback function.

    To observe this method in action, set up a basic Ajax load request:

    
     <div class="trigger">Trigger</div>
    @@ -18,28 +24,29 @@
         

    Attach the event handler to the document:

    
    -$( ".log" ).ajaxStop(function() {
    -  $( this ).text( "Triggered ajaxStop handler." );
    -});
    +$( document ).on( "ajaxStop", function() {
    +  $( ".log" ).text( "Triggered ajaxStop handler." );
    +} );
         

    Now, make an Ajax request using any jQuery method:

    
    -$( ".trigger" ).click(function() {
    +$( ".trigger" ).on( "click", function() {
       $( ".result" ).load( "ajax/test.html" );
    -});
    +} );
         

    When the user clicks the element with class trigger and the Ajax request completes, the log message is displayed.

    -

    As of jQuery 1.8, the .ajaxStop() method should only be attached to document.

    - + + Hide a loading message after all the Ajax requests have stopped. +
    diff --git a/entries/ajaxSuccess-shorthand.xml b/entries/ajaxSuccess-shorthand.xml new file mode 100644 index 000000000..a9e543350 --- /dev/null +++ b/entries/ajaxSuccess-shorthand.xml @@ -0,0 +1,19 @@ + + + .ajaxSuccess() + Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event. + + 1.0 + + The function to be invoked. + + + +
    +

    This API is deprecated. Use .on( "ajaxSuccess", handler ) instead.

    +
    +
    + + + +
    diff --git a/entries/ajaxSuccess.xml b/entries/ajaxSuccess.xml index 968350d88..8824a6212 100644 --- a/entries/ajaxSuccess.xml +++ b/entries/ajaxSuccess.xml @@ -1,15 +1,25 @@ - - .ajaxSuccess() + + ajaxSuccess event + Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event. - 1.0 - + 1.7 + + The string "ajaxSuccess". + + The function to be invoked. + + + + - Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event. -

    Whenever an Ajax request completes successfully, jQuery triggers the ajaxSuccess event. Any and all handlers that have been registered with the .ajaxSuccess() method are executed at this time.

    +
    +

    This page describes the ajaxSuccess event. For the deprecated .ajaxSuccess() method, see .ajaxSuccess().

    +
    +

    Whenever an Ajax request completes successfully, jQuery triggers the ajaxSuccess event. Any and all registered ajaxSuccess handlers are executed at this time.

    To observe this method in action, set up a basic Ajax load request:

    
     <div class="trigger">Trigger</div>
    @@ -18,38 +28,39 @@
         

    Attach the event handler to any element:

    
    -$(document).ajaxSuccess(function() {
    +$( document ).on( "ajaxSuccess", function() {
       $( ".log" ).text( "Triggered ajaxSuccess handler." );
    -});
    +} );
         

    Now, make an Ajax request using any jQuery method:

    
     $( ".trigger" ).on( "click", function() {
       $( ".result" ).load( "ajax/test.html" );
    -});
    +} );
         

    When the user clicks the element with class trigger and the Ajax request completes successfully, the log message is displayed.

    -

    As of jQuery 1.8, the .ajaxSuccess() method should only be attached to document.

    All ajaxSuccess handlers are invoked, regardless of what Ajax request was completed. If you must differentiate between the requests, you can use the parameters passed to the handler. Each time an ajaxSuccess handler is executed, it is passed the event object, the XMLHttpRequest object, and the settings object that was used in the creation of the request. For example, you can restrict the callback to only handling events dealing with a particular URL:

    
    -$( document ).ajaxSuccess(function( event, xhr, settings ) {
    +$( document ).on( "ajaxSuccess", function( event, xhr, settings ) {
       if ( settings.url == "ajax/test.html" ) {
    -    $( ".log" ).text( "Triggered ajaxSuccess handler. The ajax response was: " +
    +    $( ".log" ).text( "Triggered ajaxSuccess handler. The Ajax response was: " +
           xhr.responseText );
       }
    -});
    +} );
         
    -

    Note: You can get the returned ajax contents by looking at xhr.responseXML or xhr.responseText for xml and html respectively.

    +

    Note: You can get the returned Ajax contents by looking at xhr.responseXML or xhr.responseText for xml and html respectively.

    - + + Show a message when an Ajax request completes successfully. +
    diff --git a/entries/andSelf.xml b/entries/andSelf.xml index 6870b4795..967c72ef5 100644 --- a/entries/andSelf.xml +++ b/entries/andSelf.xml @@ -1,78 +1,17 @@ - + .andSelf() 1.2 Add the previous set of elements on the stack to the current set. -

    Note: This function has been deprecated and is now an alias for .addBack(), which should be used with jQuery 1.8 and later.

    -

    As described in the discussion for .end(), jQuery objects maintain an internal stack that keeps track of changes to the matched set of elements. When one of the DOM traversal methods is called, the new set of elements is pushed onto the stack. If the previous set of elements is desired as well, .andSelf() can help.

    -

    Consider a page with a simple list on it:

    -
    
    -<ul>
    -  <li>list item 1</li>
    -  <li>list item 2</li>
    -  <li class="third-item">list item 3</li>
    -  <li>list item 4</li>
    -  <li>list item 5</li>
    -</ul>
    -    
    -

    The result of the following code is a red background behind items 3, 4 and 5:

    -
    
    -$( "li.third-item" ).nextAll().andSelf()
    -  .css( "background-color", "red" );
    -    
    -

    First, the initial selector locates item 3, initializing the stack with the set containing just this item. The call to .nextAll() then pushes the set of items 4 and 5 onto the stack. Finally, the .andSelf() invocation merges these two sets together, creating a jQuery object that points to all three items in document order: [ <li.third-item>, <li>, <li> ].

    +
    +

    Note: This API has been removed in jQuery 3.0; use .addBack() instead, which should work identically.

    +
    - - The .andSelf() method causes the previous set of DOM elements in the traversal stack to be added to the current set. In the first example, the top stack contains the set resulting from .find("p"). In the second example, .andSelf() adds the previous set of elements on the stack — in this case $( "div.after-andself" ) — to the current set, selecting both the div and its enclosed paragraphs. - - - - +
    diff --git a/entries/animate.xml b/entries/animate.xml index d05f366ee..c4ac9e70f 100644 --- a/entries/animate.xml +++ b/entries/animate.xml @@ -22,7 +22,7 @@

    The .animate() method allows us to create animation effects on any numeric CSS property. The only required parameter is a plain object of CSS properties. This object is similar to the one that can be sent to the .css() method, except that the range of properties is more restrictive.

    Animation Properties and Values

    -

    All animated properties should be animated to a single numeric value, except as noted below; most properties that are non-numeric cannot be animated using basic jQuery functionality (For example, width, height, or left can be animated but background-color cannot be, unless the jQuery.Color() plugin is used). Property values are treated as a number of pixels unless otherwise specified. The units em and % can be specified where applicable.

    +

    All animated properties should be animated to a single numeric value, except as noted below; most properties that are non-numeric cannot be animated using basic jQuery functionality (For example, width, height, or left can be animated but background-color cannot be, unless the jQuery.Color plugin is used). Property values are treated as a number of pixels unless otherwise specified. The units em and % can be specified where applicable.

    In addition to style properties, some non-style properties such as scrollTop and scrollLeft, as well as custom properties, can be animated.

    Shorthand CSS properties (e.g. font, background, border) are not fully supported. For example, if you want to animate the rendered border width, at least a border style and border width other than "auto" must be set in advance. Or, if you want to animate font size, you would use fontSize or the CSS equivalent 'font-size' rather than simply 'font'.

    In addition to numeric values, each property can take the strings 'show', 'hide', and 'toggle'. These shortcuts allow for custom hiding and showing animations that take into account the display type of the element. In order to use jQuery's built-in toggle state tracking, the 'toggle' keyword must be consistently given as the value of the property being animated.

    @@ -32,8 +32,8 @@

    Duration

    Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The default duration is 400 milliseconds. The strings 'fast' and 'slow' can be supplied to indicate durations of 200 and 600 milliseconds, respectively.

    -

    Complete Function

    -

    If supplied, the complete callback function 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, the callback is executed once per matched element, not once for the animation as a whole.

    +

    Callback Functions

    +

    If supplied, the start, step, progress, complete, done, fail, and always callbacks are called on a per-element basis; this is set to the DOM element being animated. If no elements are in the set, no callbacks are called. If multiple elements are animated, the callback is executed once per matched element, not once for the animation as a whole. Use the .promise() method to obtain a promise to which you can attach callbacks that fire once for an animated set of any size, including zero elements.

    Basic Usage

    To animate any element, such as a simple image:

    
    @@ -45,7 +45,7 @@
         

    To animate the opacity, left offset, and height of the image simultaneously:

    
    -$( "#clickme" ).click(function() {
    +$( "#clickme" ).on( "click", function() {
       $( "#book" ).animate({
         opacity: 0.25,
         left: "+=50",
    @@ -56,20 +56,26 @@ $( "#clickme" ).click(function() {
     });
         

    - +

    + +
    Figure 1 - Illustration of the specified animation effect
    +

    Note that the target value of the height property is 'toggle'. Since the image was visible before, the animation shrinks the height to 0 to hide it. A second click then reverses this transition:

    - +

    + +
    Figure 2 - Illustration of the specified animation effect
    +

    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.

    @@ -90,12 +96,12 @@ $( "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:

    
    -$( "#clickme" ).click(function() {
    +$( "#clickme" ).on( "click", function() {
       $( "#book" ).animate({
         width: [ "toggle", "swing" ],
         height: [ "toggle", "swing" ],
    @@ -107,7 +113,7 @@ $( "#clickme" ).click(function() {
         

    In the second version of .animate(), the options object can include the specialEasing property, which is itself an object of CSS properties and their corresponding easing functions. For example, to simultaneously animate the width using the linear easing function and the height using the easeOutBounce easing function:

    
    -$( "#clickme" ).click(function() {
    +$( "#clickme" ).on( "click", function() {
       $( "#book" ).animate({
         width: "toggle",
         height: "toggle"
    @@ -131,7 +137,7 @@ $( "#clickme" ).click(function() {
         
    @@ -185,7 +191,7 @@ $( "#left" ).click(function(){
     
     The second button starts a traditional chained animation, where each animation will start once the previous animation on the element has completed.
         

    Since .append() can accept any number of additional arguments, the same result can be achieved by passing in the three <div>s as three separate arguments, like so: $('body').append( $newdiv1, newdiv2, existingdiv1 ). The type and number of arguments will largely depend on how you collect the elements in your code.

    + + Appends some HTML to all paragraphs. diff --git a/entries/attribute-contains-word-selector.xml b/entries/attribute-contains-word-selector.xml index 18df4cbc8..8a71f37b0 100644 --- a/entries/attribute-contains-word-selector.xml +++ b/entries/attribute-contains-word-selector.xml @@ -8,7 +8,7 @@ An attribute name. - An attribute value. Can be either an unquoted single word or a quoted string. + An attribute value. Can be either a valid identifier or a quoted string. Selects elements that have the specified attribute with a value containing a given word, delimited by spaces. diff --git a/entries/attribute-ends-with-selector.xml b/entries/attribute-ends-with-selector.xml index 0febbde71..cbdfe8089 100644 --- a/entries/attribute-ends-with-selector.xml +++ b/entries/attribute-ends-with-selector.xml @@ -8,7 +8,7 @@ An attribute name. - An attribute value. Can be either an unquoted single word or a quoted string. + An attribute value. Can be either a valid identifier or a quoted string. Selects elements that have the specified attribute with a value ending exactly with a given string. The comparison is case sensitive. diff --git a/entries/attribute-equals-selector.xml b/entries/attribute-equals-selector.xml index 555cf7c96..faa6e513f 100644 --- a/entries/attribute-equals-selector.xml +++ b/entries/attribute-equals-selector.xml @@ -8,7 +8,7 @@ An attribute name. - An attribute value. Can be either an unquoted single word or a quoted string. + An attribute value. Can be either a valid identifier or a quoted string. Selects elements that have the specified attribute with a value exactly equal to a certain value. diff --git a/entries/attribute-not-equal-selector.xml b/entries/attribute-not-equal-selector.xml index fabb6a2e6..38531ffcf 100644 --- a/entries/attribute-not-equal-selector.xml +++ b/entries/attribute-not-equal-selector.xml @@ -8,7 +8,7 @@ An attribute name. - An attribute value. Can be either an unquoted single word or a quoted string. + An attribute value. Can be either a valid identifier or a quoted string. Select elements that either don't have the specified attribute, or do have the specified attribute but not with a certain value. diff --git a/entries/attribute-starts-with-selector.xml b/entries/attribute-starts-with-selector.xml index 3c2f69125..540676525 100644 --- a/entries/attribute-starts-with-selector.xml +++ b/entries/attribute-starts-with-selector.xml @@ -8,7 +8,7 @@ An attribute name. - An attribute value. Can be either an unquoted single word or a quoted string. + An attribute value. Can be either a valid identifier or a quoted string. Selects elements that have the specified attribute with a value beginning exactly with a given string. diff --git a/entries/before.xml b/entries/before.xml index 377b5df24..577f588b0 100644 --- a/entries/before.xml +++ b/entries/before.xml @@ -4,16 +4,18 @@ 1.0 - HTML string, DOM element, array of elements, or jQuery object to insert before each element in the set of matched elements. + HTML string, DOM element, text node, array of elements and text nodes, or jQuery object to insert before each element in the set of matched elements. + - One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements. + One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or jQuery objects to insert before each element in the set of matched elements. + @@ -21,13 +23,35 @@ 1.4 - A function that returns an HTML string, DOM element(s), or jQuery object to insert before each element in the set of 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 function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert before each element in the set of 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. + + + + + 1.10-and-2.0 + + + + + + + + + + A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert before each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. Insert content, specified by the parameter, before each element in the set of matched elements. -

    The .before() and .insertBefore() methods perform the same task. The major difference is in the syntax-specifically, in the placement of the content and target. With .before(), the selector expression preceding the method is the container before which the content is inserted. With .insertBefore(), on the other hand, the content precedes the method, either as a selector expression or as markup created on the fly, and it is inserted before the target container.

    +

    The .before() and .insertBefore() methods perform the same task. The major difference is in the syntax—specifically, in the placement of the content and target. With .before(), the content to be inserted comes from the method's argument: $(target).before(contentToBeInserted). With .insertBefore(), on the other hand, the content precedes the method and is inserted before the target, which in turn is passed as the .insertBefore() method's argument: $(contentToBeInserted).insertBefore(target).

    Consider the following HTML:

    
     <div class="container">
    @@ -62,17 +86,12 @@ $( ".container" ).before( $( "h2" ) );
       <div class="inner">Goodbye</div>
     </div>
         
    -

    If there is more than one target element, however, cloned copies of the inserted element will be created for each target after the first.

    -

    In jQuery 1.4, .before() and .after() will also work on disconnected DOM nodes:

    -
    
    -$( "<div>" ).before( "<p></p>" );
    -    
    -

    The result is a jQuery set that contains a paragraph and a div (in that order).

    +

    Important: If there is more than one target element, however, cloned copies of the inserted element will be created for each target except for the last one.

    Additional Arguments

    Similar to other content-adding methods such as .prepend() and .after(), .before() also supports passing in multiple arguments as input. Supported input includes DOM elements, jQuery objects, HTML strings, and arrays of DOM elements.

    For example, the following will insert two new <div>s and an existing <div> before the first paragraph:

    
    -var newdiv1 = $( "<div id='object1'/>" ),
    +var newdiv1 = $( "<div id='object1'></div>" ),
       newdiv2 = document.createElement( "div" ),
       existingdiv1 = document.getElementById( "foo" );
     
    @@ -80,6 +99,8 @@ $( "p" ).first().before( newdiv1, [ newdiv2, existingdiv1 ] );
         

    Since .before() can accept any number of additional arguments, the same result can be achieved by passing in the three <div>s as three separate arguments, like so: $( "p" ).first().before( $newdiv1, newdiv2, existingdiv1 ). The type and number of arguments will largely depend on how you collect the elements in your code.

    + + Inserts some HTML before all paragraphs. @@ -258,4 +259,5 @@ $( "div.test" ).bind({ + diff --git a/entries/blur-shorthand.xml b/entries/blur-shorthand.xml new file mode 100644 index 000000000..589a1cebb --- /dev/null +++ b/entries/blur-shorthand.xml @@ -0,0 +1,37 @@ + + + .blur() + Bind an event handler to the "blur" event, or trigger that event on an element. + + 1.0 + + A function to execute each time the event is triggered. + + + + + 1.4.3 + + An object containing data that will be passed to the event handler. + + + A function to execute each time the event is triggered. + + + + + 1.0 + + +
    +

    This API is deprecated.

    +

    Instead of .blur( handler ) or .blur( eventData, handler ), use .on( "blur", handler ) or .on( "blur", eventData, handler ), respectively.

    +

    Instead of .blur(), use .trigger( "blur" ).

    +
    +
    + + + + + +
    diff --git a/entries/blur.xml b/entries/blur.xml index 3029a6fc5..68636a0ce 100644 --- a/entries/blur.xml +++ b/entries/blur.xml @@ -1,27 +1,27 @@ - - .blur() - Bind an event handler to the "blur" JavaScript event, or trigger that event on an element. + + +Bind an event handler to the "blur" event, or trigger that event on an element. + + blur event + Bind an event handler to the "blur" event. - 1.0 - - A function to execute each time the event is triggered. + 1.7 + + The string "blur". - - - 1.4.3 - + An object containing data that will be passed to the event handler. - + A function to execute each time the event is triggered. + - - 1.0 - -

    This method is a shortcut for .on( "blur", handler ) in the first two variations, and .trigger( "blur" ) in the third.

    +
    +

    This page describes the blur event. For the deprecated .blur() method, see .blur().

    +

    The blur event is sent to an element when it loses focus. Originally, this event was only applicable to form elements, such as <input>. In recent browsers, the domain of the event has been extended to include all element types. An element can lose focus via keyboard commands, such as the Tab key, or by mouse clicks elsewhere on the page.

    For example, consider the HTML:

    
    @@ -32,32 +32,55 @@
     <div id="other">
       Trigger the handler
     </div>
    -The event handler can be bound to the first input field:
    -$( "#target" ).blur(function() {
    -  alert( "Handler for .blur() called." );
    -});
    +    
    +

    The event handler can be bound to the first input field:

    +
    
    +$( "#target" ).on( "blur", function() {
    +  alert( "Handler for `blur` called." );
    +} );
         

    Now if the first field has the focus, clicking elsewhere or tabbing away from it displays the alert:

    - Handler for .blur() called. + Handler for `blur` called.

    -

    To trigger the event programmatically, apply .blur() without an argument:

    +

    To trigger the event programmatically, call .trigger( "blur" ):

    
    -$( "#other" ).click(function() {
    -  $( "#target" ).blur();
    -});
    +$( "#other" ).on( "click", function() {
    +  $( "#target" ).trigger( "blur" );
    +} );
         

    After this code executes, clicks on Trigger the handler will also alert the message.

    -

    The blur event does not bubble in Internet Explorer. Therefore, scripts that rely on event delegation with the blur event will not work consistently across browsers. As of version 1.4.2, however, jQuery works around this limitation by mapping blur to the focusout event in its event delegation methods, .live() and .delegate().

    +

    The blur event does not bubble. As of version 1.4.2, jQuery works around this limitation by mapping blur to the focusout event in its event delegation methods.

    +

    The native blur event is asynchronous in all versions of IE, contrary to other browsers. To avoid issues related to this discrepancy, as of jQuery 3.7.0, jQuery uses focusout as the native backing event for blur in IE.

    To trigger the blur event on all paragraphs: - + + +
    + + + blur event + Trigger the "blur" event on an element. + + 1.0 + + The string "blur". + + + +

    See the description for .on( "blur", ... ).

    +
    + + +
    + +
    diff --git a/entries/button-selector.xml b/entries/button-selector.xml index 858522e5c..12c8471cd 100644 --- a/entries/button-selector.xml +++ b/entries/button-selector.xml @@ -16,9 +16,9 @@ var input = $( ":button" ).addClass( "marked" ); $( "div" ).text( "For this type jQuery found " + input.length + "." ); // Prevent the form from submitting -$( "form" ).submit(function( event ) { +$( "form" ).on( "submit", function( event ) { event.preventDefault(); -}); +} ); ]]>
    - + + + + + change event + Trigger the "change" event on an element. + + 1.0 + + The string "change". + + + +

    See the description for .on( "change", ... ).

    +
    + +
    + + diff --git a/entries/checkbox-selector.xml b/entries/checkbox-selector.xml index 843cdaf77..ba0fd815d 100644 --- a/entries/checkbox-selector.xml +++ b/entries/checkbox-selector.xml @@ -26,9 +26,9 @@ $( "div" ) .css( "color", "red" ); // Prevent the form from submitting -$( "form" ).submit(function( event ) { +$( "form" ).on( "submit", function( event ) { event.preventDefault(); -}); +} ); ]]> - Trigger the click event on all of the paragraphs on the page: + Trigger the click event on all the paragraphs on the page: - + + + + + click event + Trigger the "click" event on an element. + + 1.0 + + The string "click". + + + +

    See the description for .on( "click", ... ).

    +
    + +
    + + diff --git a/entries/clone.xml b/entries/clone.xml index 8dcd4fb26..764b66686 100644 --- a/entries/clone.xml +++ b/entries/clone.xml @@ -18,7 +18,10 @@ Create a deep copy of the set of matched elements. -

    The .clone() method performs a deep copy of the set of matched elements, meaning that it copies the matched elements as well as all of their descendant elements and text nodes. For performance reasons, the dynamic state of form elements (e.g., user data typed into input, and textarea or user selections made to a select) is not copied to the cloned elements. The clone operation sets these fields to their default values as specified in the HTML.

    +

    The .clone() method performs a deep copy of the set of matched elements, meaning that it copies the matched elements as well as all of their descendant elements and text nodes.

    +
    +

    Note: For performance reasons, the dynamic state of certain form elements (e.g., user data typed into textarea and user selections made to a select) is not copied to the cloned elements. When cloning input elements, the dynamic state of the element (e.g., user data typed into text inputs and user selections made to a checkbox) is retained in the cloned elements.

    +

    When used in conjunction with one of the insertion methods, .clone() is a convenient way to duplicate elements on a page. Consider the following HTML:

    
     <div class="container">
    @@ -60,7 +63,7 @@ $( ".hello" ).clone().appendTo( ".goodbye" );
         

    However, objects and arrays within element data are not copied and will continue to be shared between the cloned element and the original element. To deep copy all data, copy each one manually:

    
     // Original element with attached data
    -var $elem = $( "#elem" ).data( "arr": [ 1 ] ),
    +var $elem = $( "#elem" ).data( "arr", [ 1 ] ),
         $clone = $elem.clone( true )
           // Deep copy to prevent data sharing
           .data( "arr", $.extend( [], $elem.data( "arr" ) ) );
    diff --git a/entries/closest.xml b/entries/closest.xml
    index b3c8e1699..903ba1a74 100644
    --- a/entries/closest.xml
    +++ b/entries/closest.xml
    @@ -14,12 +14,12 @@
             A string containing a selector expression to match elements against.
           
           
    -        A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead.
    +        A DOM element within which a matching element may be found.
           
         
         
           1.6
    -      
    +      
             A jQuery object to match elements against.
           
         
    @@ -64,17 +64,17 @@
     <ul id="one" class="level-1">
       <li class="item-i">I</li>
       <li id="ii" class="item-ii">II
    -  <ul class="level-2">
    -    <li class="item-a">A</li>
    -    <li class="item-b">B
    -      <ul class="level-3">
    -        <li class="item-1">1</li>
    -        <li class="item-2">2</li>
    -        <li class="item-3">3</li>
    -      </ul>
    -    </li>
    -    <li class="item-c">C</li>
    -  </ul>
    +    <ul class="level-2">
    +      <li class="item-a">A</li>
    +      <li class="item-b">B
    +        <ul class="level-3">
    +          <li class="item-1">1</li>
    +          <li class="item-2">2</li>
    +          <li class="item-3">3</li>
    +        </ul>
    +      </li>
    +      <li class="item-c">C</li>
    +    </ul>
       </li>
       <li class="item-iii">III</li>
     </ul>
    @@ -109,7 +109,7 @@ $( "li.item-a" )
           Show how event delegation can be done with closest. The closest list element toggles a yellow background when it or its descendent is clicked.
           
           
    @@ -134,7 +134,7 @@ $( document ).on( "click", function( event ) {
           
           
    @@ -166,7 +166,7 @@ $( document ).on( "click", function( event ) {
             An array or string containing a selector expression to match elements against (can also be a jQuery object).
           
           
    -        A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead.
    +        A DOM element within which a matching element may be found.
           
         
         Get an array of all the elements and selectors matched against the current element up through the DOM tree.
    diff --git a/entries/contains-selector.xml b/entries/contains-selector.xml
    index e14882698..c471083f8 100644
    --- a/entries/contains-selector.xml
    +++ b/entries/contains-selector.xml
    @@ -25,5 +25,6 @@ $( "div:contains('John')" ).css( "text-decoration", "underline" );
     ]]>
       
       
    +  
       
     
    diff --git a/entries/contents.xml b/entries/contents.xml
    index 8a0a1355c..6cfa73bae 100644
    --- a/entries/contents.xml
    +++ b/entries/contents.xml
    @@ -6,8 +6,9 @@
       
       Get the children of each element in the set of matched elements, including text and comment nodes.
       
    -    

    Given a jQuery object that represents a set of DOM elements, the .contents() method allows us to search throughthe 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 as well as HTML elements in the resulting jQuery object.

    +

    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">
    @@ -33,7 +34,7 @@ $( ".container" )
         .filter( "br" )
         .remove();
         
    -

    This code first retrieves the contents of <div class="container"> and then filters it for text nodes, which are wrapped in paragraph tags. This is accomplished by testing the .nodeType property of the element. This DOM property holds a numeric code indicating the node's type; text nodes use the code 3. The contents are again filtered, this time for <br /> elements, and these elements are removed.

    +

    This code first retrieves the contents of <div class="container"> and then filters it for text nodes, which are wrapped in paragraph tags. This is accomplished by testing the .nodeType property of the element. This DOM property holds a numeric code indicating the node's type; text nodes use the code 3. The contents are again filtered, this time for <br /> elements, and these elements are removed.

    Find all the text nodes inside a paragraph and wrap them with a bold tag. @@ -46,18 +47,19 @@ $( "p" ) .wrap( "" ); ]]>
    - Change the background colour of links inside of an iframe. + Change the background color of links inside of an iframe. + diff --git a/entries/context.xml b/entries/context.xml index a7377fa1a..cd9c3cc41 100644 --- a/entries/context.xml +++ b/entries/context.xml @@ -1,12 +1,14 @@ - + .context 1.3 The DOM node context originally passed to jQuery(); if none was passed then context will likely be the document. -

    The .context property was deprecated in jQuery 1.10 and is only maintained to the extent needed for supporting .live() in the jQuery Migrate plugin. It may be removed without notice in a future version.

    +
    +

    Note: This API has been removed in jQuery 3.0.

    +

    The .live() method for binding event handlers uses this property to determine the root element to use for its event delegation needs.

    The value of this property is typically equal to document, as this is the default context for jQuery objects if none is supplied. The context may differ if, for example, the object was created by searching within an <iframe> or XML document.

    Note that the context property may only apply to the elements originally selected by jQuery(), as it is possible for the user to add elements to the collection via methods such as .add() and these may have a different context.

    @@ -18,12 +20,10 @@ $( "ul" ) .append( "
  • " + $( "ul" ).context + "
  • " ) .append( "
  • " + $( "ul", document.body ).context.nodeName + "
  • " ); ]]>
    - - + + diff --git a/entries/contextmenu-shorthand.xml b/entries/contextmenu-shorthand.xml new file mode 100644 index 000000000..9b1f48736 --- /dev/null +++ b/entries/contextmenu-shorthand.xml @@ -0,0 +1,36 @@ + + + .contextmenu() + Bind an event handler to the "contextmenu" event, or trigger that event on an element. + + 1.0 + + A function to execute each time the event is triggered. + + + + + 1.4.3 + + An object containing data that will be passed to the event handler. + + + A function to execute each time the event is triggered. + + + + + 1.0 + + +
    +

    This API is deprecated.

    +

    Instead of .contextmenu( handler ) or .contextmenu( eventData, handler ), use .on( "contextmenu", handler ) or .on( "contextmenu", eventData, handler ), respectively.

    +

    Instead of .contextmenu(), use .trigger( "contextmenu" ).

    +
    +
    + + + + +
    diff --git a/entries/contextmenu.xml b/entries/contextmenu.xml new file mode 100644 index 000000000..63d9c179c --- /dev/null +++ b/entries/contextmenu.xml @@ -0,0 +1,105 @@ + + +Bind an event handler to the "contextmenu" event, or trigger that event on an element. + + + contextmenu event + Bind an event handler to the "contextmenu" event. + + 1.0 + + A function to execute each time the event is triggered. + + + + + 1.4.3 + + An object containing data that will be passed to the event handler. + + + A function to execute each time the event is triggered. + + + + +
    +

    This page describes the contextmenu event. For the deprecated .contextmenu() method, see .contextmenu().

    +
    +

    The contextmenu event is sent to an element when the right button of the mouse is clicked on it, but before the context menu is displayed. In case the context menu key is pressed, the event is triggered on the html element or the currently focused element. Any HTML element can receive this event. + For example, consider the HTML:

    +
    
    +<div id="target">
    +  Right-click here
    +</div>
    +    
    +

    The event handler can be bound to the <div> as follows:

    +
    
    +$( "#target" ).on( "contextmenu", function() {
    +  alert( "Handler for `contextmenu` called." );
    +} );
    +    
    +

    Now right-clicking on this element displays the alert:

    +

    + Handler for `contextmenu` called. +

    +

    To trigger the event manually, use .trigger( "contextmenu" ):

    +
    
    +$( "#target" ).trigger( "contextmenu" );
    +    
    +
    + + To show a "Hello World!" alert box when the contextmenu event is triggered on a paragraph on the page: + + + + Right click to toggle background color. + + + + + + + +
    + + + contextmenu event + Trigger the "contextmenu" event on an element. + + 1.0 + + The string "contextmenu". + + + +

    See the description for .on( "contextmenu", ... ).

    +
    + + +
    + +
    diff --git a/entries/css.xml b/entries/css.xml index ec95b3cc8..85a304e82 100644 --- a/entries/css.xml +++ b/entries/css.xml @@ -1,6 +1,6 @@ - Get the value of a style property for the first element in the set of matched elements or set one or more CSS properties for every matched element. + Get the value of a computed style property for the first element in the set of matched elements or set one or more CSS properties for every matched element. .css() @@ -15,17 +15,20 @@ An array of one or more CSS properties. - Get the value of style properties for the first element in the set of matched elements. + Get the computed style properties for the first element in the set of matched elements. -

    The .css() method is a convenient way to get a style property from the first matched element, especially in light of the different ways browsers access most of those properties (the getComputedStyle() method in standards-based browsers versus the currentStyle and runtimeStyle properties in Internet Explorer) and the different terms browsers use for certain properties. For example, Internet Explorer's DOM implementation refers to the float property as styleFloat, while W3C standards-compliant browsers refer to it as cssFloat. For consistency, you can simply use "float", and jQuery will translate it to the correct value for each browser.

    -

    Also, jQuery can equally interpret the CSS and DOM formatting of multiple-word properties. For example, jQuery understands and returns the correct value for both .css( "background-color" ) and .css( "backgroundColor" ). Different browsers may return CSS color values that are logically but not textually equal, e.g., #FFF, #ffffff, and rgb(255,255,255).

    +

    The .css() method is a convenient way to get a computed style property from the first matched element, especially in light of the different ways browsers access most of those properties (the getComputedStyle() method in standards-based browsers versus the currentStyle and runtimeStyle properties in Internet Explorer prior to version 9) and the different terms browsers use for certain properties. For example, Internet Explorer's DOM implementation refers to the float property as styleFloat, while W3C standards-compliant browsers refer to it as cssFloat. For consistency, you can simply use "float", and jQuery will translate it to the correct value for each browser.

    +

    Also, jQuery can equally interpret the CSS and DOM formatting of multiple-word properties. For example, jQuery understands and returns the correct value for both .css( "background-color" ) and .css( "backgroundColor" ). This means mixed case has a special meaning, .css( "WiDtH" ) won't do the same as .css( "width" ), for example.

    +

    Note that the computed style of an element may not be the same as the value specified for that element in a style sheet. For example, computed styles of dimensions are almost always pixels, but they can be specified as em, ex, px or % in a style sheet. Different browsers may return CSS color values that are logically but not textually equal, e.g., #FFF, #ffffff, and rgb(255,255,255).

    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. + +
    @@ -122,8 +127,14 @@ $( "div" ).click(function() { A CSS property name. - + A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. + + + + + + @@ -136,7 +147,18 @@ $( "div" ).click(function() {

    As with the .prop() method, the .css() method makes setting properties of elements quick and easy. This method can take either a property name and value as separate parameters, or a single object of key-value pairs.

    Also, jQuery can equally interpret the CSS and DOM formatting of multiple-word properties. For example, jQuery understands and returns the correct value for both .css({ "background-color": "#ffe", "border-left": "5px solid #ccc" }) and .css({backgroundColor: "#ffe", borderLeft: "5px solid #ccc" }). Notice that with the DOM notation, quotation marks around the property names are optional, but with CSS notation they're required due to the hyphen in the name.

    -

    When using .css() as a setter, jQuery modifies the element's style property. For example, $( "#mydiv" ).css( "color", "green" ) is equivalent to document.getElementById( "mydiv" ).style.color = "green". Setting the value of a style property to an empty string — e.g. $( "#mydiv" ).css( "color", "" ) — removes that property from an element if it has already been directly applied, whether in the HTML style attribute, through jQuery's .css() method, or through direct DOM manipulation of the style property. It does not, however, remove a style that has been applied with a CSS rule in a stylesheet or <style> element. Warning: one notable exception is that, for IE 8 and below, removing a shorthand property such as border or background will remove that style entirely from the element, regardless of what is set in a stylesheet or <style> element.

    +

    In jQuery 3.x or older, when a number is passed as the value, jQuery will convert it to a string and add px to the end of that string. However, there are exceptions. px is not added to keys of jQuery.cssNumber If the property requires units other than px, convert the value to a string and add the appropriate units before calling the method.

    +

    In jQuery 4.0 or newer, when a number is passed as the value, jQuery will only convert it to a string and add px to the end of that string for a limited set of properties - mostly related to width, height, border, margin & padding; the full list:

    +
      +
    • setting the element position: top, right, bottom, left
    • +
    • setting the element dimensions: width, height, min-width, min-height, max-width, max-height
    • +
    • padding-related: padding, padding-top, padding-right, padding-bottom, padding-left
    • +
    • margin-related: margin, margin-top, margin-right, margin-bottom, margin-left
    • +
    • border-related: border, border-width, border-top, border-top-width, border-right, border-right-width, border-bottom, border-bottom-width, border-left, border-left-width
    • +
    +

    When using .css() as a setter, jQuery modifies the element's style property. For example, $( "#mydiv" ).css( "color", "green" ) is equivalent to document.getElementById( "mydiv" ).style.color = "green". Setting the value of a style property to an empty string — e.g. $( "#mydiv" ).css( "color", "" ) — removes that property from an element if it has already been directly applied, whether in the HTML style attribute, through jQuery's .css() method, or through direct DOM manipulation of the style property. As a consequence, the element's style for that property will be restored to whatever value was applied. So, this method can be used to cancel any style modification you have previously performed. It does not, however, remove a style that has been applied with a CSS rule in a stylesheet or <style> element. Warning: one notable exception is that, for IE 8 and below, removing a shorthand property such as border or background will remove that style entirely from the element, regardless of what is set in a stylesheet or <style> element.

    +

    Note: .css() doesn't support !important declarations. So, the statement $( "p" ).css( "color", "red !important" ) does not turn the color of all paragraphs in the page to red as of jQuery 3.6.0. Do not depend on that not working, though, as a future version of jQuery may add support for such declarations. It's strongly advised to use classes instead; otherwise use a jQuery plugin.

    +

    As of jQuery 1.8, the .css() setter will automatically take care of prefixing the property name. For example, take .css( "user-select", "none" ) in Chrome/Safari will set it as -webkit-user-select, Firefox will use -moz-user-select, and IE10 will use -ms-user-select.

    As of jQuery 1.6, .css() accepts relative values similar to .animate(). Relative values are a string starting with += or -= to increment or decrement the current value. For example, if an element's padding-left was 10px, .css( "padding-left", "+=15" ) would result in a total padding-left of 25px.

    As of jQuery 1.4, .css() allows us to pass a function as the property value:

    
    @@ -146,6 +168,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. @@ -271,5 +294,7 @@ $( "div" ).on( "click", function() { + +
    diff --git a/entries/data.xml b/entries/data.xml index 560f49d5f..d998d38c7 100644 --- a/entries/data.xml +++ b/entries/data.xml @@ -8,8 +8,8 @@ A string naming the piece of data to set. - - The new data value; it can be any Javascript type including Array or Object. + + The new data value; this can be any Javascript type except undefined. @@ -21,25 +21,27 @@ Store arbitrary data associated with the matched elements.

    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 set several distinct values for a single element and retrieve them later:

    +

    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. jQuery itself uses the .data() method to save information under the names 'events' and 'handle', and also reserves any data name starting with an underscore ('_') for internal use.

    -

    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.

    +

    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.

    + Store then retrieve a value from the div element.
    Double click to toggle background color. + + + + diff --git a/entries/deferred.isRejected.xml b/entries/deferred.isRejected.xml index ebf93473a..a391f7795 100644 --- a/entries/deferred.isRejected.xml +++ b/entries/deferred.isRejected.xml @@ -6,11 +6,14 @@ Determine whether a Deferred object has been rejected. -

    As of jQuery 1.7 this API has been deprecated; please use deferred.state() instead.

    -

    Returns true if the Deferred object is in the rejected state, meaning that either deferred.reject() or deferred.rejectWith() has been called for the object and the failCallbacks have been called (or are in the process of being called).

    +
    +

    Note: This API has been removed in jQuery 1.8; please use deferred.state() instead.

    +
    +

    Returns true if the Deferred object is in the rejected state, meaning that either deferred.reject() or deferred.rejectWith() has been called for the object and the failCallbacks have been called (or are in the process of being called).

    Note that a Deferred object can be in one of three states: pending, resolved, or rejected; use deferred.isResolved() to determine whether the Deferred object is in the resolved state. These methods are primarily useful for debugging, for example to determine whether a Deferred has already been resolved even though you are inside code that intended to reject it.

    + diff --git a/entries/deferred.isResolved.xml b/entries/deferred.isResolved.xml index fa1a93925..9c046e5ae 100644 --- a/entries/deferred.isResolved.xml +++ b/entries/deferred.isResolved.xml @@ -6,11 +6,14 @@ Determine whether a Deferred object has been resolved. -

    This API is deprecated as of jQuery 1.7 and removed as of jQuery 1.8; please use deferred.state() instead.

    +
    +

    Note: This API has been removed in jQuery 1.8; please use deferred.state() instead.

    +

    Returns true if the Deferred object is in the resolved state, meaning that either deferred.resolve() or deferred.resolveWith() has been called for the object and the doneCallbacks have been called (or are in the process of being called).

    Note that a Deferred object can be in one of three states: pending, resolved, or rejected; use deferred.isRejected() to determine whether the Deferred object is in the rejected state. These methods are primarily useful for debugging, for example to determine whether a Deferred has already been resolved even though you are inside code that intended to reject it.

    + diff --git a/entries/deferred.notifyWith.xml b/entries/deferred.notifyWith.xml index 79c845ef9..add312b8a 100644 --- a/entries/deferred.notifyWith.xml +++ b/entries/deferred.notifyWith.xml @@ -8,9 +8,9 @@ Context passed to the progressCallbacks as the this object. - + - Optional arguments that are passed to the progressCallbacks. + An optional array of arguments that are passed to the progressCallbacks. diff --git a/entries/deferred.pipe.xml b/entries/deferred.pipe.xml index 66eda149d..a74f9dac6 100644 --- a/entries/deferred.pipe.xml +++ b/entries/deferred.pipe.xml @@ -34,7 +34,9 @@ Utility method to filter and/or chain Deferreds. -

    Deprecation Notice:As of jQuery 1.8, the deferred.pipe() method is deprecated. The deferred.then() method, which replaces it, should be used instead.

    +
    +

    Deprecation Notice:As of jQuery 1.8, the deferred.pipe() method is deprecated. The deferred.then() method, which replaces it, should be used instead.

    +

    The deferred.pipe() method returns a new promise that filters the status and values of a deferred through a function. The doneFilter and failFilter functions filter the original deferred's resolved / rejected status and values. As of jQuery 1.7, the method also accepts a progressFilter function to filter any calls to the original deferred's notify or notifyWith methods. These filter functions can return a new value to be passed along to the piped promise's done() or fail() callbacks, or they can return another observable object (Deferred, Promise, etc) which will pass its resolved / rejected status and values to the piped promise's callbacks. If the filter function used is null, or not specified, the piped promise will be resolved or rejected with the same values as the original.

    diff --git a/entries/deferred.progress.xml b/entries/deferred.progress.xml index fd7635a17..87189af93 100644 --- a/entries/deferred.progress.xml +++ b/entries/deferred.progress.xml @@ -10,10 +10,17 @@ A function, or array of functions, to be called when the Deferred generates progress notifications.
    + + + + + Optional additional functions, or arrays of functions, to be called when the Deferred generates progress notifications. + + Add handlers to be called when the Deferred object generates progress notifications. -

    The argument can be either a single function or an array of functions. When the Deferred generates progress notifications by calling notify or notifyWith, the progressCallbacks are called. Since deferred.progress() returns the Deferred object, other methods of the Deferred object can be chained to this one. When the Deferred is resolved or rejected, progress callbacks will no longer be called, with the exception that any progressCallbacks added after the Deferred enters the resolved or rejected state are executed immediately when they are added, using the arguments that were passed to the .notify() or notifyWith() call. For more information, see the documentation for jQuery.Deferred().

    +

    The deferred.progress() method accepts one or more arguments, all of which can be either a single function or an array of functions. When the Deferred generates progress notifications by calling notify or notifyWith, the progressCallbacks are called. Since deferred.progress() returns the Deferred object, other methods of the Deferred object can be chained to this one. When the Deferred is resolved or rejected, progress callbacks will no longer be called, with the exception that any progressCallbacks added after the Deferred enters the resolved or rejected state are executed immediately when they are added, using the arguments that were passed to the .notify() or notifyWith() call. For more information, see the documentation for jQuery.Deferred().

    diff --git a/entries/deferred.promise.xml b/entries/deferred.promise.xml index bcd188157..db6550bd9 100644 --- a/entries/deferred.promise.xml +++ b/entries/deferred.promise.xml @@ -9,7 +9,7 @@ Return a Deferred's Promise object. -

    The deferred.promise() method allows an asynchronous function to prevent other code from interfering with the progress or status of its internal request. The Promise exposes only the Deferred methods needed to attach additional handlers or determine the state (then, done, fail, always, pipe, progress, and state), but not ones that change the state (resolve, reject, notify, resolveWith, rejectWith, and notifyWith).

    +

    The deferred.promise() method allows an asynchronous function to prevent other code from interfering with the progress or status of its internal request. The Promise exposes only the Deferred methods needed to attach additional handlers or determine the state (then, done, fail, always, pipe, progress, state and promise), but not ones that change the state (resolve, reject, notify, resolveWith, rejectWith, and notifyWith).

    If target is provided, deferred.promise() will attach the methods onto it and then return this object rather than create a new one. This can be useful to attach the Promise behavior to an object that already exists.

    If you are creating a Deferred, keep a reference to the Deferred so that it can be resolved or rejected at some point. Return only the Promise object via deferred.promise() so other code can register callbacks or inspect the current state.

    For more information, see the documentation for Deferred object.

    @@ -18,7 +18,7 @@ Create a Deferred and set two timer-based functions to either resolve or reject the Deferred after a random interval. Whichever one fires first "wins" and will call one of the callbacks. The second timeout has no effect since the Deferred is already complete (in a resolved or rejected state) from the first timeout action. Also set a timer-based progress notification function, and call a progress handler that adds "working..." to the document body. @@ -146,4 +148,5 @@ $( "button" ).click(function() { + diff --git a/entries/dequeue.xml b/entries/dequeue.xml index 7caca4e36..c54401c78 100644 --- a/entries/dequeue.xml +++ b/entries/dequeue.xml @@ -14,7 +14,7 @@ Use dequeue to end a custom queue function which allows the queue to keep going. attribute selector; :disabled checks the boolean (true/false) value of the element's disabled property while [disabled] checks for the existence of the disabled attribute.

    +

    Although their resulting selections are usually the same, the :disabled selector is subtly different from the [disabled] attribute selector;:disabled matches elements that are actually disabled while [disabled] only checks for the existence of the disabled attribute.

    -

    The :disabled selector should only be used for selecting HTML elements that support the disabled attribute (<button>, <input>, <optgroup>, <option>, <select>, and <textarea>).

    +

    The :disabled selector should only be used for selecting HTML elements that support the disabled attribute (<button>, <input>, <optgroup>, <option>, <select>, <textarea>, <menuitem>, and <fieldset>).

    diff --git a/entries/each.xml b/entries/each.xml index ea75814e9..fd2db6483 100644 --- a/entries/each.xml +++ b/entries/each.xml @@ -3,8 +3,10 @@ .each() 1.0 - + A function to execute for each matched element. + + Iterate over a jQuery object, executing a function for each matched element. @@ -44,15 +46,15 @@ $( "li" ).addClass( "bar" ); Iterate over three divs and sets their color property. - - + + + + + error event + Trigger the "error" event on an element. + + 1.0 + + The string "error". + + + +

    See the description for .on( "error", ... ).

    +
    + +
    + + diff --git a/entries/even-selector.xml b/entries/even-selector.xml index f190e0667..bfc8038a3 100644 --- a/entries/even-selector.xml +++ b/entries/even-selector.xml @@ -1,12 +1,15 @@ - + :even Selector :even 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.

    @@ -33,4 +36,5 @@ $( "tr:even" ).css( "background-color", "#bbf" ); +
    diff --git a/entries/even.xml b/entries/even.xml new file mode 100644 index 000000000..cecff9e42 --- /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. + + + + + + +
    diff --git a/entries/event.currentTarget.xml b/entries/event.currentTarget.xml index f70a8626d..859cb8d41 100644 --- a/entries/event.currentTarget.xml +++ b/entries/event.currentTarget.xml @@ -14,11 +14,11 @@ Alert that currentTarget matches the `this` keyword. -
    \ No newline at end of file + diff --git a/entries/event.isDefaultPrevented.xml b/entries/event.isDefaultPrevented.xml index 676b31f3b..d9ada3149 100644 --- a/entries/event.isDefaultPrevented.xml +++ b/entries/event.isDefaultPrevented.xml @@ -9,7 +9,7 @@ Checks whether event.preventDefault() was called. diff --git a/entries/event.namespace.xml b/entries/event.namespace.xml index ed661c920..bbebcda4d 100644 --- a/entries/event.namespace.xml +++ b/entries/event.namespace.xml @@ -14,7 +14,7 @@ $( "p" ).on( "test.something", function( event ) { alert( event.namespace ); }); -$( "button" ).click(function( event ) { +$( "button" ).on( "click", function( event ) { $( "p" ).trigger( "test.something" ); }); ]]> diff --git a/entries/event.preventDefault.xml b/entries/event.preventDefault.xml index 68f0a43ac..82b4e1047 100644 --- a/entries/event.preventDefault.xml +++ b/entries/event.preventDefault.xml @@ -11,7 +11,7 @@ Cancel the default action (navigation) of the click. diff --git a/entries/event.relatedTarget.xml b/entries/event.relatedTarget.xml index 97908df75..e4ee9eafa 100644 --- a/entries/event.relatedTarget.xml +++ b/entries/event.relatedTarget.xml @@ -11,9 +11,9 @@ On mouseout of anchors, alert the element type being entered. diff --git a/entries/event.result.xml b/entries/event.result.xml index fa5cd9adc..40bd18724 100644 --- a/entries/event.result.xml +++ b/entries/event.result.xml @@ -11,10 +11,10 @@ Display previous handler's return value diff --git a/entries/event.stopImmediatePropagation.xml b/entries/event.stopImmediatePropagation.xml index b067e43a9..dd86bd7cc 100644 --- a/entries/event.stopImmediatePropagation.xml +++ b/entries/event.stopImmediatePropagation.xml @@ -1,5 +1,5 @@ - + event.stopImmediatePropagation() 1.3 @@ -25,14 +25,14 @@ } ]]> @@ -40,7 +40,7 @@ function handler( event ) { target.children().toggle(); } } -$( "ul" ).click( handler ).find( "ul" ).hide(); +$( "ul" ).on( "click", handler ).find( "ul" ).hide(); ]]> diff --git a/entries/event.which.xml b/entries/event.which.xml index f2f746856..e8e6aa28b 100644 --- a/entries/event.which.xml +++ b/entries/event.which.xml @@ -6,7 +6,7 @@ For key or mouse events, this property indicates the specific key or button that was pressed. -

    The event.which property normalizes event.keyCode and event.charCode. It is recommended to watch event.which for keyboard key input. For more detail, read about event.charCode on the MDC.

    +

    The event.which property normalizes event.keyCode and event.charCode. It is recommended to watch event.which for keyboard key input. For more detail, read about event.charCode on the MDN.

    event.which also normalizes button presses (mousedown and mouseupevents), reporting 1 for left button, 2 for middle, and 3 for right. Use event.which instead of event.button.

    @@ -29,7 +29,7 @@ $( "#whichkey" ).on( "mousedown", function( event ) { }); ]]> diff --git a/entries/fadeIn.xml b/entries/fadeIn.xml index 819e663ea..1975c039c 100644 --- a/entries/fadeIn.xml +++ b/entries/fadeIn.xml @@ -29,20 +29,21 @@ <img id="book" src="book.png" alt="" width="100" height="123"> // With the element initially hidden, we can show it slowly: -$( "#clickme" ).click(function() { +$( "#clickme" ).on( "click", function() { $( "#book" ).fadeIn( "slow", function() { // Animation complete }); });
    -

    - - - - -

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

    @@ -51,9 +52,9 @@ $( "#clickme" ).click(function() { Animates hidden divs to fade in one by one, completing each animation within 600 milliseconds. @@ -75,7 +76,7 @@ $( "p" ).click(function() { Fades out spans in one section that you click on. @@ -127,26 +128,26 @@ var getPos = function( n ) { $( "p" ).each(function( n ) { var r = Math.floor( Math.random() * 3 ); var tmp = $( this ).text(); - $( this ).text( $( "p:eq(" + r + ")" ).text() ); - $( "p:eq(" + r + ")" ).text( tmp ); + $( this ).text( $( "p" ).eq( r ).text() ); + $( "p" ).eq( r ).text( tmp ); $( this ).css( "left", getPos( n ) ); -}); +} ); $( "div" ) .each(function( n ) { $( this ).css( "left", getPos( n ) ); - }) + } ) .css( "cursor", "pointer" ) - .click( function() { + .on( "click", function() { $( this ).fadeTo( 250, 0.25, function() { $( this ) .css( "cursor", "" ) .prev() - .css({ + .css( { "font-weight": "bolder", "font-style": "italic" - }); - }); - }); + } ); + } ); + } ); ]]>

    The result of this call would be a red background on item 1.

    +
    Starts with all paragraphs and searches for descendant span elements, same as $( "p span" ) diff --git a/entries/finish.xml b/entries/finish.xml index 969757504..506d53f2b 100644 --- a/entries/finish.xml +++ b/entries/finish.xml @@ -4,7 +4,7 @@ Stop the currently-running animation, remove all queued animations, and complete all animations for the matched elements. 1.9 - + The name of the queue in which to stop animations. diff --git a/entries/first-child-selector.xml b/entries/first-child-selector.xml index 4b30b503a..d91a50b8b 100644 --- a/entries/first-child-selector.xml +++ b/entries/first-child-selector.xml @@ -7,7 +7,7 @@ Selects all elements that are the first child of their parent. -

    While :first matches only a single element, the :first-child selector can match more than one: one for each parent. This is equivalent to :nth-child(1).

    +

    While .first() matches only a single element, the :first-child selector can match more than one: one for each parent. This is equivalent to :nth-child(1).

    Finds the first span in each matched div to underline and add a hover state. diff --git a/entries/first-selector.xml b/entries/first-selector.xml index a0371809b..1308ff5ec 100644 --- a/entries/first-selector.xml +++ b/entries/first-selector.xml @@ -1,12 +1,15 @@ - + :first Selector :first 1.0 - Selects the first matched element. + 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().

    +

    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.

    @@ -33,4 +36,5 @@ $( "tr:first" ).css( "font-style", "italic" ); +
    diff --git a/entries/first.xml b/entries/first.xml index f73f8f10b..90ac489c7 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. diff --git a/entries/focus-shorthand.xml b/entries/focus-shorthand.xml new file mode 100644 index 000000000..a38f4c280 --- /dev/null +++ b/entries/focus-shorthand.xml @@ -0,0 +1,37 @@ + + + .focus() + Bind an event handler to the "focus" event, or trigger that event on an element. + + 1.0 + + A function to execute each time the event is triggered. + + + + + 1.4.3 + + An object containing data that will be passed to the event handler. + + + A function to execute each time the event is triggered. + + + + + 1.0 + + +
    +

    This API is deprecated.

    +

    Instead of .focus( handler ) or .focus( eventData, handler ), use .on( "focus", handler ) or .on( "focus", eventData, handler ), respectively.

    +

    Instead of .focus(), use .trigger( "focus" ).

    +
    +
    + + + + + +
    diff --git a/entries/focus.xml b/entries/focus.xml index b8398786e..c9736a295 100644 --- a/entries/focus.xml +++ b/entries/focus.xml @@ -1,33 +1,33 @@ - - .focus() - Bind an event handler to the "focus" JavaScript event, or trigger that event on an element. + + +Bind an event handler to the "focus" event, or trigger that event on an element. + + focus event + Bind an event handler to the "focus" event. - 1.0 - - A function to execute each time the event is triggered. + 1.7 + + The string "focus". - - - 1.4.3 - + An object containing data that will be passed to the event handler. - + A function to execute each time the event is triggered. + - - 1.0 - +
    +

    This page describes the focus event. For the deprecated .focus() method, see .focus().

    +
      -
    • This method is a shortcut for .on( "focus", handler ) in the first and second variations, and .trigger( "focus" ) in the third.
    • The focus event is sent to an element when it gains focus. This event is implicitly applicable to a limited set of elements, such as form elements (<input>, <select>, etc.) and links (<a href>). In recent browser versions, the event can be extended to include all element types by explicitly setting the element's tabindex property. An element can gain focus via keyboard commands, such as the Tab key, or by mouse clicks on the element.
    • Elements with focus are usually highlighted in some way by the browser, for example with a dotted line surrounding the element. The focus is used to determine which element is the first to receive keyboard-related events.
    -

    Attempting to set focus to a hidden element causes an error in Internet Explorer. Take care to only use .focus() on elements that are visible. To run an element's focus event handlers without setting focus to the element, use .triggerHandler( "focus" ) instead of .focus().

    +

    Attempting to set focus to a hidden element causes an error in Internet Explorer. Take care to only use .trigger( "focus" ) on elements that are visible. To run an element's focus event handlers without setting focus to the element, use .triggerHandler( "focus" ) instead of .trigger( "focus" ).

    For example, consider the HTML:

    
    @@ -41,22 +41,23 @@
         

    The event handler can be bound to the first input field:

    
    -$( "#target" ).focus(function() {
    -  alert( "Handler for .focus() called." );
    -});
    +$( "#target" ).on( "focus", function() {
    +  alert( "Handler for `focus` called." );
    +} );
         

    Now clicking on the first field, or tabbing to it from another field, displays the alert:

    - Handler for .focus() called. + Handler for `focus` called.

    We can trigger the event when another element is clicked:

    
    -$( "#other" ).click(function() {
    -  $( "#target" ).focus();
    -});
    +$( "#other" ).on( "click", function() {
    +  $( "#target" ).trigger( "focus" );
    +} );
         

    After this code executes, clicks on Trigger the handler will also alert the message.

    -

    The focus event does not bubble in Internet Explorer. Therefore, scripts that rely on event delegation with the focus event will not work consistently across browsers. As of version 1.4.2, however, jQuery works around this limitation by mapping focus to the focusin event in its event delegation methods, .live() and .delegate().

    +

    The focus event does not bubble. As of version 1.4.2, jQuery works around this limitation by mapping focus to the focusin event in its event delegation methods.

    +

    The native focus event is asynchronous in all versions of IE, contrary to other browsers. To avoid issues related to this discrepancy, as of jQuery 3.7.0, jQuery uses focusin as the native backing event for focus in IE.

    Fire focus. @@ -66,9 +67,9 @@ $( "#other" ).click(function() { } ]]>
    To focus on a login input box with id 'login' on page startup, try: - + + + + + + focus event + Trigger the "focus" event on an element. + + 1.0 + + The string "focus". + + + +

    See the description for .on( "focus", ... ).

    +
    + + +
    + + diff --git a/entries/focusin-shorthand.xml b/entries/focusin-shorthand.xml new file mode 100644 index 000000000..ff8f548ed --- /dev/null +++ b/entries/focusin-shorthand.xml @@ -0,0 +1,37 @@ + + + .focusin() + Bind an event handler to the "focusin" event, or trigger that event on an element. + + 1.0 + + A function to execute each time the event is triggered. + + + + + 1.4.3 + + An object containing data that will be passed to the event handler. + + + A function to execute each time the event is triggered. + + + + + 1.0 + + +
    +

    This API is deprecated.

    +

    Instead of .focusin( handler ) or .focusin( eventData, handler ), use .on( "focusin", handler ) or .on( "focusin", eventData, handler ), respectively.

    +

    Instead of .focusin(), use .trigger( "focusin" ).

    +
    +
    + + + + + +
    diff --git a/entries/focusin.xml b/entries/focusin.xml index e441a4e49..7b5288f67 100644 --- a/entries/focusin.xml +++ b/entries/focusin.xml @@ -1,24 +1,27 @@ - - .focusin() + + +Bind an event handler to the "focusin" event, or trigger that event on an element. + + focusin event Bind an event handler to the "focusin" event. - 1.4 - - A function to execute each time the event is triggered. + 1.7 + + The string "focusin". - - - 1.4.3 - + An object containing data that will be passed to the event handler. - + A function to execute each time the event is triggered. + -

    This method is a shortcut for .on('focusin', handler).

    +
    +

    This page describes the focusin event. For the deprecated .focusin() method, see .focusin().

    +

    The focusin event is sent to an element when it, or any element inside of it, gains focus. This is distinct from the focus event in that it supports detecting the focus event on parent elements (in other words, it supports event bubbling).

    This event will likely be used together with the focusout event.

    @@ -30,9 +33,9 @@ } ]]>
    + + + + + + + + focusin event + Trigger the "focusin" event on an element. + + 1.0 + + The string "focusin". + + + +

    See the description for .on( "focusin", ... ).

    +
    + + + -
    + + diff --git a/entries/focusout-shorthand.xml b/entries/focusout-shorthand.xml new file mode 100644 index 000000000..6114a08be --- /dev/null +++ b/entries/focusout-shorthand.xml @@ -0,0 +1,37 @@ + + + .focusout() + Bind an event handler to the "focusout" event, or trigger that event on an element. + + 1.0 + + A function to execute each time the event is triggered. + + + + + 1.4.3 + + An object containing data that will be passed to the event handler. + + + A function to execute each time the event is triggered. + + + + + 1.0 + + +
    +

    This API is deprecated.

    +

    Instead of .focusout( handler ) or .focusout( eventData, handler ), use .on( "focusout", handler ) or .on( "focusout", eventData, handler ), respectively.

    +

    Instead of .focusout(), use .trigger( "focusout" ).

    +
    +
    + + + + + +
    diff --git a/entries/focusout.xml b/entries/focusout.xml index 5528f56a7..7b90cb82d 100644 --- a/entries/focusout.xml +++ b/entries/focusout.xml @@ -1,24 +1,27 @@ - - .focusout() - Bind an event handler to the "focusout" JavaScript event. + + +Bind an event handler to the "focusout" event, or trigger that event on an element. + + focusout event + Bind an event handler to the "focusout" event. - 1.4 - - A function to execute each time the event is triggered. + 1.7 + + The string "focusout". - - - 1.4.3 - + An object containing data that will be passed to the event handler. - + A function to execute each time the event is triggered. + -

    This method is a shortcut for .on( "focusout", handler ) when passed arguments, and .trigger( "focusout" ) when no arguments are passed.

    +
    +

    This page describes the focusout event. For the deprecated .focusout() method, see .focusout().

    +

    The focusout event is sent to an element when it, or any element inside of it, loses focus. This is distinct from the blur event in that it supports detecting the loss of focus on descendant elements (in other words, it supports event bubbling).

    This event will likely be used together with the focusin event.

    @@ -34,17 +37,17 @@ } ]]>
    - - + + + + + + + + + focusout event + Trigger the "focuout" event on an element. + + 1.0 + + The string "focusout". + + + +

    See the description for .on( "focusout", ... ).

    +
    + + + -
    + + diff --git a/entries/get.xml b/entries/get.xml index d9e7428ff..cb52eb2d0 100644 --- a/entries/get.xml +++ b/entries/get.xml @@ -9,9 +9,9 @@ A zero-based integer indicating which element to retrieve. - Retrieve one of the DOM elements matched by the jQuery object. + Retrieve one of the elements matched by the jQuery object. -

    The .get() method grants us access to the DOM nodes underlying each jQuery object. Consider a simple unordered list:

    +

    The .get() method grants access to the DOM nodes underlying each jQuery object. If the value of index is out of bounds — less than the negative number of elements or equal to or greater than the number of elements — it returns undefined. Consider a simple unordered list:

    
     <ul>
       <li id="foo">foo</li>
    @@ -43,10 +43,10 @@ console.log( $( "li" ).get( -1 ) );
         
           Display the tag name of the click element.
           
           
     $( "#mydiv" ).hasClass( "quux" )
         
    +

    As of jQuery 1.12/2.2, this method supports XML documents, including SVG.

    Looks for the paragraph that contains 'selected' as a class. @@ -83,7 +89,13 @@ $( "#getw" ).click(function() { 1.4.1 - + + + + + + + A function returning the height to set. Receives the index position of the element in the set and the old height as arguments. Within the function, this refers to the current element in the set. diff --git a/entries/hidden-selector.xml b/entries/hidden-selector.xml index e866292dd..44b8397c6 100644 --- a/entries/hidden-selector.xml +++ b/entries/hidden-selector.xml @@ -16,19 +16,22 @@

Elements with visibility: hidden or opacity: 0 are considered to be visible, since they still consume space in the layout. During animations that hide an element, the element is considered to be visible until the end of the animation.

Elements that are not in a document are not considered to be visible; jQuery does not have a way to know if they will be visible when appended to a document since it depends on the applicable styles.

+

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.

+ Shows all hidden divs and counts hidden inputs. @@ -97,13 +101,13 @@ $( "button" ).click(function() { Animates all spans (words in this case) to hide fastly, completing each animation within 200 milliseconds. Once each animation is done, it starts the next one. @@ -130,7 +134,7 @@ $( "#shower" ).click(function() { for ( var i = 0; i < 5; i++ ) { $( "
" ).appendTo( document.body ); } -$( "div" ).click(function() { +$( "div" ).on( "click", function() { $( this ).hide( 2000, function() { $( this ).remove(); }); diff --git a/entries/hover.xml b/entries/hover.xml index fcfdd377d..a924d368f 100644 --- a/entries/hover.xml +++ b/entries/hover.xml @@ -1,25 +1,30 @@ Bind one or two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements. - + .hover() Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements. 1.0 - - A function to execute when the mouse pointer enters the element. + + + A function to execute when the mouse pointer enters the element. - - A function to execute when the mouse pointer leaves the element. + + + A function to execute when the mouse pointer leaves the element. +
+

This API is deprecated. Use .on( "mouseenter", handlerIn ).on( "mouseleave", handlerOut ) instead.

+

The .hover() method binds handlers for both mouseenter and mouseleave events. You can use it to simply apply behavior to an element during the time the mouse is within the element.

Calling $( selector ).hover( handlerIn, handlerOut ) is shorthand for:


-$( selector ).mouseenter( handlerIn ).mouseleave( handlerOut );
+$( selector ).on( "mouseenter", handlerIn ).on( "mouseleave", handlerOut );
       
-

See the discussions for .mouseenter() and .mouseleave() for more details.

+

See the discussions for mouseenter and mouseleave for more details.

To add a special style to list items that are being hovered over, try: @@ -28,7 +33,7 @@ $( "li" ).hover( function() { $( this ).append( $( " ***" ) ); }, function() { - $( this ).find( "span:last" ).remove(); + $( this ).find( "span" ).last().remove(); } ); @@ -78,31 +83,37 @@ $( "td" ).off( "mouseenter mouseleave" ); +
- + + Bind a single handler to the matched elements, to be executed when the mouse pointer enters or leaves the elements. 1.4 - - A function to execute when the mouse pointer enters or leaves the element. + + + A function to execute when the mouse pointer enters or leaves the element. +
+

This API is deprecated. Use .on( "mouseenter mouseleave", handlerInOut ) instead.

+

The .hover() method, when passed a single function, will execute that handler for both mouseenter and mouseleave events. This allows the user to use jQuery's various toggle methods within the handler or to respond differently within the handler depending on the event.type.

Calling $(selector).hover(handlerInOut) is shorthand for:


 $( selector ).on( "mouseenter mouseleave", handlerInOut );
       
-

See the discussions for .mouseenter() and .mouseleave() for more details.

+

See the discussions for mouseenter and mouseleave for more details.

Slide the next sibling LI up or down on hover, and toggle a class. + + + + + + + +
+ +
diff --git a/entries/innerWidth.xml b/entries/innerWidth.xml index 0a438e806..54b6b3588 100644 --- a/entries/innerWidth.xml +++ b/entries/innerWidth.xml @@ -1,22 +1,27 @@ - + + Get the current computed inner width (including padding but not border) for the first element in the set of matched elements or set the inner width of every matched element. + .innerWidth() 1.2.6 - Get the current computed width for the first element in the set of matched elements, including padding but not border. + Get the current computed inner width for the first element in the set of matched elements, including padding but not border. -

This method returns the width of the element, including left and right padding, in pixels.

+

This method returns the width of the element, including left and right padding, in pixels. If called on an empty set of elements, returns undefined (null before jQuery 3.0).

This method is not applicable to window and document objects; for these, use .width() instead.

-

+

-

+
Figure 1 - Illustration of the measured width
+
+ + Get the innerWidth of a paragraph. + + + + + + + +
+
diff --git a/entries/input-selector.xml b/entries/input-selector.xml index 7f5d8fd9a..ec5c6c23d 100644 --- a/entries/input-selector.xml +++ b/entries/input-selector.xml @@ -18,9 +18,9 @@ var formChildren = $( "form > *" ); $( "#messages" ).text( "Found " + allInputs.length + " inputs and the form has " + formChildren.length + " children." ); -$( "form" ).submit(function( event ) { +$( "form" ).on( "submit", function( event ) { event.preventDefault(); -}); +} ); ]]> + + + +
diff --git a/entries/jQuery.Deferred.getErrorHook.xml b/entries/jQuery.Deferred.getErrorHook.xml new file mode 100644 index 000000000..b20f98e8e --- /dev/null +++ b/entries/jQuery.Deferred.getErrorHook.xml @@ -0,0 +1,29 @@ + + + jQuery.Deferred.getErrorHook() + + 3.7 + + Return an Error instance with a defined stack. + +
+

Note: This API is not defined by default, but jQuery will make use of it when defined.

+
+

When jQuery.Deferred.getErrorHook is defined, it extends the jQuery.Deferred features added in jQuery 3.0 to include an error captured before the async barrier whenever a Deferred throws an exception. This makes it easier to find programming errors that occur inside Deferreds. You can find an example implementation you can copy-paste below, or you can use jquery-deferred-reporter plugin.

+

+jQuery.Deferred.getErrorHook = function() {
+  try {
+    throw new Error( "Exception in jQuery.Deferred" );
+  } catch ( err ) {
+    return err;
+  }
+};
+    
+

When defined, an error returned by this API is passed to jQuery.Deferred.exceptionHook as the second parameter.

+

Why does this API exist?

+

Prior to jQuery 3.0, Deferreds would simply terminate and the browser would generate a message on the console if an exception occurred such as attempting to call an undefined method as a function (e.g., myobject.missingFunction()). As of version 3.0, jQuery.Deferred follows the Promise/A+ specification when you use the .then method. The spec requires all errors to be trapped by the Promise, which prevents console errors from being logged. If the user has forgotten to add a handler for rejected promises, this can result in the error being silently swallowed with no notification at all!

+

The native Promise object as implemented in the browser tracks Promise rejections and reports problems on the console. However, doing the same type of reporting in the JavaScript world is much more difficult. jQuery itself is unable to use the native Promise because jQuery.Deferred implements a superset of Promise that requires additional features for methods like .done or .fail, and because Promise is not implemented on all the platforms that jQuery supports.

+
+ + +
diff --git a/entries/jQuery.Deferred.getStackHook.xml b/entries/jQuery.Deferred.getStackHook.xml new file mode 100644 index 000000000..87ee61387 --- /dev/null +++ b/entries/jQuery.Deferred.getStackHook.xml @@ -0,0 +1,30 @@ + + + jQuery.Deferred.getStackHook() + + 3.0 + + Return an Error instance with a defined stack. + +
+

Note: This API has been deprecated in jQuery 3.7; please use the jQuery.Deferred.getErrorHook method instead.

+
+
+

Note: This API is not defined by default, but jQuery will make use of it when defined.

+
+

See jQuery.Deferred.getErrorHook for the context why this API was created. Initially, we advised users to assign to it a function returning an error stack:

+

+jQuery.Deferred.getStackHook = function() {
+  try {
+    throw new Error( "Exception in jQuery.Deferred" );
+  } catch ( err ) {
+    return err.stack; // stack property returned here
+  }
+};
+    
+

However, when such a stack is then logged by jQuery from inside of jQuery.Deferred.exceptionHook, the browser won't apply source maps. Therefore, we changed the recommendation to return the full error object itself. To make it clearer, the API was also renamed.

+
+ + + +
diff --git a/entries/jQuery.Deferred.xml b/entries/jQuery.Deferred.xml index 5bf4ca60d..2884ad879 100644 --- a/entries/jQuery.Deferred.xml +++ b/entries/jQuery.Deferred.xml @@ -14,10 +14,10 @@ - A constructor function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function. + A factory function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function. -

The jQuery.Deferred() constructor creates a new Deferred object. The new operator is optional.

-

The jQuery.Deferred method can be passed an optional function, which is called just before the constructor returns and is passed the constructed deferred object as both the this object and as the first argument to the function. The called function can attach callbacks using deferred.then(), for example.

+

The jQuery.Deferred() factory creates a new deferred object.

+

The jQuery.Deferred method can be passed an optional function, which is called just before the method returns and is passed the new deferred object as both the this object and as the first argument to the function. The called function can attach callbacks using deferred.then(), for example.

A Deferred object starts in the pending state. Any callbacks added to the object with deferred.then(), deferred.always(), deferred.done(), or deferred.fail() are queued to be executed later. Calling deferred.resolve() or deferred.resolveWith() transitions the Deferred into the resolved state and immediately executes any doneCallbacks that are set. Calling deferred.reject() or deferred.rejectWith() transitions the Deferred into the rejected state and immediately executes any failCallbacks that are set. Once the object has entered the resolved or rejected state, it stays in that state. Callbacks can still be added to the resolved or rejected Deferred — they will execute immediately.

Enhanced Callbacks with jQuery Deferred @@ -25,7 +25,7 @@

In JavaScript it is common to invoke functions that optionally accept callbacks that are called within that function. For example, in versions prior to jQuery 1.5, asynchronous processes such as jQuery.ajax() accept callbacks to be invoked some time in the near-future upon success, error, and completion of the ajax request.

jQuery.Deferred() introduces several enhancements to the way callbacks are managed and invoked. In particular, jQuery.Deferred() provides flexible ways to provide multiple callbacks, and these callbacks can be invoked regardless of whether the original callback dispatch has already occurred. jQuery Deferred is based on the CommonJS Promises/A design.

One model for understanding Deferred is to think of it as a chain-aware function wrapper. The deferred.then(), deferred.always(), deferred.done(), and deferred.fail() methods specify the functions to be called and the deferred.resolve(args) or deferred.reject(args) methods "call" the functions with the arguments you supply. Once the Deferred has been resolved or rejected it stays in that state; a second call to deferred.resolve(), for example, is ignored. If more functions are added by deferred.then(), for example, after the Deferred is resolved, they are called immediately with the arguments previously provided.

-

In most cases where a jQuery API call returns a Deferred or Deferred-compatible object, such as jQuery.ajax() or jQuery.when(), you will only want to use the deferred.then(), deferred.done(), and deferred.fail() methods to add callbacks to the Deferred's queues. The internals of the API call or code that created the Deferred will invoke deferred.resolve() or deferred.reject() on the deferred at some point, causing the appropriate callbacks to run.

+

In most cases where a jQuery API call returns a Deferred or Promise-compatible object, such as jQuery.ajax() or jQuery.when(), you will only want to use the deferred.then(), deferred.done(), and deferred.fail() methods to add callbacks to the Deferred's queues. The internals of the API call or code that created the Deferred will invoke deferred.resolve() or deferred.reject() on the deferred at some point, causing the appropriate callbacks to run.

diff --git a/entries/jQuery.ajax.xml b/entries/jQuery.ajax.xml index a8abca31b..9074388b9 100644 --- a/entries/jQuery.ajax.xml +++ b/entries/jQuery.ajax.xml @@ -8,18 +8,38 @@ A string containing the URL to which the request is sent. - 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(). See jQuery.ajax( settings ) below for a complete list of all settings. + 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(). See jQuery.ajax( settings ) below for a complete list of all settings. 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(). - - The content type sent in the request header that tells the server what kind of response it will accept in return. If the accepts setting needs modification, it is recommended to do so once in the $.ajaxSetup() method. + + 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({
+  accepts: {
+    mycustomtype: 'application/x-some-custom-type'
+  },
+
+  // Instructions for how to deserialize a `mycustomtype`
+  converters: {
+    'text mycustomtype': function(result) {
+      // Do Stuff
+      return newresult;
+    }
+  },
+
+  // Expect a `mycustomtype` back from server
+  dataType: 'mycustomtype'
+});
+          
+ Note: You will need to specify a complementary entry for this type in converters for this to work properly. +
- 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(). @@ -32,16 +52,18 @@ - A function to be called when the request finishes (after success and error callbacks are executed). The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a string categorizing the status of the request ("success", "notmodified", "error", "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event. + A function to be called when the request finishes (after success and error callbacks are executed). The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a string categorizing the status of the request ("success", "notmodified", "nocontent", "error", "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event. An object of string/regular-expression pairs that determine how jQuery will parse the response, given its content type. - - When sending data to the server, use this content type. Default is "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases. If you explicitly pass in a content-type to $.ajax(), then it is always sent to the server (even if no data is sent). The W3C XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding. + + + + When sending data to the server, use this content type. Default is "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases. If you explicitly pass in a content-type to $.ajax(), then it is always sent to the server (even if no data is sent). As of jQuery 1.6 you can pass false to tell jQuery to not set any content type header. Note: The W3C XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding. Note: For cross-domain requests, setting the content type to anything other than application/x-www-form-urlencoded, multipart/form-data, or text/plain will trigger the browser to send a preflight OPTIONS request to the server. - This object will be made the context of all Ajax-related callbacks. By default, the context is an object that represents the ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax). For example, specifying a DOM element as the context will make that the context for the complete callback of a request, like so: + This object will be the context of all Ajax-related callbacks. By default, the context is an object that represents the Ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax). For example, specifying a DOM element as the context will make that the context for the complete callback of a request, like so:

 $.ajax({
   url: "test.html",
@@ -61,25 +83,38 @@ $.ajax({
       
         
         
-        Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below).
+        
+        
+            

Data to be sent to the server. If the HTTP method is one that cannot have an entity body, such as GET, the data is appended to the URL.

+

When data is an object, jQuery generates the data string from the object's key/value pairs unless the processData option is set to false. For example, { a: "bc", d: "e,f" } is converted to the string "a=bc&d=e%2Cf". If the value is an array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below). For example, { a: [1,2] } becomes the string "a%5B%5D=1&a%5B%5D=2" with the default traditional: false setting.

+

When data is passed as a string it should already be encoded using the correct encoding for contentType, which by default is application/x-www-form-urlencoded.

+

In requests with dataType: "json" or dataType: "jsonp", if the string contains a double question mark (??) anywhere in the URL or a single question mark (?) in the query string, it is replaced with a value generated by jQuery that is unique for each copy of the library on the page (e.g. jQuery21406515378922229067_1479880736745).

+
- - A function to be used to handle the raw response data of XMLHttpRequest.This is a pre-filtering function to sanitize the response. You should return the sanitized data. The function accepts two arguments: The raw data returned from the server and the 'dataType' parameter. + + A function to be used to handle the raw response data of XMLHttpRequest. This is a pre-filtering function to sanitize the response. You should return the sanitized data. The function accepts two arguments: The raw data returned from the server and the 'dataType' parameter. The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string). The available types (and the result passed as the first argument to your success callback) are: -
  • "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. 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. -
+
    +
  • "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. 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.
  • +
  • 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.
  • +
- A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event. + A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." (in HTTP/2 it may instead be an empty string) As of jQuery 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: This handler is not called for cross-domain scripts and cross-domain JSONP requests. This is an Ajax Event. Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to control various Ajax Events. @@ -91,15 +126,20 @@ $.ajax({ Allow the request to be successful only if the response has changed since the last request. This is done by checking the Last-Modified header. Default value is false, ignoring the header. In jQuery 1.4 this technique also checks the 'etag' specified by the server to catch unmodified data. - Allow the current environment to be recognized as "local," (e.g. the filesystem), even if jQuery does not recognize it as such by default. The following protocols are currently recognized as local: file, *-extension, and widget. If the isLocal setting needs modification, it is recommended to do so once in the $.ajaxSetup() method. + Allow the current environment to be recognized as "local," (e.g. the filesystem), even if jQuery does not recognize it as such by default. The following protocols are currently recognized as local: file, *-extension, and widget. If the isLocal setting needs modification, it is recommended to do so once in the $.ajaxSetup() method. - - Override the callback function name in a jsonp request. This value will be used instead of 'callback' in the 'callback=?' part of the query string in the url. So {jsonp:'onJSONPLoad'} would result in 'onJSONPLoad=?' passed to the server. As of jQuery 1.5, setting the jsonp option to false prevents jQuery from adding the "?callback" string to the URL or attempting to use "=?" for transformation. In this case, you should also explicitly set the jsonpCallback setting. For example, { jsonp: false, jsonpCallback: "callbackName" } + + + + Override the callback function name in a JSONP request. This value will be used instead of 'callback' in the 'callback=?' part of the query string in the url. So {jsonp:'onJSONPLoad'} would result in 'onJSONPLoad=?' passed to the server. As of jQuery 1.5, setting the jsonp option to false prevents jQuery from adding the "?callback" string to the URL or attempting to use "=?" for transformation. In this case, you should also explicitly set the jsonpCallback setting. For example, { jsonp: false, jsonpCallback: "callbackName" }. If you don't trust the target of your Ajax requests, consider setting the jsonp property to false for security reasons. - Specify the callback function name for a JSONP request. This value will be used instead of the random name automatically generated by jQuery. It is preferable to let jQuery generate a unique name as it'll make it easier to manage the requests and provide callbacks and error handling. You may want to specify the callback when you want to enable better browser caching of GET requests. As of jQuery 1.5, you can also use a function for this setting, in which case the value of jsonpCallback is set to the return value of that function. + Specify the callback function name for a JSONP request. This value will be used instead of the random name automatically generated by jQuery. It is preferable to let jQuery generate a unique name as it'll make it easier to manage the requests and provide callbacks and error handling. You may want to specify the callback when you want to enable better browser caching of GET requests. As of jQuery 1.5, you can also use a function for this setting, in which case the value of jsonpCallback is set to the return value of that function. + + + The HTTP method to use for the request (e.g. "POST", "GET", "PUT"). A mime type to override the XHR mime type. @@ -108,10 +148,13 @@ $.ajax({ A password to be used with XMLHttpRequest in response to an HTTP access authentication request. - 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. + 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. @@ -129,19 +172,19 @@ $.ajax({ - + - A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter; a string describing the status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event. + A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter or the dataFilter callback function, if specified; a string describing the status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event. - Set a timeout (in milliseconds) for the request. This will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the $.ajax call is made; if several other requests are in progress and the browser has no connections available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be cancelled by a timeout; the script will run even if it arrives after the timeout period. + Set a timeout (in milliseconds) for the request. A value of 0 means there will be no timeout. This will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the $.ajax call is made; if several other requests are in progress and the browser has no connections available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be cancelled by a timeout; the script will run even if it arrives after the timeout period. Set this to true if you wish to use the traditional style of param serialization. - The type of request to make ("POST" or "GET"), default is "GET". Note: Other HTTP request methods, such as PUT and DELETE, can also be used here, but they are not supported by all browsers. + An alias for method. You should use type if you're using versions of jQuery prior to 1.9.0. A string containing the URL to which the request is sent. @@ -182,7 +225,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" );
   }
@@ -197,7 +240,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 ) {}); @@ -205,7 +248,7 @@ $.ajax({

  • - jqXHR.always(function( data|jqXHR, textStatus, jqXHR|errorThrown ) { }); + jqXHR.always(function( data|jqXHR, textStatus, jqXHR|errorThrown ) { }); (added in jQuery 1.6)

    An alternative construct to the complete callback option, the .always() method replaces the deprecated .complete() method.

    In response to a successful request, the function's arguments are the same as those of .done(): data, textStatus, and the jqXHR object. For failed requests the arguments are the same as those of .fail(): the jqXHR object, textStatus, and errorThrown. Refer to deferred.always() for implementation details.

  • @@ -216,7 +259,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,
@@ -245,25 +288,32 @@ jqxhr.always(function() {
       
  • readyState
  • +
  • + responseXML and/or responseText when the underlying request responded with xml and/or text, respectively +
  • status
  • - statusText + statusText (may be an empty string in HTTP/2) +
  • +
  • + abort( [ statusText ] ) +
  • +
  • + getAllResponseHeaders() as a string
  • -
  • responseXML and/or responseText when the underlying request responded with xml and/or text, respectively
  • -
  • setRequestHeader(name, value) which departs from the standard by replacing the old value with the new one rather than concatenating the new value to the old one
  • - getAllResponseHeaders() + getResponseHeader( name )
  • - getResponseHeader() + overrideMimeType( mimeType )
  • - statusCode() + setRequestHeader( name, value ) which departs from the standard by replacing the old value with the new one rather than concatenating the new value to the old one
  • - abort() + statusCode( callbacksByStatusCode )
  • No onreadystatechange mechanism is provided, however, since done, fail, always, and statusCode cover all conceivable requirements.

    @@ -281,20 +331,19 @@ jqxhr.always(function() {

    Data Types

    -

    The $.ajax() function relies on the server to provide information about the retrieved data. If the server reports the return data as XML, the result can be traversed using normal XML methods or jQuery's selectors. If another type is detected, such as HTML in the example above, the data is treated as text.

    -

    Different data handling can be achieved by using the dataType option. Besides plain xml, the dataType can be html, json, jsonp, script, or text.

    -

    The text and xml types return the data with no processing. The data is simply passed on to the success handler, either through the responseText or responseXML property of the jqXHR object, respectively.

    -

    Note: We must ensure that the MIME type reported by the web server matches our choice of dataType. In particular, XML must be declared by the server as text/xml or application/xml for consistent results.

    -

    If html is specified, any embedded JavaScript inside the retrieved data is executed before the HTML is returned as a string. Similarly, script will execute the JavaScript that is pulled back from the server, then return nothing.

    -

    The json type parses the fetched data file as a JavaScript object and returns the constructed object as the result data. To do so, it uses jQuery.parseJSON() when the browser supports it; otherwise it uses a Function constructor. Malformed JSON data will throw a parse error (see json.org for more information). JSON data is convenient for communicating structured data in a way that is concise and easy for JavaScript to parse. If the fetched data file exists on a remote server, specify the jsonp type instead.

    -

    The jsonp type appends a query string parameter of callback=? to the URL. The server should prepend the JSON data with the callback name to form a valid JSONP response. We can specify a parameter name other than callback with the jsonp option to $.ajax().

    -

    Note: JSONP is an extension of the JSON format, requiring some server-side code to detect and handle the query string parameter. More information about it can be found in the original post detailing its use.

    -

    When data is retrieved from remote servers (which is only possible using the script or jsonp data types), the error callbacks and global events will never be fired.

    +

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

    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.

    Advanced Options

    -

    The global option prevents handlers registered using .ajaxSend(), .ajaxError(), and similar methods from firing when this request would trigger them. This can be useful to, for example, suppress a loading indicator that was implemented with .ajaxSend() if the requests are frequent and brief. With cross-domain script and JSONP requests, the global option is automatically set to false. See the descriptions of these methods below for more details. See the descriptions of these methods below for more details.

    +

    The global option prevents handlers registered for the ajaxSend, ajaxError, and similar events from firing when this request would trigger them. This can be useful to, for example, suppress a loading indicator that was implemented with an ajaxSend handler if the requests are frequent and brief. With cross-domain script and JSONP requests, the global option is automatically set to false. See the descriptions of these methods below for more details.

    If the server performs HTTP authentication before providing a response, the user name and password pair can be sent via the username and password options.

    Ajax requests are time-limited, so errors can be caught and handled to provide a better user experience. Request timeouts are usually either left at their default or set as a global default using $.ajaxSetup() rather than being overridden for specific requests with the timeout option.

    By default, requests are always issued, but the browser may serve results out of its cache. To disallow use of the cached results, set cache to false. To cause the request to report failure if the asset has not been modified since the last request, set ifModified to true.

    @@ -306,7 +355,7 @@ jqxhr.always(function() {

    As of jQuery 1.5, jQuery's Ajax implementation includes prefilters, transports, and converters that allow you to extend Ajax with a great deal of flexibility.

    Using Converters

    -

    $.ajax() converters support mapping data types to other data types. If, however, you want to map a custom data type to a known type (e.g json), you must add a correspondance between the response Content-Type and the actual data type using the contents option:

    +

    $.ajax() converters support mapping data types to other data types. If, however, you want to map a custom data type to a known type (e.g json), you must add a correspondence between the response Content-Type and the actual data type using the contents option:

    
     $.ajaxSetup({
       contents: {
    @@ -320,7 +369,7 @@ $.ajaxSetup({
       }
     });
         
    -

    This extra object is necessary because the response Content-Types and data types never have a strict one-to-one correspondance (hence the regular expression).

    +

    This extra object is necessary because the response Content-Types and data types never have a strict one-to-one correspondence (hence the regular expression).

    To convert from a supported type (e.g text, json) to a custom data type and back again, use another pass-through converter:

    
     $.ajaxSetup({
    @@ -344,7 +393,7 @@ $.ajaxSetup({
         Save some data to the server and notify the user once it's complete.
         
    -    
    -    
    -  
    -  
    -    Returns false if the page is in Quirks Mode in Internet Explorer
    -    
    -    
    -  
    +  States if the current page, in the user's browser, is being rendered using the W3C CSS Box Model.
    +  
    +    
    +

    Note: This API has been removed in jQuery 3.0; check if .document.compatMode is equal to "CSS1Compat" instead. Or, even better - always specify a DOCTYPE and avoid using quirks mode which jQuery doesn't support.

    +
    +
    + diff --git a/entries/jQuery.browser.xml b/entries/jQuery.browser.xml index fe0f3add7..11686eaec 100644 --- a/entries/jQuery.browser.xml +++ b/entries/jQuery.browser.xml @@ -7,6 +7,9 @@ Contains flags for the useragent, read from navigator.userAgent. This property was removed in jQuery 1.9 and is available only through the jQuery.migrate plugin. Please try to use feature detection instead. +
    +

    Note: This API has been removed in jQuery 1.9; please rely on feature detection instead.

    +

    The $.browser property provides information about the web browser that is accessing the page, as reported by the browser itself. It contains flags for each of the four most prevalent browser classes (Internet Explorer, Mozilla, Webkit, and Opera) as well as version information.

    Available flags are:

      @@ -18,7 +21,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. @@ -48,6 +51,7 @@ $.browser.msie; + @@ -55,6 +59,9 @@ $.browser.msie; The version number of the rendering engine for the user's browser. This property was removed in jQuery 1.9 and is available only through the jQuery.migrate plugin. +
    +

    Note: This API has been removed in jQuery 1.9; please rely on feature detection instead.

    +

    Here are some typical results:

    • Internet Explorer: 6.0, 7.0, 8.0
    • diff --git a/entries/jQuery.cssHooks.xml b/entries/jQuery.cssHooks.xml index 8252bfa5d..ec36ccfe1 100644 --- a/entries/jQuery.cssHooks.xml +++ b/entries/jQuery.cssHooks.xml @@ -45,7 +45,7 @@ function styleSupport( prop ) { // Capitalize first character of the prop to test vendor prefix capProp = prop.charAt( 0 ).toUpperCase() + prop.slice( 1 ), - prefixes = [ "Moz", "Webkit", "O", "ms" ], + prefixes = [ "Moz", "Webkit", "ms" ], div = document.createElement( "div" ); if ( prop in div.style ) { @@ -89,7 +89,7 @@ if ( !$.cssHooks ) { function styleSupport( prop ) { var vendorProp, supportedProp, capProp = prop.charAt( 0 ).toUpperCase() + prop.slice( 1 ), - prefixes = [ "Moz", "Webkit", "O", "ms" ], + prefixes = [ "Moz", "Webkit", "ms" ], div = document.createElement( "div" ); if ( prop in div.style ) { @@ -163,7 +163,7 @@ if ( $.support.someCSSProp && $.support.someCSSProp !== "someCSSProp" ) })( jQuery );

    Special units

    -

    By default, jQuery adds a "px" unit to the values passed to the .css() method. This behavior can be prevented by adding the property to the jQuery.cssNumber object

    +

    By default, jQuery adds a "px" unit to the values passed to the .css() method. This behavior can be prevented by adding the property to the jQuery.cssNumber object

    
     $.cssNumber.someCSSProp = true;
         
    diff --git a/entries/jQuery.cssNumber.xml b/entries/jQuery.cssNumber.xml new file mode 100644 index 000000000..c49b3c785 --- /dev/null +++ b/entries/jQuery.cssNumber.xml @@ -0,0 +1,53 @@ + + + jQuery.cssNumber + + 1.4.3 + + An object containing all CSS properties that may be used without a unit. Prior to jQuery 4.0, the .css() method uses this object to see if it may append px to unitless values. + +
    +

    Note: This API has been removed in jQuery 4.0; please pass a string value with the desired units instead.

    +
    +

    You can think about jQuery.cssNumber as a list of all CSS properties you might use without a unit. Prior to jQuery 4.0, it was used by .css() to determine if it needs to add px to unitless values.

    +

    The keys of the jQuery.cssNumber object are camel-cased and the values are all set to true. If you want to prevent the .css() method from automatically adding the px unit for a specific CSS property and that property is not yet a key of the jQuery.cssNumber object, you can add such an extra property:

    +
    
    +if ( jQuery.cssNumber ) {
    +  jQuery.cssNumber.someCSSProp = true;
    +}
    +    
    +

    By default the object contains the following properties:

    +
      +
    • animationIterationCount (added in 1.12.0/2.2.0)
    • +
    • aspectRatio (added in 3.7.0)
    • +
    • borderImageSlice (added in 3.7.0)
    • +
    • columnCount (added in 1.9.0)
    • +
    • flexGrow (added in 1.11.1/2.1.1)
    • +
    • flexShrink (added in 1.11.1/2.1.1)
    • +
    • fontWeight (added in 1.4.3)
    • +
    • gridArea (added in 3.4.0)
    • +
    • gridColumn (added in 3.4.0)
    • +
    • gridColumnEnd (added in 3.4.0)
    • +
    • gridColumnStart (added in 3.4.0)
    • +
    • gridRow (added in 3.4.0)
    • +
    • gridRowEnd (added in 3.4.0)
    • +
    • gridRowStart (added in 3.4.0)
    • +
    • lineHeight (added in 1.4.3)
    • +
    • opacity (added in 1.4.3)
    • +
    • order (added in 1.10.2/2.0.3)
    • +
    • orphans (added in 1.6.0)
    • +
    • scale (added in 3.7.0)
    • +
    • widows (added in 1.6.0)
    • +
    • zIndex (added in 1.4.3)
    • +
    • zoom (added in 1.4.3)
    • +
    • fillOpacity (SVG-related, added in 1.6.2)
    • +
    • floodOpacity (SVG-related, added in 3.7.0)
    • +
    • stopOpacity (SVG-related, added in 3.7.0)
    • +
    • strokeMiterlimit (SVG-related, added in 3.7.0)
    • +
    • strokeOpacity (SVG-related, added in 3.7.0)
    • +
    +
    + + + +
    diff --git a/entries/jQuery.data.xml b/entries/jQuery.data.xml index dcfc68d74..5207c8b89 100644 --- a/entries/jQuery.data.xml +++ b/entries/jQuery.data.xml @@ -11,8 +11,8 @@ A string naming the piece of data to set. - - The new data value. + + The new data value; this can be any Javascript type except undefined. Store arbitrary data associated with the specified element. Returns the value that was set. @@ -23,8 +23,9 @@ jQuery.data( document.body, "foo", 52 ); jQuery.data( document.body, "bar", "test" );
    -

    Note: this method currently does not provide cross-platform support for setting data on XML documents, as Internet Explorer does not allow data to be attached via expando properties.

    + + Store then retrieve a value from the div element. diff --git a/entries/jQuery.escapeSelector.xml b/entries/jQuery.escapeSelector.xml new file mode 100644 index 000000000..9e9a91d1e --- /dev/null +++ b/entries/jQuery.escapeSelector.xml @@ -0,0 +1,29 @@ + + + jQuery.escapeSelector() + Escapes any character that has a special meaning in a CSS selector. + + 3.0 + + A string containing a selector expression to escape. + + + +

    This method is useful for situations where a class name or an ID contains characters that have a special meaning in CSS, such as the dot or the semicolon.

    +

    The method is essentially a shim for the CSS Working Group's CSS.escape() method. The main difference is that $.escapeSelector() can be reliably used in all of jQuery's supported browsers.

    +
    + + Escape an ID containing a hash. + + + + Select all the elements having a class name of .box inside a div. + + + + +
    diff --git a/entries/jQuery.extend.xml b/entries/jQuery.extend.xml index 594a1b755..472626153 100644 --- a/entries/jQuery.extend.xml +++ b/entries/jQuery.extend.xml @@ -4,9 +4,9 @@ 1.0 - An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument. + An object that will receive the new properties. - + An object containing additional properties to merge in. @@ -16,7 +16,7 @@ 1.1.4 - If true, the merge becomes recursive (aka. deep copy). + If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. The object to extend. It will receive the new properties. @@ -28,6 +28,12 @@ Additional objects containing properties to merge in. + + 1.0 + + An object to merge onto the jQuery namespace. + + Merge the contents of two or more objects together into the first object.

    When two or more object arguments are supplied to $.extend(), properties from all of the objects are added to the target object. Arguments that are null or undefined are ignored.

    @@ -35,10 +41,11 @@

    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.

    -

    For needs that fall outside of this behavior, write a custom extend method instead.

    +

    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.

    Merge two objects, modifying the first. @@ -56,17 +63,8 @@ var object2 = { // Merge object2 into object1 $.extend( object1, object2 ); -var printObj = typeof JSON !== "undefined" ? JSON.stringify : function( obj ) { - var arr = []; - $.each( obj, function( key, val ) { - var next = key + ": "; - next += $.isPlainObject( val ) ? printObj( val ) : val; - arr.push( next ); - }); - return "{ " + arr.join( ", " ) + " }"; -}; - -$( "#log" ).append( printObj( object1 ) ); +// Assuming JSON.stringify - not available in IE<8 +$( "#log" ).append( JSON.stringify( object1 ) ); ]]> defaults -- " + printObj( defaults ) + "

    " ); -$( "#log" ).append( "
    options -- " + printObj( options ) + "
    " ); -$( "#log" ).append( "
    settings -- " + printObj( settings ) + "
    " ); +// Assuming JSON.stringify - not available in IE<8 +$( "#log" ).append( "
    defaults -- " + JSON.stringify( defaults ) + "
    " ); +$( "#log" ).append( "
    options -- " + JSON.stringify( options ) + "
    " ); +$( "#log" ).append( "
    settings -- " + JSON.stringify( settings ) + "
    " ); ]]> @@ -35,4 +37,5 @@ $( "input" ).click(function() { + diff --git a/entries/jQuery.fx.off.xml b/entries/jQuery.fx.off.xml index ae9b32d34..8464f69f5 100644 --- a/entries/jQuery.fx.off.xml +++ b/entries/jQuery.fx.off.xml @@ -9,7 +9,7 @@

    When this property is set to true, all animation methods will immediately set elements to their final state when called, rather than displaying an effect. This may be desirable for a couple reasons:

    • jQuery is being used on a low-resource device.
    • -
    • Users are encountering accessibility problems with the animations (see the article Turn Off Animation for more information).
    • +
    • Users are encountering accessibility problems with the animations.

    Animations can be turned back on by setting the property to false.

    @@ -20,10 +20,10 @@ var toggleFx = function() { $.fx.off = !$.fx.off; }; toggleFx(); -$( "button" ).click( toggleFx ); -$( "input" ).click(function() { +$( "button" ).on( "click", toggleFx ); +$( "input" ).on( "click", function() { $( "div" ).toggle( "slow" ); -}); +} ); ]]>
    - Get the test.php page contents, which has been returned in json format (<?php echo json_encode( array( "name"=>"John","time"=>"2pm" ) ); ?>), and add it to the page. + Get the test.php page contents, which has been returned in json format (<?php echo json_encode( array( "name"=>"John","time"=>"2pm" ) ); ?>), and add it to the page. + + + Get another page on the same domain. Outputs to console both the data returned and the type of data returned. + + diff --git a/entries/jQuery.getJSON.xml b/entries/jQuery.getJSON.xml index 92adffa67..1449293d2 100644 --- a/entries/jQuery.getJSON.xml +++ b/entries/jQuery.getJSON.xml @@ -6,10 +6,15 @@ A string containing the URL to which the request is sent. - + + + A plain object or string that is sent to the server with the request. - + + + + A callback function that is executed if the request succeeds. @@ -51,12 +56,12 @@ $.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.

    The jqXHR Object

    -

    As of jQuery 1.5, all of jQuery's Ajax methods return a superset of the XMLHTTPRequest object. This jQuery XHR object, or "jqXHR," returned by $.getJSON() implements the Promise interface, giving it all the properties, methods, and behavior of a Promise (see Deferred object for more information). The jqXHR.done() (for success), jqXHR.fail() (for error), and jqXHR.always() (for completion, whether success or error) methods take a function argument that is called when the request terminates. For information about the arguments this function receives, see the jqXHR Object section of the $.ajax() documentation.

    +

    As of jQuery 1.5, all of jQuery's Ajax methods return a superset of the XMLHTTPRequest object. This jQuery XHR object, or "jqXHR," returned by $.getJSON() implements the Promise interface, giving it all the properties, methods, and behavior of a Promise (see Deferred object for more information). The jqXHR.done() (for success), jqXHR.fail() (for error), and jqXHR.always() (for completion, whether success or error; added in jQuery 1.6) methods take a function argument that is called when the request terminates. For information about the arguments this function receives, see the jqXHR Object section of the $.ajax() documentation.

    The Promise interface in jQuery 1.5 also allows jQuery's Ajax methods, including $.getJSON(), to chain multiple .done(), .always(), and .fail() callbacks on a single request, and even to assign these callbacks after the request may have completed. If the request is already complete, the callback is fired immediately.

    
     // Assign handlers immediately after making the request,
    @@ -77,12 +82,12 @@ var jqxhr = $.getJSON( "example.json", function() {
     // Perform other work here ...
     
     // Set another completion function for the request above
    -jqxhr.complete(function() {
    +jqxhr.always(function() {
       console.log( "second complete" );
     });
         

    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.

    @@ -90,7 +95,7 @@ jqxhr.complete(function() { Loads the four most recent pictures of Mount Rainier from the Flickr JSONP API.
    - Load the official jQuery Color Animation plugin dynamically and bind some color animations to occur once the new functionality is loaded. + Load the official jQuery Color Animation plugin dynamically and bind some color animations to occur once the new functionality is loaded. + + + Execute a script with a nonce value on a site with Content Security Policy enabled. + +

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

    @@ -22,5 +32,8 @@ $.getScript( "myplugin.js", function() { ]]>
    + + + diff --git a/entries/jQuery.htmlPrefilter.xml b/entries/jQuery.htmlPrefilter.xml new file mode 100644 index 000000000..753819039 --- /dev/null +++ b/entries/jQuery.htmlPrefilter.xml @@ -0,0 +1,17 @@ + + + jQuery.htmlPrefilter() + Modify and filter HTML strings passed through jQuery manipulation methods. + + 1.12-and-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. 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.inArray.xml b/entries/jQuery.inArray.xml index 16e43b609..e7a3ca80e 100644 --- a/entries/jQuery.inArray.xml +++ b/entries/jQuery.inArray.xml @@ -16,7 +16,9 @@ Search for a specified value within an array and return its index (or -1 if not found).

    The $.inArray() method is similar to JavaScript's native .indexOf() method in that it returns -1 when it doesn't find a match. If the first element within the array matches value, $.inArray() returns 0.

    -

    Because JavaScript treats 0 as loosely equal to false (i.e. 0 == false, but 0 !== false), if we're checking for the presence of value within array, we need to check if it's not equal to (or greater than) -1.

    +

    Because JavaScript treats 0 as loosely equal to false (i.e. 0 == false, but 0 !== false), to check for the presence of value within array, you need to check if it's not equal to (or greater than) -1.

    +

    The comparison between values is strict. The following will return -1 (not found) because a number is being searched in an array of strings:

    +
    $.inArray( 5 + 5, [ "8", "9", "10", 10 + "" ] );
    Report the index of some elements in the array. diff --git a/entries/jQuery.isArray.xml b/entries/jQuery.isArray.xml index 6f040c4ec..9891126ff 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 2ceed224f..5160f0a70 100644 --- a/entries/jQuery.isFunction.xml +++ b/entries/jQuery.isFunction.xml @@ -1,14 +1,17 @@ - + jQuery.isFunction() 1.2 - - Object to test whether or not it is a function. + + The value to be tested. - Determine if the argument passed is a Javascript function object. + 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".

    +

    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.

    @@ -57,4 +60,5 @@ true +
    diff --git a/entries/jQuery.isNumeric.xml b/entries/jQuery.isNumeric.xml index 80edc02dd..c4fe4a72d 100644 --- a/entries/jQuery.isNumeric.xml +++ b/entries/jQuery.isNumeric.xml @@ -1,36 +1,46 @@ - + jQuery.isNumeric() - Determines whether its argument is a number. + Determines whether its argument represents a JavaScript number. 1.7 - + The value to be tested. +
    +

    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.

    Sample return values of $.isNumeric with various inputs. +
    diff --git a/entries/jQuery.isWindow.xml b/entries/jQuery.isWindow.xml index 154535995..76a58f176 100644 --- a/entries/jQuery.isWindow.xml +++ b/entries/jQuery.isWindow.xml @@ -1,5 +1,5 @@ - + jQuery.isWindow() 1.4.3 @@ -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).

    @@ -22,4 +28,5 @@ Is 'window' a window? +
    diff --git a/entries/jQuery.map.xml b/entries/jQuery.map.xml index 8bb6a2793..2016df876 100644 --- a/entries/jQuery.map.xml +++ b/entries/jQuery.map.xml @@ -3,37 +3,38 @@ jQuery.map() 1.0 - - The Array to translate. + + The Array or an Array-like object to translate. - - The function to process each item against. The first argument to the function is the array item, the second argument is the index in array The function can return any value. Within the function, this refers to the global (window) object. + + + + + The function to process each item against. The first argument to the function is the array item, the second argument is the index in array The function can return any value. A returned array will be flattened into the resulting array. Within the function, this refers to the global (window) object. 1.6 - - - - The Array or Object to translate. + + The non-Array-like Object to translate. - - The function to process each item against. The first argument to the function is the value; the second argument is the index or key of the array or object property. The function can return any value to add to the array. A returned array will be flattened into the resulting array. Within the function, this refers to the global (window) object. + + + + + The function to process each item against. The first argument to the function is the value; the second argument is the key of the object property. The function can return any value to add to the array. A returned array will be flattened into the resulting array. Within the function, this refers to the global (window) object. Translate all items in an array or object to new array of items.

    If you wish to process a jQuery object — for example, $('div').map( callback ); — use .map() instead.

    -

    The $.map() method applies a function to each item in an array or object and maps the results into a new array. Prior to jQuery 1.6, $.map() supports traversing arrays only. As of jQuery 1.6 it also traverses objects.

    -

    Array-like objects — those with a .length property and a value on the .length - 1 index — must be converted to actual arrays before being passed to $.map(). The jQuery library provides $.makeArray() for such conversions.

    +

    The $.map() method applies a function to each item in an array or object and maps the results into a new array. Prior to jQuery 1.6, $.map() supports traversing arrays and array-like objects only. As of jQuery 1.6 it also traverses objects.

    +

    Array-like objects — those with a .length property and a value on the .length - 1 index — may be passed to $.map().

    
    -// The following object masquerades as an array.
    +// The following object is array-like.
     var fakeArray = { "length": 2, 0: "Addy", 1: "Subtracty" };
     
    -// Therefore, convert it to a real array
    -var realArray = $.makeArray( fakeArray )
    -
    -// Now it can be used reliably with $.map()
    +// It can be used reliably with $.map()
     $.map( realArray, function( val, i ) {
       // Do something
     });
    diff --git a/entries/jQuery.merge.xml b/entries/jQuery.merge.xml
    index ef43c7701..b122635e9 100644
    --- a/entries/jQuery.merge.xml
    +++ b/entries/jQuery.merge.xml
    @@ -4,15 +4,15 @@
       Merge the contents of two arrays together into the first array. 
       
         1.0
    -    
    -      The first array to merge, the elements of second added.
    +    
    +      The first array-like object to merge, the elements of second added.
         
    -    
    -      The second array to merge into the first, unaltered.
    +    
    +      The second array-like object to merge into the first, unaltered.
         
       
       
    -    

    The $.merge() operation forms an array that contains all elements from the two arrays. The orders of items in the arrays are preserved, with items from the second array appended. The $.merge() function is destructive. It alters the first parameter to add the items from the second.

    +

    The $.merge() operation forms an array that contains all elements from the two arrays. The orders of items in the arrays are preserved, with items from the second array appended. The $.merge() function is destructive. It alters the length and numeric index properties of the first object to include items from the second.

    If you need the original first array, make a copy of it before calling $.merge(). Fortunately, $.merge() itself can be used for this duplication:

    
     var newArray = $.merge([], oldArray);
    diff --git a/entries/jQuery.noConflict.xml b/entries/jQuery.noConflict.xml
    index 451ae4d13..b72d7de57 100644
    --- a/entries/jQuery.noConflict.xml
    +++ b/entries/jQuery.noConflict.xml
    @@ -92,7 +92,7 @@ jQuery( "div > p" ).hide();
     

    Before $.noConflict(true)

    - + ]]> +alert( obj.name === "John" ); +]]>
    + diff --git a/entries/jQuery.post.xml b/entries/jQuery.post.xml index e32e7e00f..e862071fa 100644 --- a/entries/jQuery.post.xml +++ b/entries/jQuery.post.xml @@ -11,14 +11,23 @@ A plain object or string that is sent to the server with the request. - - A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case. + + + + + A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null or jQuery.noop as a placeholder. NOTE: In jQuery 3.x and older, when providing a null value for success you also have to provide the data parameter; you can set it to undefined. The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). - Load data from the server using a HTTP POST request. + + 1.12-and-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. + + + Send data to the server using a HTTP POST request.

    This is a shorthand Ajax function, which is equivalent to:

    
    @@ -41,7 +50,7 @@ $.post( "ajax/test.html", function( data ) {
         

    This example fetches the requested HTML snippet and inserts it on the page.

    Pages fetched with POST are never cached, so the cache and ifModified options in jQuery.ajaxSetup() have no effect on these requests.

    The jqXHR Object

    -

    As of jQuery 1.5, all of jQuery's Ajax methods return a superset of the XMLHTTPRequest object. This jQuery XHR object, or "jqXHR," returned by $.get() implements the Promise interface, giving it all the properties, methods, and behavior of a Promise (see Deferred object for more information). The jqXHR.done() (for success), jqXHR.fail() (for error), and jqXHR.always() (for completion, whether success or error) methods take a function argument that is called when the request terminates. For information about the arguments this function receives, see the jqXHR Object section of the $.ajax() documentation.

    +

    As of jQuery 1.5, all of jQuery's Ajax methods return a superset of the XMLHTTPRequest object. This jQuery XHR object, or "jqXHR," returned by $.post() implements the Promise interface, giving it all the properties, methods, and behavior of a Promise (see Deferred object for more information). The jqXHR.done() (for success), jqXHR.fail() (for error), and jqXHR.always() (for completion, whether success or error; added in jQuery 1.6) methods take a function argument that is called when the request terminates. For information about the arguments this function receives, see the jqXHR Object section of the $.ajax() documentation.

    The Promise interface also allows jQuery's Ajax methods, including $.get(), to chain multiple .done(), .fail(), and .always() callbacks on a single request, and even to assign these callbacks after the request may have completed. If the request is already complete, the callback is fired immediately.

    
     // Assign handlers immediately after making the request,
    @@ -57,7 +66,7 @@ var jqxhr = $.post( "example.php", function() {
       })
       .always(function() {
         alert( "finished" );
    -});
    +  });
     
     // Perform other work here ...
     
    @@ -68,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.

    @@ -91,7 +100,7 @@ $.post( "test.php", { 'choices[]': [ "Jon", "Susan" ] } ); ]]>
    - Send form data using ajax requests + Send form data using Ajax requests @@ -123,10 +132,10 @@ $.post( "test.php", { func: "getNameAndTime" }, function( data ) { ]]>
    - Post a form using ajax and put results in a div + Post a form using Ajax and put results in a div - + 1.3 @@ -91,7 +91,7 @@ runIt(); A string containing the name of the queue. Defaults to fx, the standard effects queue. - + The new function to add to the queue. @@ -105,21 +105,21 @@ runIt(); Queue a custom function. + + jQuery.ready + A Promise-like object (or "thenable") that resolves when the document is ready. + + 1.8 + + +

    As of jQuery 3.0, use of this object is supported via jQuery.when or the native Promise.resolve(). Code should not make assumptions about whether this object is a jQuery.Deferred, native Promise, or some other type of promise object.

    +

    See also ready(), which makes use of this.

    +
    + + Listen for document ready using jQuery.when. + + + + Typical usage involving another promise, using jQuery.when. + + + + + + +
    diff --git a/entries/jQuery.readyException.xml b/entries/jQuery.readyException.xml new file mode 100644 index 000000000..2c534ea9f --- /dev/null +++ b/entries/jQuery.readyException.xml @@ -0,0 +1,24 @@ + + + jQuery.readyException() + Handles errors thrown synchronously in functions wrapped in jQuery(). + + 3.1 + + An error thrown in the function wrapped in jQuery(). + + + +

    This method is fired when an error is thrown synchronously in a function wrapped in jQuery() or jQuery( document ).ready(), or equivalent. By default it re-throws the error in a timeout so that it's logged in the console and passed to window.onerror instead of being swallowed. Overwrite this method if you want to handle such errors differently.

    +
    + + Pass the received error to console.error. + + + + +
    diff --git a/entries/jQuery.removeData.xml b/entries/jQuery.removeData.xml index 8a85933bf..6a92a25f4 100644 --- a/entries/jQuery.removeData.xml +++ b/entries/jQuery.removeData.xml @@ -1,5 +1,5 @@ - + jQuery.removeData() 1.2.3 @@ -19,13 +19,13 @@ Set a data store for 2 names then remove one of them. 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,14 +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( /test/ ) === "regexp"
    @@ -49,4 +54,5 @@ Is it a RegExp?
    +
    diff --git a/entries/jQuery.unique.xml b/entries/jQuery.unique.xml index 0546cfa7c..bac613345 100644 --- a/entries/jQuery.unique.xml +++ b/entries/jQuery.unique.xml @@ -1,5 +1,5 @@ - + jQuery.unique() 1.1.3 @@ -9,6 +9,9 @@ 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.

    @@ -20,10 +23,10 @@ var divs = $( "div" ).get(); // Add 3 elements of class dup too (they are divs) divs = divs.concat( $( ".dup" ).get() ); -$( "div:eq(1)" ).text( "Pre-unique there are " + divs.length + " elements." ); +$( "div" ).eq( 1 ).text( "Pre-unique there are " + divs.length + " elements." ); divs = jQuery.unique( divs ); -$( "div:eq(2)" ).text( "Post-unique there are " + divs.length + " elements." ) +$( "div" ).eq( 2 ).text( "Post-unique there are " + divs.length + " elements." ) .css( "color", "red" ); ]]> + + +
    + + + diff --git a/entries/jQuery.when.xml b/entries/jQuery.when.xml index 3a147ab2b..a27f2adc7 100644 --- a/entries/jQuery.when.xml +++ b/entries/jQuery.when.xml @@ -3,29 +3,67 @@ jQuery.when() 1.5 - - One or more Deferred objects, or plain JavaScript objects. + + Zero or more Thenable objects. + + + - Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events. + Provides a way to execute callback functions based on zero or more Thenable 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 and can be used this way:

    +

    If no arguments are passed to jQuery.when(), it will return a resolved Promise.

    +

    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:

    
     $.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 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:

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

    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, it is passed the resolved values of all the Deferreds that were passed to jQuery.when. For example, when the Deferreds are jQuery.ajax() requests, the arguments will be the jqXHR objects for the requests, in the order they were given in the argument list.

    -

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

    +

    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:

    +
    
    +var d1 = $.Deferred();
    +var d2 = $.Deferred();
    +
    +$.when( d1, d2 ).done(function ( v1, v2 ) {
    +    console.log( v1 ); // "Fish"
    +    console.log( v2 ); // "Pizza"
    +});
    +
    +d1.resolve( "Fish" );
    +d2.resolve( "Pizza" );
    +    
    +

    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:

    +
    
    +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 ]
    +});
    +
    +d1.resolve();
    +d2.resolve( "abc" );
    +d3.resolve( 1, 2, 3, 4, 5 );
    +    
    +

    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.

    - 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). + 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). ), or an empty string ("") is passed, the set contains no elements.

    Working With Plain Objects

    At present, the only operations supported on plain JavaScript objects wrapped in jQuery are: .data(),.prop(),.on(), .off(), .trigger() and .triggerHandler(). The use of .data() (or any method requiring .data()) on a plain object will result in a new property on the object called jQuery{randomNumber} (eg. jQuery123456789).

    
    @@ -155,7 +156,7 @@ $( myForm.elements ).hide();
           
             A string of HTML to create on the fly. Note that this parses HTML, not XML.
           
    -      
    +      
             A document in which the new elements will be created.
           
         
    @@ -174,25 +175,25 @@ $( myForm.elements ).hide();
           

    If a string is passed as the parameter to $(), jQuery examines the string to see if it looks like HTML (i.e., it starts with <tag ... >). If not, the string is interpreted as a selector expression, as explained above. But if the string appears to be an HTML snippet, jQuery attempts to create new DOM elements as described by the HTML. Then a jQuery object is created and returned that refers to these elements. You can perform any of the usual jQuery methods on this object:

    $( "<p id='test'>My <em>new</em> text</p>" ).appendTo( "body" );

    For explicit parsing of a string to HTML, use the $.parseHTML() method.

    -

    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.

    +

    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.

    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>" );
    +$( "<img />" );
     $( "<input>" );
           
    -

    When passing HTML to jQuery(), please also note that text nodes are not treated as DOM elements. With the exception of a few methods (such as .content()), they are generally otherwise ignored or removed. E.g:

    +

    When passing HTML to jQuery(), note that text nodes are not treated as DOM elements. With the exception of a few methods (such as .content()), they are generally ignored or removed. E.g:

    
    -var el = $( "1<br>2<br>3" ); // returns [<br>, "2", <br>]
    -el = $( "1<br>2<br>3 >" ); // returns [<br>, "2", <br>, "3 &gt;"]
    +var el = $( "<br>2<br>3" ); // returns [<br>, "2", <br>]
    +el = $( "<br>2<br>3 >" ); // returns [<br>, "2", <br>, "3 &gt;"]
           
    -

    This behavior is expected.

    -

    As of jQuery 1.4, the second argument to jQuery() can accept a plain object consisting of a superset of the properties that can be passed to the .attr() method.

    -

    Important: If the second argument is passed, the HTML string in the first argument must represent a a simple element with no attributes. As of jQuery 1.4, any event type can be passed in, and the following jQuery methods can be called: val, css, html, text, data, width, height, or offset.

    +

    This behavior is expected. As of jQuery 1.9.0 (and unless using the jQuery Migrate plugin), jQuery() requires the HTML string to start with a < (i.e text nodes cannot appear at the front of the HTML string).

    +

    As of jQuery 1.4, the second argument to jQuery() can accept a plain object consisting of a superset of the properties that can be passed to the .attr() method.

    +

    Important: If the second argument is passed, the HTML string in the first argument must represent a simple element with no attributes. As of jQuery 1.4, any event type can be passed in, and the following jQuery methods can be called: val, css, html, text, data, width, height, or offset.

    As of jQuery 1.8, any jQuery instance method (a method of jQuery.fn) can be used as a property of the object passed to the second parameter:

    
     $( "
    ", { @@ -249,7 +250,7 @@ $( "
    ", { Binds a function to be executed when the DOM has finished loading. -

    This function behaves just like $( document ).ready(), in that it should be used to wrap other $() operations on your page that depend on the DOM being ready. While this function is, technically, chainable, there really isn"t much use for chaining against it.

    +

    This function behaves just like $( document ).ready(), in that it should be used to wrap other $() operations on your page that depend on the DOM being ready. While this function is, technically, chainable, there really isn't much use for chaining against it.

    Execute the function when the DOM is ready to be used. diff --git a/entries/keydown-shorthand.xml b/entries/keydown-shorthand.xml new file mode 100644 index 000000000..98b125b34 --- /dev/null +++ b/entries/keydown-shorthand.xml @@ -0,0 +1,36 @@ + + + .keydown() + Bind an event handler to the "keydown" event, or trigger that event on an element. + + 1.0 + + A function to execute each time the event is triggered. + + + + + 1.4.3 + + An object containing data that will be passed to the event handler. + + + A function to execute each time the event is triggered. + + + + + 1.0 + + +
    +

    This API is deprecated.

    +

    Instead of .keydown( handler ) or .keydown( eventData, handler ), use .on( "keydown", handler ) or .on( "keydown", eventData, handler ), respectively.

    +

    Instead of .keydown(), use .trigger( "keydown" ).

    +
    +
    + + + + +
    diff --git a/entries/keydown.xml b/entries/keydown.xml index b72e0ad75..576a1ad0c 100644 --- a/entries/keydown.xml +++ b/entries/keydown.xml @@ -1,28 +1,28 @@ - - .keydown() + +Bind an event handler to the "keydown" event, or trigger that event on an element. + + + keydown event + Bind an event handler to the "keydown" event. - 1.0 - - A function to execute each time the event is triggered. + 1.7 + + The string "keydown". - - - 1.4.3 - + An object containing data that will be passed to the event handler. - + A function to execute each time the event is triggered. + - - 1.0 - - Bind an event handler to the "keydown" JavaScript event, or trigger that event on an element. -

    This method is a shortcut for .on( "keydown", handler ) in the first and second variations, and .trigger( "keydown" ) in the third.

    -

    The keydown event is sent to an element when the user first presses a key on the keyboard. It can be attached to any element, but the event is only sent to the element that has the focus. Focusable elements can vary between browsers, but form elements can always get focus so are reasonable candidates for this event type.

    +
    +

    This page describes the keydown event. For the deprecated .keydown() method, see .keydown().

    +
    +

    The keydown event is sent to an element when the user presses a key on the keyboard. If the key is kept pressed, the event is sent every time the operating system repeats the key. It can be attached to any element, but the event is only sent to the element that has the focus. Focusable elements can vary between browsers, but form elements can always get focus so are reasonable candidates for this event type.

    For example, consider the HTML:

    
     <form>
    @@ -34,19 +34,19 @@
         

    The event handler can be bound to the input field:

    
    -$( "#target" ).keydown(function() {
    -  alert( "Handler for .keydown() called." );
    -});
    +$( "#target" ).on( "keydown", function() {
    +  alert( "Handler for `keydown` called." );
    +} );
         

    Now when the insertion point is inside the field, pressing a key displays the alert:

    - Handler for .keydown() called. + Handler for `keydown` called.

    -

    To trigger the event manually, apply .keydown() without an argument:

    +

    To trigger the event manually, use .trigger( "keydown" ):

    
    -$( "#other" ).click(function() {
    -  $( "#target" ).keydown();
    -});
    +$( "#other" ).on( "click", function() {
    +  $( "#target" ).trigger( "keydown" );
    +} );
         

    After this code executes, clicks on Trigger the handler will also alert the message.

    If key presses anywhere need to be caught (for example, to implement global shortcut keys on a page), it is useful to attach this behavior to the document object. Because of event bubbling, all key presses will make their way up the DOM to the document object unless explicitly stopped.

    @@ -56,19 +56,19 @@ $( "#other" ).click(function() { Show the event object for the keydown handler when a key is pressed in the input.
    - + + + + keypress event + Trigger the "keypress" event on an element. + + 1.0 + + The string "keypress". + + + +

    See the description for .on( "keypress", ... ).

    +
    + + +
    + + diff --git a/entries/keyup-shorthand.xml b/entries/keyup-shorthand.xml new file mode 100644 index 000000000..965dbeb84 --- /dev/null +++ b/entries/keyup-shorthand.xml @@ -0,0 +1,36 @@ + + + .keyup() + Bind an event handler to the "keyup" event, or trigger that event on an element. + + 1.0 + + A function to execute each time the event is triggered. + + + + + 1.4.3 + + An object containing data that will be passed to the event handler. + + + A function to execute each time the event is triggered. + + + + + 1.0 + + +
    +

    This API is deprecated.

    +

    Instead of .keyup( handler ) or .keyup( eventData, handler ), use .on( "keyup", handler ) or .on( "keyup", eventData, handler ), respectively.

    +

    Instead of .keyup(), use .trigger( "keyup" ).

    +
    +
    + + + + +
    diff --git a/entries/keyup.xml b/entries/keyup.xml index f65c6a03f..b0d6399f4 100644 --- a/entries/keyup.xml +++ b/entries/keyup.xml @@ -1,27 +1,27 @@ - - .keyup() - Bind an event handler to the "keyup" JavaScript event, or trigger that event on an element. + +Bind an event handler to the "keyup" event, or trigger that event on an element. + + + keyup event + Bind an event handler to the "keyup" event. - 1.0 - - A function to execute each time the event is triggered. + 1.7 + + The string "keyup". - - - 1.4.3 - + An object containing data that will be passed to the event handler. - + A function to execute each time the event is triggered. + - - 1.0 - -

    This method is a shortcut for .on( "keyup", handler ) in the first two variations, and .trigger( "keyup" ) in the third.

    +
    +

    This page describes the keyup event. For the deprecated .keyup() method, see .keyup().

    +

    The keyup event is sent to an element when the user releases a key on the keyboard. It can be attached to any element, but the event is only sent to the element that has the focus. Focusable elements can vary between browsers, but form elements can always get focus so are reasonable candidates for this event type.

    For example, consider the HTML:

    
    @@ -34,19 +34,19 @@
         

    The event handler can be bound to the input field:

    
    -$( "#target" ).keyup(function() {
    -  alert( "Handler for .keyup() called." );
    -});
    +$( "#target" ).on( "keyup", function() {
    +  alert( "Handler for `keyup` called." );
    +} );
         

    Now when the insertion point is inside the field and a key is pressed and released, the alert is displayed:

    - Handler for .keyup() called. + Handler for `keyup` called.

    -

    To trigger the event manually, apply .keyup() without arguments:

    +

    To trigger the event manually, use .trigger( "keyup" ):

    
    -$( "#other" ).click(function() {
    -  $( "#target" ).keyup();
    -});
    +$( "#other" ).on( "click", function() {
    +  $( "#target" ).trigger( "keyup" );
    +} );
         

    After this code executes, clicks on Trigger the handler will also alert the message.

    If key presses anywhere need to be caught (for example, to implement global shortcut keys on a page), it is useful to attach this behavior to the document object. Because of event bubbling, all key presses will make their way up the DOM to the document object unless explicitly stopped.

    @@ -56,20 +56,20 @@ $( "#other" ).click(function() { Show the event object for the keyup handler (using a simple $.print plugin) when a key is released in the input.
    diff --git a/entries/length.xml b/entries/length.xml index 105f23d84..37a2d54cf 100644 --- a/entries/length.xml +++ b/entries/length.xml @@ -12,12 +12,12 @@ Count the divs. Click to add more. diff --git a/entries/live.xml b/entries/live.xml index 314735641..0943af956 100644 --- a/entries/live.xml +++ b/entries/live.xml @@ -7,8 +7,9 @@ A string containing a JavaScript event type, such as "click" or "keydown." As of jQuery 1.4 the string can contain multiple, space-separated event types or custom event names. - + A function to execute at the time the event is triggered. + @@ -16,11 +17,12 @@ A string containing a JavaScript event type, such as "click" or "keydown." As of jQuery 1.4 the string can contain multiple, space-separated event types or custom event names. - + An object containing data that will be passed to the event handler. - + A function to execute at the time the event is triggered. + @@ -30,8 +32,10 @@ -

    As of jQuery 1.7, the .live() method is deprecated. Use .on() to attach event handlers. Users of older versions of jQuery should use .delegate() in preference to .live().

    -

    This method provides a means to attach delegated event handlers to the document element of a page, which simplifies the use of event handlers when content is dynamically added to a page. See the discussion of direct versus delegated events in the .on() method for more information.

    +
    +

    Note: This API has been removed in jQuery 1.9; please use on() instead.

    +
    +

    This method provides a means to attach delegated event handlers to the document element of a page, which simplifies the use of event handlers when content is dynamically added to a page. See the discussion of direct versus delegated events in the .on() method for more information.

    Rewriting the .live() method in terms of its successors is straightforward; these are templates for equivalent calls for all three event attachment methods:

    
     $( selector ).live( events, data, handler );                // jQuery 1.3+
    @@ -100,7 +104,7 @@ $( "p" ).live( "myCustomEvent", function( event, myName, myValue ) {
         .fadeIn( 30 )
         .fadeOut( 1000 );
       });
    -$( "button" ).click(function() {
    +$( "button" ).on( "click", function() {
       $( "p" ).trigger( "myCustomEvent" );
     });
     ]]>
    diff --git a/entries/load-event.xml b/entries/load-event.xml
    index 16ab3180e..f7dbc65a7 100644
    --- a/entries/load-event.xml
    +++ b/entries/load-event.xml
    @@ -1,24 +1,27 @@
     
    -
    -  .load()
    -  Bind an event handler to the "load" JavaScript event.
    +
    +Bind an event handler to the "load" event, or trigger that event on an element.
    +
    +
    +  load event
    +  Bind an event handler to the "load" event.
       
    -    1.0
    -    
    -      A function to execute when the event is triggered.
    +    1.7
    +    
    +      The string "load".
         
    -  
    -  
    -    1.4.3
    -    
    +    
           An object containing data that will be passed to the event handler.
         
    -    
    +    
           A function to execute each time the event is triggered.
    +      
         
       
       
    -    

    This method is a shortcut for .on( "load", handler ).

    +
    +

    This page describes the load event. For the .load() method removed in jQuery 3.0, see .load().

    +

    The load event is sent to an element when it and all sub-elements have been completely loaded. This event can be sent to any element associated with a URL: images, scripts, frames, iframes, and the window object.

    For example, consider a page with a simple image:

    
    @@ -26,20 +29,17 @@
         

    The event handler can be bound to the image:

    
    -$( "#book" ).load(function() {
    -  // Handler for .load() called.
    -});
    +$( "#book" ).on( "load", function() {
    +  // Handler for `load` called.
    +} );
         

    As soon as the image has been loaded, the handler is called.

    In general, it is not necessary to wait for all images to be fully loaded. If code can be executed earlier, it is usually best to place it in a handler sent to the .ready() method.

    -
    -

    The Ajax module also has a method named .load(). Which one is fired depends on the set of arguments passed.

    -

    Caveats of the load event when used with images -

    A common challenge developers attempt to solve using the .load() shortcut is to execute a function when an image (or collection of images) have completely loaded. There are several known caveats with this that should be noted. These are:

    +

    A common challenge developers attempt to solve using the load shortcut is to execute a function when an image (or collection of images) have completely loaded. There are several known caveats with this that should be noted. These are:

    • It doesn't work consistently nor reliably cross-browser
    • It doesn't fire correctly in WebKit if the image src is set to the same src as before
    • @@ -55,23 +55,40 @@ $( "#book" ).load(function() { Run a function when the page is fully loaded including graphics. - Add the class bigImg to all images with height greater then 100 upon each image load. + Add the class bigImg to all images with height greater than 100 upon each image load. - - + + + + + load event + Trigger the "load" event on an element. + + 1.0 + + The string "load". + + + +

      See the description for .on( "load", ... ).

      +
      + +
      + + diff --git a/entries/load-shorthand.xml b/entries/load-shorthand.xml new file mode 100644 index 000000000..1c5873cb0 --- /dev/null +++ b/entries/load-shorthand.xml @@ -0,0 +1,40 @@ + + + .load() + Bind an event handler to the "load" event, or trigger that event on an element. + + 1.0 + + A function to execute each time the event is triggered. + + + + + 1.4.3 + + An object containing data that will be passed to the event handler. + + + A function to execute each time the event is triggered. + + + + + 1.0 + + +
      +

      This API has been removed in jQuery 3.0.

      +

      Instead of .load( handler ) or .load( eventData, handler ), use .on( "load", handler ) or .on( "load", eventData, handler ), respectively.

      +

      Instead of .load(), use .trigger( "load" ).

      +
      +
      +

      The Ajax module also has a method named .load(). Which one is fired depends on the set of arguments passed.

      +
      +
      + + + + + +
      diff --git a/entries/load.xml b/entries/load.xml index 7389800c3..c0f6a46fc 100644 --- a/entries/load.xml +++ b/entries/load.xml @@ -11,16 +11,19 @@ A plain object or string that is sent to the server with the request. - + + + + 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: The event handling suite also has a method named .load(). jQuery determines which method to fire based on the set of arguments passed to it.

      +

      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" );
           
      @@ -56,9 +59,9 @@ $( "#b" ).load( "article.html #target" );
      - Load the main page's footer navigation into an ordered list. + Load another page's list items into an ordered list. diff --git a/entries/lt-selector.xml b/entries/lt-selector.xml index d301f11dc..703c427f1 100644 --- a/entries/lt-selector.xml +++ b/entries/lt-selector.xml @@ -1,5 +1,5 @@ - + :lt() Selector :lt(index) @@ -11,12 +11,15 @@ :lt(-index) 1.8 - + Zero-based index, counting backwards from the last element. 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 ).

      +

      index-related selectors

      @@ -42,4 +45,5 @@ $( "td:lt(-2)" ).css( "color", "red" ); +
      diff --git a/entries/map.xml b/entries/map.xml index 6fbe68d70..101fa001b 100644 --- a/entries/map.xml +++ b/entries/map.xml @@ -3,7 +3,10 @@ .map() 1.2 - + + + + A function object that will be invoked for each element in the current set. @@ -66,7 +69,7 @@ $( "p" )
      - +
      ]]>
      @@ -132,9 +135,9 @@ $.fn.equalizeHeights = function() { return this.height( Math.max.apply( this, maxHeight ) ); }; -$( "input" ).click(function() { +$( "input" ).on( "click", function() { $( "div" ).equalizeHeights(); -}); +} ); ]]> 300 - 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/nth-last-child-selector.xml b/entries/nth-last-child-selector.xml index ce21de1fc..def39a3bd 100644 --- a/entries/nth-last-child-selector.xml +++ b/entries/nth-last-child-selector.xml @@ -10,8 +10,8 @@ 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.

      +

      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 .first() or .eq() 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.

      Find the second to last li in each matched ul and note it. @@ -51,7 +51,7 @@ $( "ul li:nth-last-child(2)" ).append( " - 2nd to last!" ); This is a playground to see how the selector works with different strings. + + + + + + diff --git a/entries/off.xml b/entries/off.xml index 78ab983bd..fba3925c0 100644 --- a/entries/off.xml +++ b/entries/off.xml @@ -10,8 +10,9 @@ A selector which should match the one originally passed to .on() when attaching event handlers. - + A handler function previously attached for the event(s), or the special value false. + @@ -23,6 +24,12 @@ A selector which should match the one originally passed to .on() when attaching event handlers. + + 1.7 + + A jQuery.Event object. + + 1.7 @@ -39,13 +46,13 @@ function flash() { $( "div" ).show().fadeOut( "slow" ); } -$( "#bind" ).click(function() { +$( "#bind" ).on( "click", function() { $( "body" ) .on( "click", "#theone", flash ) .find( "#theone" ) .text( "Can Click!" ); }); -$( "#unbind" ).click(function() { +$( "#unbind" ).on( "click", function() { $( "body" ) .off( "click", "#theone", flash ) .find( "#theone" ) diff --git a/entries/offset.xml b/entries/offset.xml index 02e410160..819232879 100644 --- a/entries/offset.xml +++ b/entries/offset.xml @@ -8,17 +8,18 @@ Get the current coordinates of the first element in the set of matched elements, relative to the document. -

      The .offset() method allows us to retrieve the current position of an element relative to the document. Contrast this with .position(), which retrieves the current position relative to the offset parent. When positioning a new element on top of an existing one for global manipulation (in particular, for implementing drag-and-drop), .offset() is more useful.

      +

      The .offset() method allows us to retrieve the current position of an element (specifically its border box, which excludes margins) relative to the document. Contrast this with .position(), which retrieves the current position relative to the offset parent. When positioning a new element on top of an existing one for global manipulation (in particular, for implementing drag-and-drop), .offset() is more useful.

      .offset() returns an object containing the properties top and left.

      -

      Note: jQuery does not support getting the offset coordinates of hidden elements or accounting for borders, margins, or padding set on the body element.

      +

      Note: jQuery does not support getting the offset coordinates of hidden elements or accounting for margins set on the <html> document element.

      While it is possible to get the coordinates of elements with visibility:hidden set, display:none is excluded from the rendering tree and thus has a position that is undefined.

      - + + Access the offset of the second paragraph: @@ -34,7 +35,7 @@ p.html( "left: " + offset.left + ", top: " + offset.top ); Click to see the offset.
      - Cancel only the default action by using .preventDefault(). + Cancel only the default action by using .preventDefault(). - Stop submit events from bubbling without preventing form submit, using .stopPropagation(). + Stop submit events from bubbling without preventing form submit, using .stopPropagation(). + + + Pass data to the event handler using the second argument to .trigger() + + + + Use the second argument of .trigger() to pass an array of data to the event handler + @@ -195,7 +230,7 @@ $( "div.test" ).on({ ]]> - Click any paragraph to add another after it. Note that .on() allows a click event on any paragraph--even new ones--since the event is handled by the ever-present body element after it bubbles to there. + Click any paragraph to add another after it. Note that .on() allows a click event on any paragraph--even new ones--since the event is handled by the ever-present body element after it bubbles to there. - Cancel a link's default action using the preventDefault method. + Cancel a link's default action using the .preventDefault() method: + + + Attach multiple events—one on mouseenter and one on mouseleave to the same element: + diff --git a/entries/one.xml b/entries/one.xml index 8f55d4aa4..4b98e5f91 100644 --- a/entries/one.xml +++ b/entries/one.xml @@ -8,10 +8,11 @@ A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names. - An object containing data that will be passed to the event handler. + Data to be passed to the handler in event.data when an event is triggered. - + A function to execute at the time the event is triggered. + @@ -25,8 +26,9 @@ Data to be passed to the handler in event.data when an event is triggered. - + A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + @@ -42,13 +44,10 @@ -

      The first form of this method is identical to .bind(), except that the handler is unbound after its first invocation. The second two forms, introduced in jQuery 1.7, are identical to .on() except that the handler is removed after the first time the event occurs at the delegated element, whether the selector matched anything or not. For example:

      +

      The .one() method is identical to .on(), except that the handler for a given element and event type is unbound after its first invocation. For example:

      
       $( "#foo" ).one( "click", function() {
         alert( "This will be displayed only once." );
      -});
      -$( "body" ).one( "click", "#foo", function() {
      -  alert( "This displays if #foo is the first thing clicked in the body." );
       });
           

      After the code is executed, a click on the element with ID foo will display the alert. Subsequent clicks will do nothing. This code is equivalent to:

      @@ -60,6 +59,12 @@ $( "#foo" ).on( "click", function( event ) {

    In other words, explicitly calling .off() from within a regularly-bound handler has exactly the same effect.

    If the first argument contains more than one space-separated event types, the event handler is called once for each event type.

    +
    
    +$( "#foo" ).one( "click mouseover", function( event ) {
    +  alert( "The " + event.type + " event happened!" );
    +});
    +    
    +

    In the example above the alert could be displayed twice due to the two event types (click and mouseover).

    Tie a one-time click to each div. diff --git a/entries/outerHeight.xml b/entries/outerHeight.xml index 678166724..dc53bcb38 100644 --- a/entries/outerHeight.xml +++ b/entries/outerHeight.xml @@ -1,25 +1,30 @@ - + + Get the current computed outer height (including padding, border, and optionally margin) for the first element in the set of matched elements or set the outer height of every matched element. + .outerHeight() 1.2.6 - + A Boolean indicating whether to include the element's margin in the calculation. - Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns an integer (without "px") representation of the value or null if called on an empty set of elements. + Get the current computed outer height (including padding, border, and optionally margin) for the first element in the set of matched elements. -

    The top and bottom padding and border are always included in the .outerHeight() calculation; if the includeMargin argument is set to true, the margin (top and bottom) is also included.

    -

    This method is not applicable to window and document objects; for these, use .height() instead.

    -

    +

    Returns the height of the element, including top and bottom padding, border, and optionally margin, in pixels. If called on an empty set of elements, returns undefined (null before jQuery 3.0).

    +

    This method is not applicable to window and document objects; for these, use .height() instead. Although .outerHeight() can be used on table elements, it may give unexpected results on tables using the border-collapse: collapse CSS property.

    +
    -

    +
    Figure 1 - Illustration of the measured height
    +
    + + Get the outerHeight of a paragraph. @@ -39,3 +44,72 @@ $( "p:last" ).text(
    + + + + 1.8 + + + + A number representing the number of pixels, or a number along with an optional unit of measure appended (as a string). + + + A Boolean indicating whether to new value should account for the element's margin. + + + + 1.8 + + + + + + + + A function returning the outer height to set. Receives the index position of the element in the set and the old outer height as arguments. Within the function, this refers to the current element in the set. + + + Set the CSS outer height of each element in the set of matched elements. + +

    When calling .outerHeight(value), the value can be either a string (number and unit) or a number. If only a number is provided for the value, jQuery assumes a pixel unit. If a string is provided, however, any valid CSS measurement may be used (such as 100px, 50%, or auto).

    +
    + + + Change the outer height of each div the first time it is clicked (and change its color). + + + + + + + + + +
    +
    diff --git a/entries/outerWidth.xml b/entries/outerWidth.xml index 881e66ced..2c5856bea 100644 --- a/entries/outerWidth.xml +++ b/entries/outerWidth.xml @@ -1,26 +1,30 @@ - + + Get the current computed outer width (including padding, border, and optionally margin) for the first element in the set of matched elements or set the outer width of every matched element. + .outerWidth() 1.2.6 - + A Boolean indicating whether to include the element's margin in the calculation. - Get the current computed width for the first element in the set of matched elements, including padding and border. + Get the current computed outer width (including padding, border, and optionally margin) for the first element in the set of matched elements. -

    Returns the width of the element, along with left and right padding, border, and optionally margin, in pixels.

    -

    If includeMargin is omitted or false, the padding and border are included in the calculation; if true, the margin is also included.

    +

    Returns the width of the element, including left and right padding, border, and optionally margin, in pixels. If called on an empty set of elements, returns undefined (null before jQuery 3.0).

    This method is not applicable to window and document objects; for these, use .width() instead. Although .outerWidth() can be used on table elements, it may give unexpected results on tables using the border-collapse: collapse CSS property.

    -

    +

    -

    +
    Figure 1 - Illustration of the measured width
    +
    + + Get the outerWidth of a paragraph. @@ -40,3 +44,72 @@ $( "p:last" ).text(
    + + + + 1.8 + + + + A number representing the number of pixels, or a number along with an optional unit of measure appended (as a string). + + + A Boolean indicating whether to new value should account for the element's margin. + + + + 1.8 + + + + + + + + A function returning the outer width to set. Receives the index position of the element in the set and the old outer width as arguments. Within the function, this refers to the current element in the set. + + + Set the CSS outer width of each element in the set of matched elements. + +

    When calling .outerWidth(value), the value can be either a string (number and unit) or a number. If only a number is provided for the value, jQuery assumes a pixel unit. If a string is provided, however, any valid CSS measurement may be used (such as 100px, 50%, or auto).

    +
    + + + Change the outer width of each div the first time it is clicked (and change its color). + + + + + + + + + +
    +
    diff --git a/entries/parent-selector.xml b/entries/parent-selector.xml index 424cd36ea..bd3fd7436 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/entries/parent.xml b/entries/parent.xml index 0fdf5b73c..4c375255d 100644 --- a/entries/parent.xml +++ b/entries/parent.xml @@ -9,8 +9,8 @@ Get the parent of each element in the current set of matched elements, optionally filtered by a selector. -

    Given a jQuery object that represents a set of DOM elements, the .parent() method allows us to search through the parents of these elements in the DOM tree and construct a new jQuery object from the matching elements.

    -

    The .parents() and .parent() methods are similar, except that the latter only travels a single level up the DOM tree. Also, $( "html" ).parent() method returns a set containing document whereas $( "html" ).parents() returns an empty set.

    +

    Given a jQuery object that represents a set of DOM elements, the parent() method traverses to the immediate parent of each of these elements in the DOM tree and constructs a new jQuery object from the matching elements.

    +

    This method is similar to .parents(), except .parent() only travels a single level up the DOM tree. Also, $( "html" ).parent() method returns a set containing document whereas $( "html" ).parents() returns an empty set.

    The method optionally accepts a selector expression of the same type that we can pass to the $() function. If the selector is supplied, the elements will be filtered by testing whether they match it.

    Consider a page with a basic nested list on it:

    
    diff --git a/entries/parents.xml b/entries/parents.xml
    index 403b23936..ab51cde99 100644
    --- a/entries/parents.xml
    +++ b/entries/parents.xml
    @@ -82,7 +82,7 @@ function showParents() {
           .length;
       $( "b" ).text( "Unique div parents: " + len );
     }
    -$( "span" ).click(function() {
    +$( "span" ).on( "click", function() {
       $( this ).toggleClass( "selected" );
       showParents();
     });
    diff --git a/entries/parentsUntil.xml b/entries/parentsUntil.xml
    index b2aa8eb7e..93e5e1fa5 100644
    --- a/entries/parentsUntil.xml
    +++ b/entries/parentsUntil.xml
    @@ -12,7 +12,9 @@
       
       
         1.6
    -    
    +    
    +      
    +      
           A DOM node or jQuery object indicating where to stop matching ancestor elements.
         
         
    diff --git a/entries/password-selector.xml b/entries/password-selector.xml
    index 8d632b8f6..053e0dc29 100644
    --- a/entries/password-selector.xml
    +++ b/entries/password-selector.xml
    @@ -13,18 +13,18 @@
       
         Finds all password inputs.
         
         
         

    Since .prepend() can accept any number of additional arguments, the same result can be achieved by passing in the three <div>s as three separate arguments, like so: $( "body" ).prepend( $newdiv1, newdiv2, existingdiv1 ). The type and number of arguments will largely depend on how you collect the elements in your code.

    + + Prepends some HTML to all paragraphs. + + + Locate all the divs preceding the last item and wrap them with a div with class wrapper - with or without .uniqueSort(). + + + diff --git a/entries/prevUntil.xml b/entries/prevUntil.xml index 14c468ca2..5e6effb01 100644 --- a/entries/prevUntil.xml +++ b/entries/prevUntil.xml @@ -12,7 +12,9 @@ 1.6 - + + + A DOM node or jQuery object indicating where to stop matching preceding sibling elements. diff --git a/entries/prop.xml b/entries/prop.xml index 541f788fc..5506d40b9 100644 --- a/entries/prop.xml +++ b/entries/prop.xml @@ -2,8 +2,7 @@ Get the value of a property for the first element in the set of matched elements or set one or more properties for every matched element. - - + .prop() 1.6 @@ -43,17 +42,10 @@ $( elem ).attr( "checked" ) - (1.6) + (1.6+) "checked" (String) Initial state of the checkbox; does not change - - - $( elem ).attr( "checked" ) - (1.6.1+) - - "checked" (String) Will change with checkbox state - $( elem ).attr( "checked" ) @@ -63,7 +55,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:

    • @@ -82,13 +74,13 @@ Display the checked property and attribute of a checkbox as it changes. " ) .parent() - .css({ + .css( { background: "yellow", border: "3px red solid" - }); + } ); $( "div" ) .text( "For this type jQuery found " + input.length + "." ) .css( "color", "red" ); // Prevent form submission -$( "form" ).submit(function( event ) { +$( "form" ).on( "submit", function( event ) { event.preventDefault(); -}); +} ); ]]> diff --git a/entries/remove.xml b/entries/remove.xml index 6c85e9b4e..4a7ab41cb 100644 --- a/entries/remove.xml +++ b/entries/remove.xml @@ -42,9 +42,9 @@ $( "div" ).remove( ".hello" ); Removes all paragraphs from the DOM diff --git a/entries/removeAttr.xml b/entries/removeAttr.xml index 0dd1abea1..6df348209 100644 --- a/entries/removeAttr.xml +++ b/entries/removeAttr.xml @@ -10,18 +10,19 @@ 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 );
           
      +
      Clicking the button changes the title of the input next to it. Move the mouse pointer over the text input to see the effect of adding and removing the title attribute. - - - - - Remove the class 'blue' and 'under' from the matched elements. - - - - - - Remove all the classes from the matched elements. - - - - - - - - - - + + .removeClass() + + 1.0 + + 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. + + + + 3.3 + + + + + + A function returning one or more space-separated class names or an array of class names to be removed. Receives the index position of the element in the set and the old class value as arguments. + + + Remove a single class or multiple classes from each element in the set of matched elements. + +

      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:

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

      This method is often used with .addClass() to switch elements' classes from one to another, like so:

      +
      
      +  $( "p" ).removeClass( "myClass noClass" ).addClass( "yourClass" );
      +      
      +

      Here, the myClass and noClass classes are removed from all paragraphs, while yourClass is added.

      +

      To replace all existing classes with another class, we can use .attr( "class", "newClass" ) instead.

      +

      As of jQuery 1.4, the .removeClass() method allows us to indicate the class to be removed by passing in a function.

      +
      
      +  $( "li" ).last().removeClass(function() {
      +    return $( this ).prev().attr( "class" );
      +  });
      +      
      +

      This example removes the class name of the penultimate <li> from the last <li>.

      +
      + + Remove the class 'blue' from the matched elements. + + + + + + Remove the class 'blue' and 'under' from the matched elements. + + + + + + Remove the class 'blue' and 'under' from the matched elements (3.3+ syntax). + + + + + + + + + + + +
      + + + + 1.0 + + Remove all classes from each matched element. + +

      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.

      +
      + + Remove all the classes from the matched elements. + + + + + + + + + +
      + diff --git a/entries/removeData.xml b/entries/removeData.xml index 7286016dd..e4dd08b1f 100644 --- a/entries/removeData.xml +++ b/entries/removeData.xml @@ -17,21 +17,24 @@ Remove a previously-stored piece of data. -

      The .removeData() method allows us to remove values that were previously set using .data(). When called with the name of a key, .removeData() deletes that particular value; when called with no arguments, all values are removed. Removing data from jQuery's internal .data() cache does not effect any HTML5 data- attributes in a document; use .removeAttr() to remove those.

      -

      When using .removeData("name"), jQuery will attempt to locate a data- attribute on the element if no property by that name is in the internal data cache. To avoid a re-query of the data- attribute, set the name to a value of either null or undefined (e.g. .data("name", undefined)) rather than using .removeData().

      +

      The .removeData() method allows us to remove values that were previously set using .data(). When called with the name of a key, .removeData() deletes that particular value. When called with no arguments, .removeData() removes all values.

      +

      + Note that .removeData() will only remove data from jQuery's internal .data() cache, and any corresponding data- attributes on the element will not be removed. A later call to data() + will therefore re-retrieve the value from the data- attribute. To prevent this, use .removeAttr() alongside .removeData() to remove the data- attribute as well. Prior to jQuery 1.4.3, + as data() did not use data- attributes, this was not an issue. +

      As of jQuery 1.7, when called with an array of keys or a string of space-separated keys, .removeData() deletes the value of each key in that array or string.

      -

      As of jQuery 1.4.3, calling .removeData() will cause the value of the property being removed to revert to the value of the data attribute of the same name in the DOM, rather than being set to undefined.

      Set a data store for 2 names then remove one of them. @@ -117,7 +108,7 @@ $( "p" ).replaceWith( "Paragraph. " ); On click, replace each paragraph with a div that is already in the DOM and selected with the $() function. Notice it doesn't clone the object but rather moves it to replace the paragraph. diff --git a/entries/reset-selector.xml b/entries/reset-selector.xml index 301b0e5e2..db5586086 100644 --- a/entries/reset-selector.xml +++ b/entries/reset-selector.xml @@ -13,18 +13,18 @@ Finds all reset inputs. - + + + + + resize event + Trigger the "resize" event on an element. + + 1.0 + + The string "resize". + + + +

      See the description for .on( "resize", ... ).

      +
      + +
      + + diff --git a/entries/scroll-shorthand.xml b/entries/scroll-shorthand.xml new file mode 100644 index 000000000..67b7997ed --- /dev/null +++ b/entries/scroll-shorthand.xml @@ -0,0 +1,36 @@ + + + .scroll() + Bind an event handler to the "scroll" event, or trigger that event on an element. + + 1.0 + + A function to execute each time the event is triggered. + + + + + 1.4.3 + + An object containing data that will be passed to the event handler. + + + A function to execute each time the event is triggered. + + + + + 1.0 + + +
      +

      This API is deprecated.

      +

      Instead of .scroll( handler ) or .scroll( eventData, handler ), use .on( "scroll", handler ) or .on( "scroll", eventData, handler ), respectively.

      +

      Instead of .scroll(), use .trigger( "scroll" ).

      +
      +
      + + + + +
      diff --git a/entries/scroll.xml b/entries/scroll.xml index 080ecdc92..5f46ddfe0 100644 --- a/entries/scroll.xml +++ b/entries/scroll.xml @@ -1,27 +1,27 @@ - - .scroll() - Bind an event handler to the "scroll" JavaScript event, or trigger that event on an element. + + +Bind an event handler to the "scroll" event, or trigger that event on an element. + + scroll event + Bind an event handler to the "scroll" event. - 1.0 - - A function to execute each time the event is triggered. + 1.7 + + The string "scroll". - - - 1.4.3 - + An object containing data that will be passed to the event handler. - + A function to execute each time the event is triggered. + - - 1.0 - -

      This method is a shortcut for .on( "scroll", handler ) in the first and second variations, and .trigger( "scroll" ) in the third.

      +
      +

      This page describes the scroll event. For the deprecated .scroll() method, see .scroll().

      +

      The scroll event is sent to an element when the user scrolls to a different place in the element. It applies to window objects, but also to scrollable frames and elements with the overflow CSS property set to scroll (or auto when the element's explicit height or width is less than the height or width of its contents).

      For example, consider the HTML:

      
      @@ -39,26 +39,27 @@
         Trigger the handler
       </div>
       <div id="log"></div>
      -
      +

    The style definition is present to make the target element small enough to be scrollable:

    -

    +

    -

    +
    Figure 1 - Illustration of the rendered HTML
    +

    The scroll event handler can be bound to this element:

    
    -$( "#target" ).scroll(function() {
    -  $( "#log" ).append( "<div>Handler for .scroll() called.</div>" );
    -});
    +$( "#target" ).on( "scroll", function() {
    +  $( "#log" ).append( "<div>Handler for `scroll` called.</div>" );
    +} );
         

    Now when the user scrolls the text up or down, one or more messages are appended to <div id="log"></div>:

    - Handler for .scroll() called. + Handler for `scroll` called.

    -

    To trigger the event manually, apply .scroll() without an argument:

    +

    To trigger the event manually, use .trigger( "scroll" ):

    
    -$( "#other" ).click(function() {
    -  $( "#target" ).scroll();
    -});
    +$( "#other" ).on( "click", function() {
    +  $( "#target" ).trigger( "scroll" );
    +} );
         

    After this code executes, clicks on Trigger the handler will also append the message.

    A scroll event is sent whenever the element's scroll position changes, regardless of the cause. A mouse click or drag on the scroll bar, dragging inside the element, pressing the arrow keys, or using the mouse's scroll wheel could cause this event.

    @@ -69,9 +70,9 @@ $( "#other" ).click(function() { $( "p" ).clone().appendTo( document.body ); $( "p" ).clone().appendTo( document.body ); $( "p" ).clone().appendTo( document.body ); -$( window ).scroll(function() { +$( window ).on( "scroll", function() { $( "span" ).css( "display", "inline" ).fadeOut( "slow" ); -}); +} ); ]]> - + + + + + select event + Trigger the "select" event on an element. + + 1.0 + + The string "select". + + + +

    See the description for .on( "select", ... ).

    +
    + +
    + + diff --git a/entries/selected-selector.xml b/entries/selected-selector.xml index c96bf422f..5eb6cef8d 100644 --- a/entries/selected-selector.xml +++ b/entries/selected-selector.xml @@ -14,13 +14,13 @@ Attaches a change event to the select that gets the text for each selected option and writes them in the div. It then triggers the event for the initial text draw. @@ -81,13 +84,13 @@ $( "button" ).click(function() { Show the first div, followed by each next adjacent sibling div in order, with a 200ms animation. Each animation starts when the previous sibling div's animation ends. @@ -117,19 +120,19 @@ function doIt() { $( "span,div" ).show( "slow" ); } // Can pass in function name -$( "button" ).click( doIt ); +$( "button" ).on( "click", doIt ); -$( "form" ).submit(function( event ) { +$( "form" ).on( "submit", function( event ) { if ( $( "input" ).val() === "yes" ) { $( "p" ).show( 4000, function() { $( this ).text( "Ok, DONE! (now showing)" ); - }); + } ); } $( "span,div" ).hide( "fast" ); // Prevent form submission event.preventDefault(); -}); +} ); ]]> - - + diff --git a/entries/slice.xml b/entries/slice.xml index 81d76c989..8f94ce16a 100644 --- a/entries/slice.xml +++ b/entries/slice.xml @@ -62,7 +62,7 @@ function colorEm() { ").css( 'background', 'yellow' );" ); } -$( "button" ).click( colorEm ); +$( "button" ).on( "click", colorEm ); ]]> @@ -82,7 +84,7 @@ $( "button" ).click(function() { Animates divs between dividers with a toggle that makes some appear and some disappear. diff --git a/entries/submit-selector.xml b/entries/submit-selector.xml index dfb9ca72d..f6c48b8ff 100644 --- a/entries/submit-selector.xml +++ b/entries/submit-selector.xml @@ -15,31 +15,31 @@ " ); -}) +} ); ]]> +]]> To trigger the submit event on the first form on the page, try: - + + + + + submit event + Trigger the "submit" event on an element. + + 1.0 + + The string "submit". + + + +

    See the description for .on( "submit", ... ).

    +
    + +
    + + diff --git a/entries/target-selector.xml b/entries/target-selector.xml index 5d60f3dab..b010a5ced 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/text-selector.xml b/entries/text-selector.xml index b6fbb2284..4886c3a50 100644 --- a/entries/text-selector.xml +++ b/entries/text-selector.xml @@ -5,7 +5,7 @@ 1.0 - Selects all elements of type text. + Selects all input elements of type text.

    $( ":text" ) allows us to select all <input type="text"> elements. As with other pseudo-class selectors (those that begin with a ":") it is recommended to precede it with a tag name or some other selector; otherwise, the universal selector ( "*" ) is implied. In other words, the bare $( ":text" ) is equivalent to $( "*:text" ), so $( "input:text" ) should be used instead.

    Note: As of jQuery 1.5.2, :text selects input elements that have no specified type attribute (in which case type="text" is implied).

    @@ -19,19 +19,19 @@ $( "<input>" ).is( ":text" ); // true Finds all text inputs. Bind two or more handlers to the matched elements, to be executed on alternate clicks. 1.0 - + A function to execute every even time the element is clicked. + - + A function to execute every odd time the element is clicked. + - + Additional handlers to cycle through after clicks. + diff --git a/entries/toggle.xml b/entries/toggle.xml index 76d95f42a..7d74577fe 100644 --- a/entries/toggle.xml +++ b/entries/toggle.xml @@ -24,8 +24,8 @@ 1.3 - - A Boolean indicating whether to show or hide the elements. + + Use true to show the element or false to hide it. @@ -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:

    
    @@ -51,7 +51,7 @@ $( ".target" ).toggle();
         

    We will cause .toggle() to be called when another element is clicked:

    
    -$( "#clickme" ).click(function() {
    +$( "#clickme" ).on( "click", function() {
       $( "#book" ).toggle( "slow", function() {
         // Animation complete.
       });
    @@ -59,29 +59,31 @@ $( "#clickme" ).click(function() {
         

    With the element initially shown, we can hide it slowly with the first click:

    -

    - - - - -

    +
    + + + + +
    Figure 1 - Illustration of the toggle() effect when hiding the image
    +

    A second click will show the element once again:

    -

    - - - - -

    +
    + + + + +
    Figure 2 - Illustration of the toggle() effect when showing the image
    +

    The second version of the method accepts a Boolean parameter. If this parameter is true, then the matched elements are shown; if false, the elements are hidden. In essence, the statement:

    
    -$( "#foo" ).toggle( showOrHide );
    +$( "#foo" ).toggle( display );
         

    is equivalent to:

    
    -if ( showOrHide === true ) {
    +if ( display === true ) {
       $( "#foo" ).show();
    -} else if ( showOrHide === false ) {
    +} else if ( display === false ) {
       $( "#foo" ).hide();
     }
         
    @@ -90,9 +92,9 @@ if ( showOrHide === true ) { Toggles all paragraphs. @@ -124,7 +126,7 @@ $( "button" ).click(function() { Shows all paragraphs, then hides them all, back and forth. diff --git a/entries/toggleClass.xml b/entries/toggleClass.xml index 9fcb5a948..b42f23290 100644 --- a/entries/toggleClass.xml +++ b/entries/toggleClass.xml @@ -1,63 +1,91 @@ - - .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 switch 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 switch 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 classes (separated by spaces) to be toggled for each element in the matched set.
    +      
    +    
    +    
    +      1.3
    +      
    +        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.
    +      
    +    
    +    
    +      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.
    +      
    +    
    +    
    +      1.4
    +      
    +        
    +        
    +        
    +        
    +        A function returning one or more space-separated 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.
    +      
    +    
    +    
    +      3.3
    +      
    +        
    +        
    +        
    +        
    +        
    +        A function returning one or more space-separated class names or an array of 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 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>
    -    
    -

    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 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" ) ) {
         return "happy";
    @@ -65,17 +93,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.
    +
    + +
    +
    diff --git a/entries/trigger.xml b/entries/trigger.xml index 6a1f12887..caff8cb8f 100644 --- a/entries/trigger.xml +++ b/entries/trigger.xml @@ -44,19 +44,21 @@ $( "#foo").trigger( "custom", [ "Custom", "Event" ] );

    The event object is always passed as the first parameter to an event handler. An array of arguments can also be passed to the .trigger() call, and these parameters will be passed along to the handler as well following the event object. As of jQuery 1.6.2, single string or numeric argument can be passed without being wrapped in an array.

    Note the difference between the extra parameters passed here and the eventData parameter to the .on() method. Both are mechanisms for passing information to an event handler, but the extraParameters argument to .trigger() allows information to be determined at the time the event is triggered, while the eventData argument to .on() requires the information to be already computed at the time the handler is bound.

    The .trigger() method can be used on jQuery collections that wrap plain JavaScript objects similar to a pub/sub mechanism; any event handlers bound to the object will be called when the event is triggered.

    -
    Note: For both plain objects and DOM objects other than window, if a triggered event name matches the name of a property on the object, jQuery will attempt to invoke the property as a method if no event handler calls event.preventDefault(). If this behavior is not desired, use .triggerHandler() instead.
    +
    Note: For both plain objects and DOM objects other than window, if a triggered event name matches the name of a property on the object, jQuery will attempt to invoke the property as a method if no event handler calls event.preventDefault(). If this behavior is not desired, use .triggerHandler() instead.
    +
    Note: As with .triggerHandler(), when calling .trigger() with an event name matches the name of a property on the object, prefixed by on (e.g. triggering click on window that has a non null onclick method), jQuery will attempt to invoke that property as a method.
    +
    Note: When triggering with a plain object that is not array-like but still contains a length property, you should pass the object in an array (e.g. [ { length: 1 } ]).
    Clicks to button #2 also trigger a click for button #1. To submit the first form without using the submit() function, try: diff --git a/entries/triggerHandler.xml b/entries/triggerHandler.xml index a470e31fa..83b2a576f 100644 --- a/entries/triggerHandler.xml +++ b/entries/triggerHandler.xml @@ -7,16 +7,29 @@ A string containing a JavaScript event type, such as click or submit. - - An array of additional parameters to pass along to the event handler. + + + + Additional parameters to pass along to the event handler. + + + + 1.3 + + A jQuery.Event object. + + + + + Additional parameters to pass along to the event handler. -

    The .triggerHandler() method behaves similarly to .trigger(), with the following exceptions:

    +

    .triggerHandler( eventType ) executes all handlers bound with jQuery for the event type. It will also execute any method called on{eventType}() found on the element. The behavior of this method is similar to .trigger(), with the following exceptions:

      -
    • The .triggerHandler() method does not cause the default behavior of an event to occur (such as a form submission).
    • +
    • The .triggerHandler( "event" ) method will not call .event() on the element it is triggered on. This means .triggerHandler( "submit" ) on a form will not call .submit() on the form.
    • While .trigger() will operate on all elements matched by the jQuery object, .triggerHandler() only affects the first matched element.
    • -
    • Events created with .triggerHandler() do not bubble up the DOM hierarchy; if they are not handled by the target element directly, they do nothing.
    • +
    • Events triggered with .triggerHandler() do not bubble up the DOM hierarchy; if they are not handled by the target element directly, they do nothing.
    • Instead of returning the jQuery object (to allow chaining), .triggerHandler() returns whatever value was returned by the last handler it caused to be executed. If no handlers are triggered, it returns undefined

    For more information on this method, see the discussion for .trigger().

    @@ -24,15 +37,15 @@ If you called .triggerHandler() on a focus event - the browser's default focus action would not be triggered, only the event handlers bound to the focus event.
    + + + + + Locate all the divs preceding the last item and wrap them with a div with class wrapper - with or without .uniqueSort(). + + + + + + + diff --git a/entries/unload-shorthand.xml b/entries/unload-shorthand.xml new file mode 100644 index 000000000..693768ecd --- /dev/null +++ b/entries/unload-shorthand.xml @@ -0,0 +1,37 @@ + + + .unload() + Bind an event handler to the "unload" event, or trigger that event on an element. + + 1.0 + + A function to execute each time the event is triggered. + + + + + 1.4.3 + + An object containing data that will be passed to the event handler. + + + A function to execute each time the event is triggered. + + + + + 1.0 + + +
    +

    This API has been removed in jQuery 3.0.

    +

    Instead of .unload( handler ) or .unload( eventData, handler ), use .on( "unload", handler ) or .on( "unload", eventData, handler ), respectively.

    +

    Instead of .unload(), use .trigger( "unload" ).

    +
    +
    + + + + + +
    diff --git a/entries/unload.xml b/entries/unload.xml index 077ec6fca..05d1c27a4 100644 --- a/entries/unload.xml +++ b/entries/unload.xml @@ -1,48 +1,66 @@ - - .unload() + +Bind an event handler to the "unload" event, or trigger that event on an element. + + + unload event + Bind an event handler to the "unload" event. - 1.0 - - A function to execute when the event is triggered. + 1.7 + + The string "unload". - - - 1.4.3 - + A plain object of data that will be passed to the event handler. - + A function to execute each time the event is triggered. + - Bind an event handler to the "unload" JavaScript event. -

    This method is a shortcut for .on( "unload", handler ).

    +
    +

    This page describes the unload event. For the .unload() method removed in jQuery 3.0, see .unload().

    +

    The unload event is sent to the window element when the user navigates away from the page. This could mean one of many things. The user could have clicked on a link to leave the page, or typed in a new URL in the address bar. The forward and back buttons will trigger the event. Closing the browser window will cause the event to be triggered. Even a page reload will first create an unload event.

    -

    The exact handling of the unload event has varied from version to version of browsers. For example, some versions of Firefox trigger the event when a link is followed, but not when the window is closed. In practical usage, behavior should be tested on all supported browsers, and contrasted with the proprietary beforeunload event.

    +

    The exact handling of the unload event has varied from version to version of browsers. For example, some versions of Firefox trigger the event when a link is followed, but not when the window is closed. In practical usage, behavior should be tested on all supported browsers and contrasted with the similar beforeunload event.

    Any unload event handler should be bound to the window object:

    
    -$( window ).unload(function() {
    -  alert( "Handler for .unload() called." );
    -});
    +$( window ).on( "unload", function() {
    +  return "Handler for `unload` called.";
    +} );
         
    -

    After this code executes, the alert will be displayed whenever the browser leaves the current page. -It is not possible to cancel the unload event with .preventDefault(). This event is available so that scripts can perform cleanup when the user leaves the page. -

    +

    This event is available so that scripts can perform cleanup when the user leaves the page. Most browsers will ignore calls to alert(), confirm() and prompt() inside the event handler. The string you return may be used in a confirmation dialog, but not all browsers support this. It is not possible to cancel the unload event with .preventDefault().

    To display an alert when a page is unloaded: - - + +
    + + + unload event + Trigger the "unload" event on an element. + + 1.0 + + The string "unload". + + + +

    See the description for .on( "unload", ... ).

    +
    + +
    + +
    diff --git a/entries/unwrap.xml b/entries/unwrap.xml index d966952c6..b2dde6046 100644 --- a/entries/unwrap.xml +++ b/entries/unwrap.xml @@ -4,15 +4,21 @@ 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.

    +

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

    Wrap/unwrap a div around each of the paragraphs.
    -

    Note: At present, using .val() on textarea elements strips carriage return characters from the browser-reported value. When this value is sent to the server via XHR however, carriage returns are preserved (or added by browsers which do not include them in the raw value). A workaround for this issue can be achieved using a valHook as follows:

    +

    Note: At present, using .val() on <textarea> elements strips carriage return characters from the browser-reported value. When this value is sent to the server via XHR, however, carriage returns are preserved (or added by browsers which do not include them in the raw value). A workaround for this issue can be achieved using a valHook as follows:

    
     $.valHooks.textarea = {
    @@ -43,11 +44,13 @@ $.valHooks.textarea = {
     function displayVals() {
       var singleValues = $( "#single" ).val();
       var multipleValues = $( "#multiple" ).val() || [];
    +  // When using jQuery 3:
    +  // var multipleValues = $( "#multiple" ).val();
       $( "p" ).html( "Single: " + singleValues +
         " Multiple: " + multipleValues.join( ", " ) );
     }
     
    -$( "select" ).change( displayVals );
    +$( "select" ).on( "change", displayVals );
     displayVals();
     ]]>
           
           
    -

    This example appends the string " items" to the text inputs' values.

    +

    This example removes leading and trailing whitespace from the values of text inputs with a "tags" class.

    Set the value of an input box. - A function to call once the animation is complete. + A function to call once the animation is complete, called once per matched element. diff --git a/includes/duration-argument.xml b/includes/duration-argument.xml index 1a1c5c5e3..8fcfb7f30 100644 --- a/includes/duration-argument.xml +++ b/includes/duration-argument.xml @@ -1,6 +1,6 @@ - A string or number determining how long the animation will run. - - + A string or number determining how long the animation will run. + + diff --git a/includes/easing-argument.xml b/includes/easing-argument.xml index b64835515..127057afe 100644 --- a/includes/easing-argument.xml +++ b/includes/easing-argument.xml @@ -1,4 +1,4 @@ - A string indicating which easing function to use for the transition. + A string indicating which easing function to use for the transition. diff --git a/includes/options-argument.xml b/includes/options-argument.xml index 110456cd6..cacb3286f 100644 --- a/includes/options-argument.xml +++ b/includes/options-argument.xml @@ -1,81 +1,81 @@ - A map of additional options to pass to the method. - - A string or number determining how long the animation will run. - - - - - A string indicating which easing function to use for the transition. - - - A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case the animation is added to the queue represented by that string. When a custom queue name is used the animation does not automatically start; you must call .dequeue("queuename") to start it. - - - - - A map of one or more of the CSS properties defined by the properties argument and their corresponding easing functions. - + A map of additional options to pass to the method. + + A string or number determining how long the animation will run. + + + + + A string indicating which easing function to use for the transition. + + + A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case the animation is added to the queue represented by that string. When a custom queue name is used the animation does not automatically start; you must call .dequeue("queuename") to start it. + + + + + An object containing one or more of the CSS properties defined by the properties argument and their corresponding easing functions. + - - A function to be called for each animated property of each animated element. This function provides an opportunity to modify the Tween object to change the value of the property before it is set. - - The numeric value of the property being animated at each step - - - An object of properties related to the animation and the element being animated. For information about the tween object and its properties, see jQuery.Tween - - + + A function to be called for each animated property of each animated element. This function provides an opportunity to modify the Tween object to change the value of the property before it is set. + + The numeric value of the property being animated at each step + + + An object of properties related to the animation and the element being animated. For information about the tween object and its properties, see jQuery.Tween + + - - A function to be called after each step of the animation, only once per animated element regardless of the number of animated properties. - - An enhanced Promise object with additional properties for the animation - - - A number from 0 to 1 indicating the progress of the animation - - - A number indicating the remaining number of milliseconds until the scheduled end of the animation - - - - A function to call once the animation is complete. - - - - A function to call when the animation begins. - - An enhanced Promise object with additional properties for the animation - - - - A function to be called when the animation completes (its Promise object is resolved). - - An enhanced Promise object with additional properties for the animation - - - Indicates whether the animation jumped to the end - - - - A function to be called when the animation fails to complete (its Promise object is rejected). - - An enhanced Promise object with additional properties for the animation - - - Indicates whether the animation jumped to the end - - - - A function to be called when the animation completes or stops without completing (its Promise object is either resolved or rejected). - - An enhanced Promise object with additional properties for the animation - - - Indicates whether the animation jumped to the end - - + + A function to be called after each step of the animation, only once per animated element regardless of the number of animated properties. + + An enhanced Promise object with additional properties for the animation + + + A number from 0 to 1 indicating the progress of the animation + + + A number indicating the remaining number of milliseconds until the scheduled end of the animation + + + + A function that is called once the animation on an element is complete. + + + + A function to call when the animation on an element begins. + + An enhanced Promise object with additional properties for the animation + + + + A function to be called when the animation on an element completes (its Promise object is resolved). + + An enhanced Promise object with additional properties for the animation + + + Indicates whether the animation jumped to the end + + + + A function to be called when the animation on an element fails to complete (its Promise object is rejected). + + An enhanced Promise object with additional properties for the animation + + + Indicates whether the animation jumped to the end + + + + A function to be called when the animation on an element completes or stops without completing (its Promise object is either resolved or rejected). + + An enhanced Promise object with additional properties for the animation + + + Indicates whether the animation jumped to the end + + diff --git a/notes.xsl b/notes.xsl index bec2e8da2..6963dad28 100644 --- a/notes.xsl +++ b/notes.xsl @@ -1,45 +1,75 @@ + + undefined is not recognized as a data value. Calls such as ( , undefined ) will return the jQuery object that it was called on, allowing for chaining. + + + undefined is not recognized as a data value. Calls such as ( , undefined ) will return the corresponding data for "name", and is therefore the same as ( ). + + + The number returned by dimensions-related APIs, including , may be fractional in some cases. Code should not assume it is an integer. Also, dimensions may be incorrect when the page is zoomed by the user; browsers do not expose an API to detect this condition. + + + Prior to jQuery 1.9, would attempt to add or change nodes in the current jQuery set if the first node in the set was not connected to a document, and in those cases return a new jQuery set rather than the original set. The method might or might not have returned a new result depending on the number or connectedness of its arguments! As of jQuery 1.9, .after(), .before(), and .replaceWith() always return the original unmodified set. Attempting to use these methods on a node without a parent has no effect—that is, neither the set nor the nodes it contains are changed. + 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. - Because is a jQuery extension and not part of the CSS specification, queries using cannot take advantage of the performance boost provided by the native DOM querySelectorAll() method. To achieve the best performance when using to select elements, first select the elements using a pure CSS selector, then use .filter(""). + Because is a jQuery extension and not part of the CSS specification, queries using cannot take advantage of the performance boost provided by the native DOM querySelectorAll() method. To achieve the best performance when using to select elements, first select the elements using a pure CSS selector, then use .filter(""). Because is a jQuery extension and not part of the CSS specification, queries using cannot take advantage of the performance boost provided by the native DOM querySelectorAll() method. For better performance in modern browsers, use instead. - All jQuery effects, including , can be turned off globally by setting jQuery.fx.off = true, which effectively sets the duration to 0. For more information, see jQuery.fx.off. + All jQuery effects, including , can be turned off globally by setting jQuery.fx.off = true, which effectively sets the duration to 0. For more information, see jQuery.fx.off. Note that this method currently does not provide cross-platform support for setting data on XML documents, as Internet Explorer does not allow data to be attached via expando properties. - In Internet Explorer prior to version 9, using .prop() to set a DOM element property to anything other than a simple primitive value (number, string, or boolean) can cause memory leaks if the property is not removed (using .removeProp()) before the DOM element is removed from the document. To safely set values on DOM objects without memory leaks, use .data(). + In Internet Explorer prior to version 9, using .prop() to set a DOM element property to anything other than a simple primitive value (number, string, or boolean) can cause memory leaks if the property is not removed (using .removeProp()) before the DOM element is removed from the document. To safely set values on DOM objects without memory leaks, use .data(). - Since the .live() method handles events once they have propagated to the top of the document, it is not possible to stop propagation of live events. Similarly, events handled by .delegate() will propagate to the elements to which they are delegated; event handlers bound on any elements below it in the DOM tree will already have been executed by the time the delegated event handler is called. These handlers, therefore, may prevent the delegated handler from triggering by calling event.stopPropagation() or returning false. + Since the .live() method handles events once they have propagated to the top of the document, it is not possible to stop propagation of live events. Similarly, events handled by .delegate() will propagate to the elements to which they are delegated; event handlers bound on any elements below it in the DOM tree will already have been executed by the time the delegated event handler is called. These handlers, therefore, may prevent the delegated handler from triggering by calling event.stopPropagation() or returning false. + + + 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, 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. - If a request with returns an error code, it will fail silently unless the script has also called the global .ajaxError() method. Alternatively, as of jQuery 1.5, the .error() method of the jqXHR object returned by is also available for error handling. + If a request with returns an error code, it will fail silently unless the script has also called the global ajaxError event. Alternatively, as of jQuery 1.5, the .error() method of the jqXHR object returned by is also available for error handling. - If $.ajax() or $.ajaxSetup() is called with the global option set to false, the method will not fire. + If $.ajax() or $.ajaxSetup() is called with the global option set to false, the event will not fire. If is called on an unordered list (<ul>) and its <li> elements have position (relative, absolute, or fixed), the effect may not work properly in IE6 through at least IE9 unless the <ul> has "layout." To remedy the problem, add the position: relative; and zoom: 1; CSS declarations to the ul. + + By design, any jQuery constructor or method that accepts an HTML string — jQuery(), .append(), .after(), etc. — can potentially execute code. This can occur by injection of script tags or use of HTML attributes that execute code (for example, <img onload="">). Do not use these methods to insert strings obtained from untrusted sources such as URL query parameters, cookies, or form inputs. Doing so can introduce cross-site-scripting (XSS) vulnerabilities. Remove or escape any user input before adding content to the document. + + + Using this selector heavily can have performance implications, as it may force the browser to re-render the page before it can determine visibility. Tracking the visibility of elements via other methods, using a class for example, can provide better performance. + + + As of jQuery 1.9, all the handlers for the jQuery global Ajax events, including those added with .on( "", ... ), must be attached to document. + + + jQuery doesn't officially support SVG. Using jQuery methods on SVG documents, unless explicitly documented for that method, might cause unexpected behaviors. Examples of methods that support SVG as of jQuery 3.0 are addClass and removeClass. + diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..e3b947059 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1292 @@ +{ + "name": "api.jquery.com", + "version": "3.3.12", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "api.jquery.com", + "version": "3.3.12", + "dependencies": { + "grunt": "1.6.1", + "grunt-jquery-content": "3.3.2" + } + }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/argparse/node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + }, + "node_modules/array-each": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz", + "integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array-slice": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", + "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/async": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", + "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/cheerio": { + "version": "1.0.0-rc.12", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.12.tgz", + "integrity": "sha512-VqR8m68vM46BNnuZ5NtnGBKIE/DfN0cRIzg9n40EIq9NOv90ayxLBXA8fXC5gquFRGJSTRqBq25Jt2ECLR431Q==", + "dependencies": { + "cheerio-select": "^2.1.0", + "dom-serializer": "^2.0.0", + "domhandler": "^5.0.3", + "domutils": "^3.0.1", + "htmlparser2": "^8.0.1", + "parse5": "^7.0.0", + "parse5-htmlparser2-tree-adapter": "^7.0.0" + }, + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/cheeriojs/cheerio?sponsor=1" + } + }, + "node_modules/cheerio-select": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-2.1.0.tgz", + "integrity": "sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==", + "dependencies": { + "boolbase": "^1.0.0", + "css-select": "^5.1.0", + "css-what": "^6.1.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3", + "domutils": "^3.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/colors": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "node_modules/css-select": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", + "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^6.1.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", + "nth-check": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/css-what": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", + "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==", + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/dateformat": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.6.3.tgz", + "integrity": "sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==", + "engines": { + "node": "*" + } + }, + "node_modules/detect-file": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", + "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/dom-serializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/domelementtype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ] + }, + "node_modules/domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "dependencies": { + "domelementtype": "^2.3.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/domutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", + "integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==", + "dependencies": { + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/eventemitter2": { + "version": "0.4.14", + "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz", + "integrity": "sha1-j2G3XN4BKy6esoTUVFWDtWQ7Yas=" + }, + "node_modules/exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/expand-tilde": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", + "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=", + "dependencies": { + "homedir-polyfill": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/findup-sync": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-5.0.0.tgz", + "integrity": "sha512-MzwXju70AuyflbgeOhzvQWAvvQdo1XL0A9bVvlXsYcFEBM87WR4OakL4OfZq+QRmr+duJubio+UtNQCPsVESzQ==", + "dependencies": { + "detect-file": "^1.0.0", + "is-glob": "^4.0.3", + "micromatch": "^4.0.4", + "resolve-dir": "^1.0.1" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/fined": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fined/-/fined-1.2.0.tgz", + "integrity": "sha512-ZYDqPLGxDkDhDZBjZBb+oD1+j0rA4E0pXY50eplAAOPg2N/gUBSSk5IM1/QhPfyVo19lJ+CvXpqfvk+b2p/8Ng==", + "dependencies": { + "expand-tilde": "^2.0.2", + "is-plain-object": "^2.0.3", + "object.defaults": "^1.1.0", + "object.pick": "^1.2.0", + "parse-filepath": "^1.0.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/flagged-respawn": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.1.tgz", + "integrity": "sha512-lNaHNVymajmk0OJMBn8fVUAU1BtDeKIqKoVhk4xAALB57aALg6b4W0MfJ/cUE0g9YBXy5XhSlPIpYIJ7HaY/3Q==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/for-own": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-1.0.0.tgz", + "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=", + "dependencies": { + "for-in": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/getobject": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/getobject/-/getobject-1.0.2.tgz", + "integrity": "sha512-2zblDBaFcb3rB4rF77XVnuINOE2h2k/OnqXAiy0IrTxUfV1iFp3la33oAQVY9pCpWU268WFYVt2t71hlMuLsOg==", + "engines": { + "node": ">=10" + } + }, + "node_modules/gilded-wordpress": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/gilded-wordpress/-/gilded-wordpress-1.0.7.tgz", + "integrity": "sha512-w8g4jfs1TWywX2hZ4+LlzQoz2z/JRX/8S6OgelD3IUsNnGHxXQ1FgExoIqomwZVPAmxYs0vEu2BeA1Y4KciZlw==", + "dependencies": { + "async": "^0.9.0", + "wordpress": "^1.4.2" + } + }, + "node_modules/gilded-wordpress/node_modules/async": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", + "integrity": "sha512-l6ToIJIotphWahxxHyzK9bnLR6kM4jJIIgLShZeqLY7iboHoGkdgFl7W2/Ivi4SkMJYGKqW8vSuk0uKUj6qsSw==" + }, + "node_modules/glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/global-modules": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", + "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", + "dependencies": { + "global-prefix": "^1.0.1", + "is-windows": "^1.0.1", + "resolve-dir": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/global-prefix": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz", + "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=", + "dependencies": { + "expand-tilde": "^2.0.2", + "homedir-polyfill": "^1.0.1", + "ini": "^1.3.4", + "is-windows": "^1.0.1", + "which": "^1.2.14" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/grunt": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.6.1.tgz", + "integrity": "sha512-/ABUy3gYWu5iBmrUSRBP97JLpQUm0GgVveDCp6t3yRNIoltIYw7rEj3g5y1o2PGPR2vfTRGa7WC/LZHLTXnEzA==", + "dependencies": { + "dateformat": "~4.6.2", + "eventemitter2": "~0.4.13", + "exit": "~0.1.2", + "findup-sync": "~5.0.0", + "glob": "~7.1.6", + "grunt-cli": "~1.4.3", + "grunt-known-options": "~2.0.0", + "grunt-legacy-log": "~3.0.0", + "grunt-legacy-util": "~2.0.1", + "iconv-lite": "~0.6.3", + "js-yaml": "~3.14.0", + "minimatch": "~3.0.4", + "nopt": "~3.0.6" + }, + "bin": { + "grunt": "bin/grunt" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/grunt-check-modules": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/grunt-check-modules/-/grunt-check-modules-1.1.0.tgz", + "integrity": "sha1-fBZB28ZlSGdqbVl5Ga35C3s11kQ=", + "engines": { + "node": ">=0.6.0" + }, + "peerDependencies": { + "grunt": ">=0.4.0" + } + }, + "node_modules/grunt-jquery-content": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/grunt-jquery-content/-/grunt-jquery-content-3.3.2.tgz", + "integrity": "sha512-b6w8GBe022BG8O7BkhAKBFcBBAldoIiwAUZ2WI+A8HIouXy8XS8Cwp2RuUPEACg3g2/wHOarmjrsFKFPmmZ55Q==", + "dependencies": { + "cheerio": "^1.0.0-rc.12", + "gilded-wordpress": "1.0.7", + "grunt-check-modules": "^1.1.0", + "he": "^1.2.0", + "highlight.js": "^10.7.2", + "marked": "^4.0.0", + "which": "^4.0.0", + "wordpress": "^1.4.1" + } + }, + "node_modules/grunt-jquery-content/node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "engines": { + "node": ">=16" + } + }, + "node_modules/grunt-jquery-content/node_modules/which": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", + "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", + "dependencies": { + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^16.13.0 || >=18.0.0" + } + }, + "node_modules/grunt-legacy-log": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-3.0.0.tgz", + "integrity": "sha512-GHZQzZmhyq0u3hr7aHW4qUH0xDzwp2YXldLPZTCjlOeGscAOWWPftZG3XioW8MasGp+OBRIu39LFx14SLjXRcA==", + "dependencies": { + "colors": "~1.1.2", + "grunt-legacy-log-utils": "~2.1.0", + "hooker": "~0.2.3", + "lodash": "~4.17.19" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/grunt-legacy-log-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-2.1.0.tgz", + "integrity": "sha512-lwquaPXJtKQk0rUM1IQAop5noEpwFqOXasVoedLeNzaibf/OPWjKYvvdqnEHNmU+0T0CaReAXIbGo747ZD+Aaw==", + "dependencies": { + "chalk": "~4.1.0", + "lodash": "~4.17.19" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/grunt-legacy-util": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-2.0.1.tgz", + "integrity": "sha512-2bQiD4fzXqX8rhNdXkAywCadeqiPiay0oQny77wA2F3WF4grPJXCvAcyoWUJV+po/b15glGkxuSiQCK299UC2w==", + "dependencies": { + "async": "~3.2.0", + "exit": "~0.1.2", + "getobject": "~1.0.0", + "hooker": "~0.2.3", + "lodash": "~4.17.21", + "underscore.string": "~3.3.5", + "which": "~2.0.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/grunt-legacy-util/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/grunt/node_modules/grunt-cli": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.4.3.tgz", + "integrity": "sha512-9Dtx/AhVeB4LYzsViCjUQkd0Kw0McN2gYpdmGYKtE2a5Yt7v1Q+HYZVWhqXc/kGnxlMtqKDxSwotiGeFmkrCoQ==", + "dependencies": { + "grunt-known-options": "~2.0.0", + "interpret": "~1.1.0", + "liftup": "~3.0.1", + "nopt": "~4.0.1", + "v8flags": "~3.2.0" + }, + "bin": { + "grunt": "bin/grunt" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/grunt/node_modules/grunt-cli/node_modules/nopt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", + "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", + "dependencies": { + "abbrev": "1", + "osenv": "^0.1.4" + }, + "bin": { + "nopt": "bin/nopt.js" + } + }, + "node_modules/grunt/node_modules/grunt-known-options": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/grunt-known-options/-/grunt-known-options-2.0.0.tgz", + "integrity": "sha512-GD7cTz0I4SAede1/+pAbmJRG44zFLPipVtdL9o3vqx9IEyb7b4/Y3s7r6ofI3CchR5GvYJ+8buCSioDv5dQLiA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "bin": { + "he": "bin/he" + } + }, + "node_modules/highlight.js": { + "version": "10.7.2", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.2.tgz", + "integrity": "sha512-oFLl873u4usRM9K63j4ME9u3etNF0PLiJhSQ8rdfuL51Wn3zkD6drf9ZW0dOzjnZI22YYG24z30JcmfCZjMgYg==", + "engines": { + "node": "*" + } + }, + "node_modules/homedir-polyfill": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", + "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", + "dependencies": { + "parse-passwd": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/hooker": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz", + "integrity": "sha1-uDT3I8xKJCqmWWNFnfbZhMXT2Vk=", + "engines": { + "node": "*" + } + }, + "node_modules/htmlparser2": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz", + "integrity": "sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==", + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3", + "domutils": "^3.0.1", + "entities": "^4.4.0" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" + }, + "node_modules/interpret": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz", + "integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=" + }, + "node_modules/is-absolute": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", + "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", + "dependencies": { + "is-relative": "^1.0.0", + "is-windows": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-core-module": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz", + "integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==", + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-relative": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", + "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", + "dependencies": { + "is-unc-path": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-unc-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", + "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", + "dependencies": { + "unc-path-regex": "^0.1.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/liftup": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/liftup/-/liftup-3.0.1.tgz", + "integrity": "sha512-yRHaiQDizWSzoXk3APcA71eOI/UuhEkNN9DiW2Tt44mhYzX4joFoCZlxsSOF7RyeLlfqzFLQI1ngFq3ggMPhOw==", + "dependencies": { + "extend": "^3.0.2", + "findup-sync": "^4.0.0", + "fined": "^1.2.0", + "flagged-respawn": "^1.0.1", + "is-plain-object": "^2.0.4", + "object.map": "^1.0.1", + "rechoir": "^0.7.0", + "resolve": "^1.19.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/liftup/node_modules/findup-sync": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-4.0.0.tgz", + "integrity": "sha512-6jvvn/12IC4quLBL1KNokxC7wWTvYncaVUYSoxWw7YykPLuRrnv4qdHcSOywOI5RpkOVGeQRtWM8/q+G6W6qfQ==", + "dependencies": { + "detect-file": "^1.0.0", + "is-glob": "^4.0.0", + "micromatch": "^4.0.2", + "resolve-dir": "^1.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/make-iterator": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", + "integrity": "sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==", + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/marked": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 12" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/minimatch": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz", + "integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + } + }, + "node_modules/nth-check": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, + "node_modules/object.defaults": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/object.defaults/-/object.defaults-1.1.0.tgz", + "integrity": "sha1-On+GgzS0B96gbaFtiNXNKeQ1/s8=", + "dependencies": { + "array-each": "^1.0.1", + "array-slice": "^1.0.0", + "for-own": "^1.0.0", + "isobject": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object.map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object.map/-/object.map-1.0.1.tgz", + "integrity": "sha1-z4Plncj8wK1fQlDh94s7gb2AHTc=", + "dependencies": { + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "dependencies": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "node_modules/parse-filepath": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz", + "integrity": "sha1-pjISf1Oq89FYdvWHLz/6x2PWyJE=", + "dependencies": { + "is-absolute": "^1.0.0", + "map-cache": "^0.2.0", + "path-root": "^0.1.1" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/parse-passwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", + "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/parse5": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", + "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "dependencies": { + "entities": "^4.4.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/parse5-htmlparser2-tree-adapter": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.0.0.tgz", + "integrity": "sha512-B77tOZrqqfUfnVcOrUvfdLbz4pu4RopLD/4vmu3HUPswwTA8OH0EMW9BlWR2B0RCoiZRAHEUu7IxeP1Pd1UU+g==", + "dependencies": { + "domhandler": "^5.0.2", + "parse5": "^7.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, + "node_modules/path-root": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/path-root/-/path-root-0.1.1.tgz", + "integrity": "sha1-mkpoFMrBwM1zNgqV8yCDyOpHRbc=", + "dependencies": { + "path-root-regex": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-root-regex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/path-root-regex/-/path-root-regex-0.1.2.tgz", + "integrity": "sha1-v8zcjfWxLcUsi0PsONGNcsBLqW0=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/rechoir": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.0.tgz", + "integrity": "sha512-ADsDEH2bvbjltXEP+hTIAmeFekTFK0V2BTxMkok6qILyAJEXV0AFfoWcAq4yfll5VdIMd/RVXq0lR+wQi5ZU3Q==", + "dependencies": { + "resolve": "^1.9.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dependencies": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-dir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", + "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=", + "dependencies": { + "expand-tilde": "^2.0.0", + "global-modules": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + }, + "node_modules/sprintf-js": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", + "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==" + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/unc-path-regex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", + "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/underscore.string": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.6.tgz", + "integrity": "sha512-VoC83HWXmCrF6rgkyxS9GHv8W9Q5nhMKho+OadDJGzL2oDYbYEppBaCMH6pFlwLeqj2QS+hhkw2kpXkSdD1JxQ==", + "dependencies": { + "sprintf-js": "^1.1.1", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": "*" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "node_modules/v8flags": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.2.0.tgz", + "integrity": "sha512-mH8etigqMfiGWdeXpaaqGfs6BndypxusHHcv2qSHyZkGEznCd/qAXCWWRzeowtL54147cktFOC4P5y+kl8d8Jg==", + "dependencies": { + "homedir-polyfill": "^1.0.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/wordpress": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/wordpress/-/wordpress-1.4.2.tgz", + "integrity": "sha512-T+o+Af6pK7mhTz/rJEZk4PpSIyRMVhx6vZm6UsmrnlL8pVudhu1gWzn1n3wZXlcEZQz7I0AOkEvPQ5hu++L+qg==", + "dependencies": { + "xmlrpc": "1.3.2" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "node_modules/xmlbuilder": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-8.2.2.tgz", + "integrity": "sha512-eKRAFz04jghooy8muekqzo8uCSVNeyRedbuJrp0fovbLIi7wlsYtdUn3vBAAPq2Y3/0xMz2WMEUQ8yhVVO9Stw==", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/xmlrpc": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/xmlrpc/-/xmlrpc-1.3.2.tgz", + "integrity": "sha512-jQf5gbrP6wvzN71fgkcPPkF4bF/Wyovd7Xdff8d6/ihxYmgETQYSuTc+Hl+tsh/jmgPLro/Aro48LMFlIyEKKQ==", + "dependencies": { + "sax": "1.2.x", + "xmlbuilder": "8.2.x" + }, + "engines": { + "node": ">=0.8", + "npm": ">=1.0.0" + } + } + } +} diff --git a/package.json b/package.json index f50289367..458873eac 100644 --- a/package.json +++ b/package.json @@ -1,32 +1,12 @@ { "name": "api.jquery.com", - "title": "jQuery API Docs", - "description": "API reference documentation for the jQuery JavaScript Library.", - "version": "1.10.7", - "homepage": "https://github.com/jquery/api.jquery.com", - "author": { - "name": "jQuery Foundation (http://jquery.org/)" + "version": "3.3.12", + "private": true, + "scripts": { + "test": "grunt lint" }, - "repository": { - "type": "git", - "url": "git://github.com/jquery/api.jquery.com.git" - }, - "bugs": { - "url": "https://github.com/jquery/api.jquery.com/issues" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://www.opensource.org/licenses/MIT" - } - ], "dependencies": { - "grunt": "0.3.17", - "grunt-clean": "0.3.0", - "grunt-wordpress": "1.0.7", - "grunt-jquery-content": "0.10.5", - "grunt-check-modules": "0.1.0" - }, - "devDependencies": {}, - "keywords": [] + "grunt": "1.6.1", + "grunt-jquery-content": "3.3.2" + } } diff --git a/pages/Ajax_Events.html b/pages/Ajax_Events.html index 9ba25ff7c..6b1249be3 100644 --- a/pages/Ajax_Events.html +++ b/pages/Ajax_Events.html @@ -19,9 +19,9 @@

    Local Events

    Global Events

    These events are triggered on the document, calling any handlers which may be listening. You can listen for these events like so:

    -
     $(document).bind("ajaxSend", function(){
    +
     $(document).on("ajaxSend", function(){
        $("#loading").show();
    - }).bind("ajaxComplete", function(){
    + }).on("ajaxComplete", function(){
        $("#loading").hide();
      });
     
    @@ -33,7 +33,7 @@

    Global Events

    });

    Events

    -

    This is the full list of Ajax events , and in the order in which they are triggered. The indented events are triggered for each and every Ajax request (unless a global option has been set). The ajaxStart and ajaxStop events are events that relate to all Ajax requests together. +

    This is the full list of Ajax events, and in the order in which they are triggered. The indented events are triggered for each and every Ajax request (unless a global option has been set). The ajaxStart and ajaxStop events are events that relate to all Ajax requests together.

    • ajaxStart (Global Event)
      This event is triggered if an Ajax request is started and no other Ajax requests are currently running. diff --git a/pages/Types.html b/pages/Types.html index f94272e8f..16a3a7c1b 100644 --- a/pages/Types.html +++ b/pages/Types.html @@ -1,6 +1,6 @@ -

      JavaScript provides several built-in datatypes. In addition to those, this page documents virtual types like Selectors, enhanced pseudo-types like Events and all and everything you wanted to know about Functions. +

      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:

      @@ -35,6 +35,7 @@

      Contents

        +
      1. Anything
      2. String
      3. +
      4. Array-Like Object
      5. PlainObject
      6. +
      7. Date
      8. Function
      9. +
      10. Error
      11. Selector
      12. Event
      13. Element
      14. +
      15. Text
      16. jQuery
      17. XMLHttpRequest
      18. jqXHR
      19. +
      20. Thenable
      21. Deferred Object
      22. Promise Object
      23. Callbacks Object
      24. XML Document
      25. +
      26. Qunit's Assert Object
      -

      String

      -

      A string in JavaScript is an immutable object that contains none, one or many characters. +

      Anything

      +

      The Anything virtual type is used in jQuery documentation to indicate that any type can be used or should be expected. +

      + +

      String

      +

      A string in JavaScript is an immutable primitive value that contains none, one or many characters.

      "I'm a String in JavaScript!"
       'So am I!'
      @@ -104,15 +115,15 @@ 

      String

      typeof "some string"; // "string"
       
      -

      Quoting

      +

      Quoting

      A string can be defined using single or double quotes. You can nest single quotes inside of double quotes, and the other way around. To mix double quotes with double quotes (or single with single), the nested ones have to be escaped with a backslash.

      "You make 'me' sad."
       'That\'s "cranking" good fun!'
       "<a href=\"home\">Home</a>"
       
      -

      Built-in Methods

      -

      A string in JavaScript has some built-in methods to manipulate the string, though the result is always a new string - or something else, eg. split returns an array. +

      Built-in Methods

      +

      A string in JavaScript has some built-in methods to manipulate the string, though the result is always a new string - or something else, eg. split returns an array.

      "hello".charAt( 0 ) // "h"
       "hello".toUpperCase() // "HELLO"
      @@ -120,13 +131,13 @@ 

      Built-in Methods

      "hello".replace( /e|o/g, "x" ) // "hxllx" "1,2,3".split( "," ) // [ "1", "2", "3" ]
      -

      Length Property

      +

      Length Property

      All strings have a length property.

      "Hello".length // 5
       "".length // 0
       
      -

      Boolean Default

      +

      Boolean Default

      An empty string defaults to false:

      !"" // true
      @@ -136,9 +147,9 @@ 

      Boolean Default

      !new Boolean( false ) // false
      -

      htmlString

      +

      htmlString

      A string is designated htmlString in jQuery documentation when it is used to represent one or more DOM elements, typically to be created and inserted in the document. When passed as an argument of the jQuery() function, the string is identified as HTML if it starts with <tag ... >) and is parsed as such until the final > character. Prior to jQuery 1.9, a string was considered to be HTML if it contained <tag ... > anywhere within the string.

      -

      When a string as passed as an argument to a manipulation method such as .append(), it is always considered to be HTML since jQuery's other common interpretation of a string (CSS selectors) does not apply in those contexts.

      +

      When a string is passed as an argument to a manipulation method such as .append(), it is always considered to be HTML since jQuery's other common interpretation of a string (CSS selectors) does not apply in those contexts.

      For explicit parsing of a string to HTML, the $.parseHTML() method is available as of jQuery 1.8.

      // Appends hello:
       $( "hello" ).appendTo( "body" );
      @@ -155,8 +166,8 @@ 

      htmlString

      // Appends hellowaitbye: $( "hellowaitbye" ).appendTo( "body" );
      -

      Number

      -

      Numbers in JavaScript are double-precision 64-bit format IEEE 754 values. They are immutable, just as strings. All operators common in c-based languages are available to work with numbers (+, -, *, /, %, =, +=, -=, *=, /=, ++, --). +

      Number

      +

      Numbers in JavaScript are double-precision 64-bit format IEEE 754 values. They are immutable primitive values, just like strings. All operators common in c-based languages are available to work with numbers (+, -, *, /, %, =, +=, -=, *=, /=, ++, --).

      12
       3.543
      @@ -166,7 +177,7 @@ 

      Number

      typeof 12 // "number"
       typeof 3.543 // "number"
       
      -

      Boolean Default

      +

      Boolean Default

      If a number is zero, it defaults to false:

      !0 // true
      @@ -178,15 +189,13 @@ 

      Boolean Default

      0.1 + 0.2 // 0.30000000000000004
       
      -


      -

      -

      Math

      +

      Math

      JavaScript provides utilities to work with numbers in the Math object:

      Math.PI // 3.141592653589793
       Math.cos( Math.PI ) // -1
       
      -

      Parsing Numbers

      +

      Parsing Numbers

      parseInt and parseFloat help parsing strings into numbers. Both do some implicit conversion if the base isn't specified:

      parseInt( "123" ) = 123 // (implicit decimal)
      @@ -196,8 +205,8 @@ 

      Parsing Numbers

      parseInt( "11", 2 ) = 3 // (explicit binary) parseFloat( "10.10" ) = 10.1
      -

      Numbers to Strings

      -

      When appending numbers to string, the result is always a string. The operator is the same, so be careful: If you want to add numbers and then append them to a string, put parentheses around them: +

      Numbers to Strings

      +

      When appending numbers to string, the result is always a string. The operator is the same, so be careful: If you want to add numbers and then append them to a string, put parentheses around the numbers:

      "" + 1 + 2; // "12"
       "" + ( 1 + 2 ); // "3"
      @@ -209,7 +218,7 @@ 

      Numbers to Strings

      String( 1 ) + String( 2 ); // "12"
       String( 1 + 2 ); // "3"
       
      -

      NaN and Infinity

      +

      NaN and Infinity

      Parsing something that isn't a number results in NaN. isNaN helps to detect those cases:

      parseInt( "hello", 10 ) // NaN
      @@ -226,27 +235,25 @@ 

      NaN and Infinity

      Note that NaN compares in a strange way:

      -
      NaN == NaN // false (!)
      +
      NaN === NaN // false (!)
       

      But:

      -
      Infinity == Infinity // true
      +
      Infinity === Infinity // true
       
      -

      Integer

      +

      Integer

      An integer is a plain Number type, but whenever explicitly mentioned, indicates that a non-floating-point number is expected.

      -

      Float

      +

      Float

      A float is a plain Number type, just as Integer, but whenever explicitly mentioned, indicates that a floating-point number is expected.

      -


      -

      -

      Boolean

      +

      Boolean

      A boolean in JavaScript can be either true or false:

      if ( true ) console.log( "always!" );
       if ( false ) console.log( "never!" );
       
      -

      Object

      +

      Object

      Everything in JavaScript is an object, though some are more objective (haha). The easiest way to create an object is the object literal:

      var x = {};
      @@ -259,7 +266,7 @@ 

      Object

      typeof {} // "object"
       
      -

      Dot Notation

      +

      Dot Notation

      You can write and read properties of an object using the dot notation:

      y.name // "Pete"
      @@ -267,7 +274,7 @@ 

      Dot Notation

      x.name = y.name + " Pan" // "Pete Pan" x.age = y.age + 1 // 16
      -

      Array Notation

      +

      Array Notation

      Or you write and read properties using the array notation, which allows you to dynamically choose the property:

      var operations = {
      @@ -278,7 +285,7 @@ 

      Array Notation

      operations[ operation ] // "++" operations[ "multiply" ] = "*"; // "*"
      -

      Iteration

      +

      Iteration

      Iterating over objects is easy with the for-in-loop:

      var obj = {
      @@ -289,9 +296,9 @@ 

      Iteration

      alert( "key is " + [ key ] + ", value is " + obj[ key ] ); }
      -

      Note that for-in-loop can be spoiled by extending Object.prototype (see Object.prototype is verboten) so take care when using other libraries. +

      Note that for-in-loop can be spoiled by extending Object.prototype (see Object.prototype is verboten) so take care when using other libraries.

      -

      jQuery provides a generic each function to iterate over properties of objects, as well as elements of arrays: +

      jQuery provides a generic each function to iterate over properties of objects, as well as elements of arrays:

      jQuery.each( obj, function( key, value ) {
         console.log( "key", key, "value", value );
      @@ -300,19 +307,19 @@ 

      Iteration

      The drawback is that the callback is called in the context of each value and you therefore lose the context of your own object if applicable. More on this below at Functions.

      -

      Boolean default

      +

      Boolean default

      An object, no matter if it has properties or not, never defaults to false:

      !{} // false
       !!{} // true
       
      -

      Prototype

      +

      Prototype

      All objects have a prototype property. Whenever the interpreter looks for a property, it also checks in the object's prototype if the property is not found on the object itself. jQuery uses the prototype extensively to add methods to jQuery instances. Internally, jQuery makes jQuery.fn an alias of jQuery.prototype so you can use either one (though plugin developers have standardized on fn).

      var form = $("#myform");
       console.log( form.clearForm ); // undefined
       
      -// jQuery.fn == jQuery.prototype
      +// jQuery.fn === jQuery.prototype
       jQuery.fn.clearForm = function() {
         return this.find( ":input" ).each(function() {
           this.value = "";
      @@ -325,7 +332,7 @@ 

      Prototype

      form.clearForm();
      -

      Array

      +

      Array

      Arrays in JavaScript are mutable lists with a few built-in methods. You can define arrays using the array literal:

      var x = [];
      @@ -341,7 +348,7 @@ 

      Array

      x[ 0 ] = 1;
       y[ 2 ] // 3
       
      -

      Iteration

      +

      Iteration

      An array has a length property that is useful for iteration:

      for ( var i = 0; i < a.length; i++ ) {
      @@ -360,7 +367,7 @@ 

      Iteration

      // Do something with item }
      -

      jQuery provides a generic each function to iterate over element of arrays, as well as properties of objects: +

      jQuery provides a generic each function to iterate over element of arrays, as well as properties of objects:

      var x = [ 1, 2, 3 ];
       jQuery.each( x, function( index, value ) {
      @@ -391,21 +398,24 @@ 

      Iteration

      Note: .unshift() method does not return a length property in Internet Explorer.

      -

      Boolean Default

      +

      Boolean Default

      An array, no matter if it has elements or not, never defaults to false:

      ![] // false
       !![] // true
       
      -

      Array<Type> Notation

      +

      Array<Type> Notation

      In the jQuery API you'll often find the notation of Array<Type>:

      dragPrevention    Array<String>
       

      This indicates that the method doesn't only expect an array as the argument, but also specifies the expected type. The notation is borrowed from Java 5's generics notation (or C++ templates).

      -

      PlainObject

      -

      The PlainObject type is a JavaScript object containing zero or more key-value pairs. The plain object is, in other words, an Object object. It is designated "plain" in jQuery documentation to distinguish it from other kinds of JavaScript objects: for example, null, user-defined arrays, and host objects such as document, all of which have a typeof value of "object." The jQuery.isPlainObject() method identifies whether the passed argument is a plain object or not, as demonstrated below: +

      Array-Like Object

      +

      Either a true JavaScript Array or a JavaScript Object that contains a nonnegative integer length property and index properties from 0 up to length - 1. This latter case includes array-like objects commonly encountered in web-based code such as the arguments object and the NodeList object returned by many DOM methods.

      +

      When a jQuery API accepts either plain Objects or Array-Like objects, a plain Object with a numeric length property will trigger the Array-Like behavior.

      +

      PlainObject

      +

      The PlainObject type is a JavaScript object containing zero or more key-value pairs. The plain object is, in other words, an Object object. It is designated "plain" in jQuery documentation to distinguish it from other kinds of JavaScript objects: for example, null, user-defined arrays, and host objects such as document, all of which have a typeof value of "object." The jQuery.isPlainObject() method identifies whether the passed argument is a plain object or not, as demonstrated below:

      
         var a = [];
      @@ -421,7 +431,22 @@ 

      PlainObject

      jQuery.isPlainObject( o ); // true
      -

      Function

      +

      Null

      +

      The null keyword is a JavaScript literal that is commonly used to express the absence of an intentional value.

      + +

      Date

      +

      The Date type is a JavaScript object that represents a single moment in time. Date objects are instantiated using their constructor function, which by default creates an object that represents the current date and time. +

      +
      
      +new Date();
      +
      +

      To create a Date object for an alternative date and time, pass numeric arguments in the following order: year, month, day, hour, minute, second, millisecond — although note that the month is zero-based, whereas the other arguments are one-based. The following creates a Date object representing January 1st, 2014, at 8:15. +

      +
      
      +new Date( 2014, 0, 1, 8, 15 );
      +
      + +

      Function

      A function in JavaScript can be either named or anonymous. Any function can be assigned to a variable or passed to a method, but passing member functions this way can cause them to be called in the context of another object (i.e. with a different "this" object).

      function named() {}
      @@ -430,7 +455,7 @@ 

      Function

      You see a lot of anonymous functions in jQuery code:

      $( document ).ready(function() {});
      -$( "a" ).click(function() {});
      +$( "a)" ).on( "click", function() {});
       $.ajax({
         url: "someurl.php",
         success: function() {}
      @@ -438,7 +463,7 @@ 

      Function

      The type of a function is "function".

      -

      Arguments

      +

      Arguments

      Inside a function a special variable "arguments" is always available. It's similar to an array in that it has a length property, but it lacks the built-in methods of an array. The elements of the pseudo-array are the argument of the function call.

      function log( x ) {
      @@ -451,9 +476,9 @@ 

      Arguments

      The arguments object also has a callee property, which refers to the function you're inside of. For instance:

      var awesome = function() { return arguments.callee; }
      -awesome() == awesome // true
      +awesome() === awesome // true
       
      -

      Context, Call and Apply

      +

      Context, Call and Apply

      In JavaScript, the variable "this" always refers to the current context. By default, "this" refers to the window object. Within a function this context can change, depending on how the function is called.

      All event handlers in jQuery are called with the handling element as the context. @@ -461,7 +486,7 @@

      Context, Call and Apply

      $( document ).ready(function() {
         // this refers to window.document
       });
      -$( "a" ).click(function() {
      +$( "a)" ).on( "click", function() {
         // this refers to an anchor DOM element
       });
       
      @@ -474,7 +499,7 @@

      Context, Call and Apply

      scope.call( "foobar", [ 1, 2 ] ); // "foobar", 1 scope.apply( "foobar", [ 1, 2 ] ); // "foobar", 2
      -

      Scope

      +

      Scope

      In JavaScript, all variables defined inside a function are only visible inside that function scope. Consider the following example:

      // global
      @@ -488,7 +513,7 @@ 

      Scope

      It defines a variable x in the global scope, then defines an anonymous function and executes it immediately (the additional parentheses are required for immediate execution). Inside the function another variable x is defined with a different value. It is only visible within that function and doesn't overwrite the global variable.

      -

      Closures

      +

      Closures

      Closures are created whenever a variable that is defined outside the current scope is accessed from within some inner scope. In the following example, the variable counter is visible within the create, increment, and print functions, but not outside of them.

      function create() {
      @@ -508,7 +533,7 @@ 

      Closures

      The pattern allows you to create objects with methods that operate on data that isn't visible to the outside—the very basis of object-oriented programming.

      -

      Proxy Pattern

      +

      Proxy Pattern

      Combining the above knowledge gives you as a JavaScript developer quite a lot of power. One way to combine that is to implement a proxy pattern in JavaScript, enabling the basics of aspect-oriented programming (AOP):

      (function() {
      @@ -522,10 +547,10 @@ 

      Proxy Pattern

      The above wraps its code in a function to hide the "proxied"-variable. It saves jQuery's setArray-method in a closure and overwrites it. The proxy then logs all calls to the method and delegates the call to the original. Using apply(this, arguments) guarantees that the caller won't be able to notice the difference between the original and the proxied method.

      -

      Callback

      +

      Callback

      A callback is a plain JavaScript function passed to some method as an argument or option. Some callbacks are just events, called to give the user a chance to react when a certain state is triggered. jQuery's event system uses such callbacks everywhere:

      -
      $( "body" ).click(function( event ) {
      +
      $( "body" ).on( "click", function( event ) {
         console.log( "clicked: " + event.target );
       });
       
      @@ -533,18 +558,26 @@

      Callback

      Some callbacks are required to return something, others make that return value optional. To prevent a form submission, a submit event handler can return false:

      -
      $( "#myform" ).submit(function() {
      +
      $( "#myform" ).on( "submit", function() {
         return false;
      -});
      +} );
       

      Instead of always returning false, the callback could check fields of the form for validity, and return false only when the form is invalid.

      -


      +

      Error

      +

      An instance of an Error object is thrown as an exception when a runtime error occurs. Error can also be used as base to define user custom exception classes. In JavaScript an error can be thrown as shown below: +

      +
      throw new Error( "The argument provided is incorrect" );
      +
      +

      An error can also be thrown by the engine under some circumstances. For example, when trying to access a property of null:

      -

      Selector

      -

      A selector is used in jQuery to select DOM elements from a DOM document. That document is, in most cases, the DOM document present in all browsers, but can also be an XML document received via AJAX. +

      var obj = null;
      +console.log( obj.foo() );
      +
      +

      Selector

      +

      A selector is used in jQuery to select DOM elements from a DOM document. That document is, in most cases, the DOM document present in all browsers, but can also be an XML document received via Ajax.

      -

      The selectors are a composition of CSS and custom additions. All selectors available in jQuery are documented on the Selectors API page. +

      The selectors are a composition of CSS and custom additions. All selectors available in jQuery are documented on the Selectors API page.

      There are lot of plugins that leverage jQuery's selectors in other ways. The validation plugin accepts a selector to specify a dependency, whether an input is required or not:

      @@ -559,32 +592,44 @@

      Selector

      Event

      jQuery's event system normalizes the event object according to W3C standards. The event object is guaranteed to be passed to the event handler (no checks for window.event required). It normalizes the target, relatedTarget, which, metaKey and pageX/Y properties and provides both stopPropagation() and preventDefault() methods.

      -

      Those properties are all documented, and accompanied by examples, on the Event object page. +

      Those properties are all documented, and accompanied by examples, on the Event object page.

      -

      The standard events in the Document Object Model are: blur, focus, load, resize, scroll, unload, beforeunload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, and keyup. Since the DOM event names have predefined meanings for some elements, using them for other purposes is not recommended. jQuery's event model can trigger an event by any name on an element, and it is propagated up the DOM tree to which that element belongs, if any. +

      The standard events in the Document Object Model are: blur, focus, load, resize, scroll, unload, beforeunload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, and keyup. Since the DOM event names have predefined meanings for some elements, using them for other purposes is not recommended. jQuery's event model can trigger an event by any name on an element, and it is propagated up the DOM tree to which that element belongs, if any.

      -

      Element

      -

      An element in the Document Object Model (DOM) has attributes, text and children. It provides methods to traverse the parent and children and to get access to its attributes. Due to a lot of flaws in DOM API specifications and implementations, those methods are no fun to use. jQuery provides a wrapper around those elements to help interacting with the DOM. But often enough you will be working directly with DOM elements, or see methods that (also) accept DOM elements as arguments. +

      Element

      +

      An element in the Document Object Model (DOM) can have attributes, text, and children. It provides methods to traverse the parent and children and to get access to its attributes. Due to inconsistencies in DOM API specifications and implementations, however, those methods can be a challenge to use. jQuery provides a "wrapper" around those elements to help interacting with the DOM. But sometimes you will be working directly with DOM elements, or see methods that (also) accept DOM elements as arguments.

      -

      Whenever you use jQuery's each-method, the context of your callback is set to a DOM element. That is also the case for event handlers. +

      Whenever you call jQuery's .each() method or one of its event methods on a jQuery collection, the context of the callback function — this — is set to a DOM element.

      -

      Some properties of DOM elements are quite consistent among browsers. Consider this example of a simple on-blur-validation: +

      Some properties of DOM elements are quite consistent among browsers. Consider this example of a simple onblur validation:

      -
      $( ":text" ).blur(function() {
      +
      $( "input[type='text']" ).on( "blur", function() {
         if( !this.value ) {
           alert( "Please enter some text!" );
         }
       });
       
      -

      You could replace this.value with $(this).val() to access the value of the text input via jQuery, but in that case you don't gain anything. +

      You could replace this.value with $(this).val() to access the value of the text input via jQuery, but in that case you wouldn't gain anything. +

      +

      Text

      +

      Text is a node of the Document Object Model (DOM) that represents the textual content of an element or an attribute. Consider the following code:

      -

      jQuery

      +
      <p id="target"><b>Hello</b> world</p>
      +

      If you retrieve the children of the paragraph of the example as follows: +

      +
      var children = document.getElementById( "target" ).childNodes;
      +
      +

      you obtain two children. The first one is the element representing the b tag. The second child is a text node containing the string " world". +

      +

      jQuery

      A jQuery object contains a collection of Document Object Model (DOM) elements that have been created from an HTML string or selected from a document. Since jQuery methods often use CSS selectors to match elements from a document, the set of elements in a jQuery object is often called a set of "matched elements" or "selected elements".

      The jQuery object itself behaves much like an array; it has a length property and the elements in the object can be accessed by their numeric indices [0] to [length-1]. Note that a jQuery object is not actually a Javascript Array object, so it does not have all the methods of a true Array object such as join().

      Most frequently, you will use the jQuery() function to create a jQuery object. jQuery() can also be accessed by its familiar single-character alias of $(), unless you have called jQuery.noConflict() to disable this option. Many jQuery methods return the jQuery object itself, so that method calls can be chained:

      +

      In API calls that return jQuery, the value returned will be the original jQuery object unless otherwise documented by that API. API methods such as .filter() or .not() modify their incoming set and thus return a new jQuery object. +

      $( "p" ).css( "color", "red" ).find( ".special" ).css( "color", "green" );
       

      Whenever you use a "destructive" jQuery method that potentially changes the set of elements in the jQuery object, such as .filter() or .find(), that method actually returns a new jQuery object with the resulting elements. To return to the previous jQuery object, you use the .end() method. @@ -593,29 +638,30 @@

      jQuery

      $( ".badEntry" ).css({ color: "red" });
       
      -

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

      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 W3C 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:

      -
      • W3C standard -
      • Apple (Safari) -
      • Mozilla (Firefox) -
      • Microsoft (Internet Explorer) -
      • Opera + -

        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 +

        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

        +

        Thenable

        +

        Any object that has a then method.

        Deferred Object

        -

        As of jQuery 1.5, the Deferred object provides a way to register multiple callbacks into self-managed callback queues, invoke callback queues as appropriate, and relay the success or failure state of any synchronous or asynchronous function. +

        As of jQuery 1.5, the Deferred object provides a way to register multiple callbacks into self-managed callback queues, invoke callback queues as appropriate, and relay the success or failure state of any synchronous or asynchronous function.

        Promise Object

        -

        This object provides a subset of the methods of the Deferred object (then, done, fail, always, pipe. isResolved, and isRejected) to prevent users from changing the state of the Deferred. +

        This object provides a subset of the methods of the Deferred object (then, done, fail, always, pipe, progress, state and promise) to prevent users from changing the state of the Deferred.

        Callbacks Object

        A multi-purpose object that provides a powerful way to manage callback lists. It supports adding, removing, firing, and disabling callbacks. The Callbacks object is created and returned by the $.Callbacks function and subsequently returned by most of that function's methods.

        +

        Document

        +

        A document object created by the browser's DOM parser, usually from a string representing HTML or XML.

        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.

        diff --git a/redirects.json b/redirects.json new file mode 100644 index 000000000..ba33f9ddd --- /dev/null +++ b/redirects.json @@ -0,0 +1,4 @@ +{ + "/api/": "/resources/api.xml", + "/extending-ajax/": "/jQuery.ajax/#extending-ajax" +} diff --git a/resources/events.js b/resources/events.js index e00efb363..9b01b7e6c 100644 --- a/resources/events.js +++ b/resources/events.js @@ -1,31 +1,31 @@ jQuery.print = function(message, insertionType) { - if (typeof(message) == 'object') { - var string = '{
        ', - values = [], - counter = 0; - $.each(message, function(key, value) { - if (value && value.nodeName) { - var domnode = '<' + value.nodeName.toLowerCase(); - domnode += value.className ? ' class="' + value.className + '"' : ''; - domnode += value.id ? ' id="' + value.id + '"' : ''; - domnode += '>'; - value = domnode; - } - values[counter++] = key + ': ' + value; - }); - string += values.join(',
        '); - string += '
        }'; - message = string; - } + if (typeof(message) == 'object') { + var string = '{
        ', + values = [], + counter = 0; + $.each(message, function(key, value) { + if (value && value.nodeName) { + var domnode = '<' + value.nodeName.toLowerCase(); + domnode += value.className ? ' class="' + value.className + '"' : ''; + domnode += value.id ? ' id="' + value.id + '"' : ''; + domnode += '>'; + value = domnode; + } + values[counter++] = key + ': ' + value; + }); + string += values.join(',
        '); + string += '
        }'; + message = string; + } - var $output = $('#print-output'); + var $output = $('#print-output'); - if ($output.length === 0) { - $output = $('