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/.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/.mailmap b/.mailmap index 7f902dbd8..5f931fbce 100644 --- a/.mailmap +++ b/.mailmap @@ -1,2 +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/.travis.yml b/.travis.yml deleted file mode 100644 index 8b645e421..000000000 --- a/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: node_js -node_js: - - "8" -addons: - apt: - packages: - - libxml2-utils diff --git a/Gruntfile.js b/Gruntfile.js index 05990732c..10aa18ab0 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -43,4 +43,6 @@ grunt.registerTask( "build", [ "build-xml-full" ]); +grunt.registerTask( "deploy", [ "wordpress-deploy", "deploy-redirects" ] ); + }; diff --git a/README.md b/README.md index 1141cd225..f79208030 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## Building and Deploying -To build and deploy your changes for previewing in a [`jquery-wp-content`](https://github.com/jquery/jquery-wp-content) instance, follow the [workflow instructions](https://contribute.jquery.org/web-sites/#workflow) from our documentation on [contributing to jQuery Foundation web sites](http://contribute.jquery.org/web-sites/). +To build and deploy your changes for previewing in a [`jquery-wp-content`](https://github.com/jquery/jquery-wp-content) instance, follow the [workflow instructions](https://contribute.jquery.org/web-sites/#workflow) from our documentation on [contributing to jQuery Foundation web sites](https://contribute.jquery.org/web-sites/). ### Requirements diff --git a/categories.xml b/categories.xml index b08956d96..f5963c8fd 100644 --- a/categories.xml +++ b/categories.xml @@ -37,48 +37,86 @@ - This version is no longer supported. Read more about our Version Support. +

All the aspects of the API that were deprecated in the corresponding version of jQuery.

For more information, see the jQuery 1.3 Release Notes.

]]>
- This version is no longer supported. Read more about our Version Support. +

All the aspects of the API that were deprecated in the corresponding version of jQuery.

For more information, see the jQuery 1.4 Release Notes

]]>
- This version is no longer supported. Read more about our Version Support. +

All the aspects of the API that were deprecated in the corresponding version of jQuery.

For more information, see the Release Notes/Changelog at https://blog.jquery.com/2011/11/03/jquery-1-7-released/

]]>
- This version is no longer supported. Read more about our Version Support. +

All the aspects of the API that were deprecated in the corresponding version of jQuery.

For more information, see the Release Notes/Changelog at https://blog.jquery.com/2012/08/09/jquery-1-8-released/

]]>
- This version is no longer supported. Read more about our Version Support. +

All the aspects of the API that were deprecated in the corresponding version of jQuery.

For more information, see the Release Notes/Changelog at https://blog.jquery.com/2013/01/15/jquery-1-9-final-jquery-2-0-beta-migrate-final-released/

]]>
- - + These versions are no longer supported. Read more about our Version Support. +

All the aspects of the API that were deprecated in the corresponding version of jQuery.

For more information, see the Release Notes/Changelog at https://blog.jquery.com/2013/05/24/jquery-1-10-0-and-2-0-1-released/

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

+ All the aspects of the API that were deprecated in the corresponding version of jQuery.

+

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

+ ]]>
+
+ + All the aspects of the API that were deprecated in the corresponding version of jQuery.

+

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

+ ]]>
+
+ + All the aspects of the API that were deprecated in the corresponding version of jQuery.

+

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

+ ]]>
+
+ + All the aspects of the API that were deprecated in the corresponding version of jQuery.

+

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

+ ]]>
+
+ + All the aspects of the API that were deprecated in the corresponding version of jQuery.

+

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

]]>
- - For more information, see the Release Notes/Changelog at + All the aspects of the API that were deprecated in the corresponding version of jQuery.

+

For more information, see the Release Notes/Changelog at https://blog.jquery.com/2023/05/11/jquery-3-7-0-released-staying-in-order/

]]>
- + @@ -175,15 +213,15 @@ var files = event.originalEvent.dataTransfer.files; - + Attributes category), while others set an element's style properties (also listed in the CSS category). Still others modify entire elements (or groups of elements) themselves—inserting, copying, removing, and so on. All of these methods are referred to as "setters," as they change the values of properties. - A few of these methods—such as .attr(), .html(), and .val()—also act as "getters," retrieving information from DOM elements for later use. - ]]> + A few of these methods—such as .attr(), .html(), and .val()—also act as "getters," retrieving information from DOM elements for later use. + ]]> @@ -311,138 +349,284 @@ var files = event.originalEvent.dataTransfer.files; - jQuery 1.0 Release Notes. - ]]> + Some APIs may have changed since this version was released. If using this version, find out about our version support. +

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+ jQuery 1.0 Release Notes. +
+ ]]>
- 1.0.1, 1.0.2, 1.0.3, 1.0.4. - ]]> + Some APIs may have changed since this version was released. If using this version, find out about our version support. +

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+ Release Notes: 1.0.1, 1.0.2, 1.0.3, 1.0.4. +
+ ]]>
- jQuery 1.1 Release Notes. - ]]> + Some APIs may have changed since this version was released. If using this version, find out about our version support. +

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+ jQuery 1.1 Release Notes. +
+ ]]>
- jQuery 1.1.2 Release Notes. - ]]> + Some APIs may have changed since this version was released. If using this version, find out about our version support. +

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+ jQuery 1.1.2 Release Notes. +
+ ]]>
- jQuery 1.1.3 Release Notes - ]]> + Some APIs may have changed since this version was released. If using this version, find out about our version support. +

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+ jQuery 1.1.3 Release Notes +
+ ]]>
- jQuery 1.1.4 Release Notes. - ]]> + Some APIs may have changed since this version was released. If using this version, find out about our version support. +

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+ jQuery 1.1.4 Release Notes. +
+ ]]>
- jQuery 1.2 Release Notes - ]]> + Some APIs may have changed since this version was released. If using this version, find out about our version support. +

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+ jQuery 1.2 Release Notes +
+ ]]>
- 1.2.1, 1.2.2, 1.2.3. - ]]> + Some APIs may have changed since this version was released. If using this version, find out about our version support. +

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+ Release Notes: 1.2.1, 1.2.2, 1.2.3. +
+ ]]>
- jQuery 1.2.6 Release Notes. - ]]> + Some APIs may have changed since this version was released. If using this version, find out about our version support. +

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+ jQuery 1.2.6 Release Notes. +
+ ]]>
- 1.3, 1.3.1, 1.3.2 - ]]> + Some APIs may have changed since this version was released. If using this version, find out about our version support. +

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+ Release Notes: 1.3, 1.3.1, 1.3.2 +
+ ]]>
- jQuery 1.4 Release Notes. - ]]> + Some APIs may have changed since this version was released. If using this version, find out about our version support. +

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+ jQuery 1.4 Release Notes. +
+ ]]>
- jQuery 1.4.1 Release Notes. - ]]> + Some APIs may have changed since this version was released. If using this version, find out about our version support. +

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+ jQuery 1.4.1 Release Notes. +
+ ]]>
- jQuery 1.4.2 Release Notes. - ]]> + Some APIs may have changed since this version was released. If using this version, find out about our version support. +

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+ jQuery 1.4.2 Release Notes. +
+ ]]>
- jQuery 1.4.3 Release Notes. - ]]> + Some APIs may have changed since this version was released. If using this version, find out about our version support. +

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+ jQuery 1.4.3 Release Notes. +
+ ]]>
- jQuery 1.4.4 Release Notes.]]> + Some APIs may have changed since this version was released. If using this version, find out about our version support. +

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+ jQuery 1.4.4 Release Notes. +
+ ]]>
Some APIs may have changed since this version was released. If using this version, find out about our version support.

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

-

jQuery 1.5 also includes a large rewrite of the Ajax module, which has a number of extensibility improvements. You can find out more about those improvements in the Extending Ajax documentation.

-

Additionally jQuery 1.5 includes a new Deferred callback management system you can learn more about in in the Deferred Object documentation.

+

jQuery 1.5 also includes a large rewrite of the Ajax module, which has a number of extensibility improvements. You can find out more about those improvements in the Extending Ajax documentation.

+

Additionally, jQuery 1.5 includes a new Deferred callback management system you can learn more about in the Deferred Object documentation.

+
]]>
- + Some APIs may have changed since this version was released. If using this version, find out about our version support. +

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+

API changes in jQuery 1.5.1 dealt primarily with jQuery.ajax settings and jQuery.support properties.

+
+ ]]>
- + Some APIs may have changed since this version was released. If using this version, find out about our version support. +

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+
+ ]]>
Aspects of the API that were changed in the corresponding version of jQuery. API changes in jQuery 1.7.0 dealt primarily with the new - Event APIs: .on() and .off() - Better Support for HTML5 in IE6/7/8 - jQuery.Callbacks() - Toggling Animations Work Intuitively -

-

For more information, see the Release Notes/Changelog at https://blog.jquery.com/2011/11/03/jquery-1-7-released/

+
Some APIs may have changed since this version was released. If using this version, find out about our version support.
+

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+

jQuery 1.7.0 included:

+
    +
  • New event APIs: .on() and .off()
  • +
  • Better Support for HTML5 in IE6/7/8
  • +
  • jQuery.Callbacks()
  • +
  • Toggling Animations Work Intuitively
  • +
+

For more information, see the Release Notes/Changelog


]]>
Aspects of the API that were changed in the corresponding version of jQuery. API changes in jQuery 1.8.0 dealt primarily with animations and the removal of some methods such as deferred.isResolved(), deferred.isRejected(), $.curCSS(), $.attrFn(), and $(element).closest(Array) returning Array. -

-

For more information, see the Release Notes/Changelog at https://blog.jquery.com/2012/08/09/jquery-1-8-released/

+
Some APIs may have changed since this version was released. If using this version, find out about our version support.
+

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+

API changes in jQuery 1.8.0 dealt primarily with animations and the removal of some methods such as deferred.isResolved(), deferred.isRejected(), $.curCSS(), $.attrFn(), and $(element).closest(Array) returning Array.

+

For more information, see the Release Notes/Changelog


]]>
Aspects of the API that were changed in the corresponding version of jQuery. Changes in jQuery 1.9 dealt primarily with removal or modification of several APIs that behaved inconsistently or inefficiently in the past. A jQuery Migrate Plugin was offered to help developers with a transitional upgrade path. -

+
Some APIs may have changed since this version was released. If using this version, find out about our version support.
+

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+

Changes in jQuery 1.9 dealt primarily with removal or modification of several APIs that behaved inconsistently or inefficiently in the past.

+

A jQuery Migrate Plugin was offered to help developers with a transitional upgrade path.

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


]]>
- + + Some APIs may have changed since these versions were released. If using either version, find out about our version support. +

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+

Changes in jQuery 1.10 and 2.0 include a new `wrap` module, relaxing HTML parsing, and aligning the 1.x & 2.x lines.

+

For more information, see the 2.0 Release Notes/Changelog and 1.10.0/2.0.1 Release Notes/Changelog.

+
+ ]]>
+
+ Aspects of the API that were changed in the corresponding versions of jQuery. Changes in jQuery 1.12 and 2.2 includes performance improvements of the selector engine, manipulation of class names for SVG elements, support for the Symbol type and iterators added in ES2015, and a new hook has been added for filtering HTML. A jQuery Migrate Plugin was offered to help developers with a transitional upgrade path. -

-

For more information, see the Release Notes/Changelog

+
Some APIs may have changed since these versions were released. If using either version, find out about our version support.
+

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+

Changes in jQuery 1.11 and 2.1 include lower startup overhead & fewer forced layouts; jQuery is now authored via AMD and published to npm & bower under the name jquery.

+

For more information, see the Release Notes/Changelog.

+
+ ]]>
+
+ + Some APIs may have changed since these versions were released. If using either version, find out about our version support. +

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+

Changes in jQuery 1.12 and 2.2 include performance improvements of the selector engine, manipulation of class names for SVG elements, support for the Symbol type and iterators added in ES2015, and a new hook has been added for filtering HTML.

+

For more information, see the Release Notes/Changelog.


]]>
Aspects of the API that were changed in the corresponding version of jQuery. Changes in jQuery 3.0 dealt primarily with deferreds, data, show/hide and removal of some deprecated APIs. A jQuery Migrate Plugin was offered to help developers with a transitional upgrade path. -

-

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

+

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+

Changes in jQuery 3.0 dealt primarily with deferreds, data, show/hide and removal of some deprecated APIs. A jQuery Migrate Plugin was offered to help developers with a transitional upgrade path.

+

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


]]>
jQuery.readyException was added.

+

All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+

Version 3.1 added the jQuery.readyException API.

+

For more information, see the Release Notes/Changelog.

+
+ ]]>
+
+ + All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+

Version 3.2 added support for custom CSS properties, made .contents() work on the <template> element & made .width() & .height() ignore CSS transforms. A few APIs were deprecated. The deprecated module was added back to the slim build.

+

For more information, see the Release Notes/Changelog.

+
+ ]]>
+
+ + All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+

.addClass(), .removeClass() & .toggleClass() now work on arrays of classes; a few APIs were deprecated.

+

For more information, see the Release Notes/Changelog.

+
+ ]]>
+
+ + All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+

nonce & nomodule attributes are now preserved during script manipulation, layout thrashing was eliminated in some cases in .width() & .height() APIs. Radio elements state is now updated before event handlers run. Passing data now works when triggering all events, including focus. A minor security fix is also included.

+

For more information, see the Release Notes/Changelog.

+
+ ]]>
+
+ + All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+

Security fixes, including a breaking change to jQuery.htmlPrefilter; new .even() & .odd() methods; jQuery.globalEval now accepts context; unsuccessful HTTP script responses are no longer evaluated; performance improvements. jQuery.trim is now deprecated. A jQuery Migrate Plugin was offered to help developers with a transitional upgrade path.

+

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

+
+ ]]>
+
+ + All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+

Returning JSON even for JSONP erroneous responses is working again, a few focus fixes.

+

For more information, see the Release Notes/Changelog.

+
+ ]]>
+
+ + All the aspects of the API that were added, or had a new signature added, in the corresponding version of jQuery.

+

New .uniqueSort() method performance improvements in manipulation, fixes for .outerWidth( true ) & .outerHeight( true ) with negative margins, focus fixes.

+

As of this release, jQuery no longer relies on Sizzle.

+

Native events for focus & blur changed in IE to - respectively - focusin and focusout.

+

For more information, see the Release Notes/Changelog.

+
+ ]]>
+
+ + This is a pre-release. Behavior may change before 4.0.0 final is released. +

Aspects of the API that were changed in the corresponding version of jQuery.

+

Dropped support for IE <11 & Edge Legacy, removed deprecated APIs, added FormData support, improved support for CSP & Trusted Types. Automatic JSONP promotion removed. Special handling of boolean attributes removed.

+

Callbacks & Deferred modules are now excluded from the Slim build.

+

jQuery is now authored in ESM.

+

For more information, see the Release Notes/Changelog of jQuery 4.0.0-beta.2.


]]>
diff --git a/config-sample.json b/config-sample.json index b26cf9fce..2a56329c3 100644 --- a/config-sample.json +++ b/config-sample.json @@ -1,5 +1,5 @@ { - "url": "vagrant.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 6f1d7870e..bb95b0f0b 100644 --- a/entries/add.xml +++ b/entries/add.xml @@ -20,7 +20,7 @@ - 1.3.2 + 1.1 An existing jQuery object to add to the set of matched elements. diff --git a/entries/addClass.xml b/entries/addClass.xml index 5dd99ec56..39d6a0bf5 100644 --- a/entries/addClass.xml +++ b/entries/addClass.xml @@ -7,6 +7,12 @@ 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 @@ -16,6 +22,16 @@ + + 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.

@@ -64,7 +80,30 @@ $( "p" ).last().addClass( "selected" ); Add the classes "selected" and "highlight" to the matched elements. + + Hello

+

and

+

Goodbye

+]]> +
+ + Add the classes "selected" and "highlight" to the matched elements (3.3+ syntax). + + + diff --git a/entries/after.xml b/entries/after.xml index 210ad7c86..2ea48a9c5 100644 --- a/entries/after.xml +++ b/entries/after.xml @@ -34,7 +34,7 @@ - 1.10 + 1.10-and-2.0 A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert after 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. diff --git a/entries/ajaxComplete-shorthand.xml b/entries/ajaxComplete-shorthand.xml new file mode 100644 index 000000000..3f44abc14 --- /dev/null +++ b/entries/ajaxComplete-shorthand.xml @@ -0,0 +1,19 @@ + + + .ajaxComplete() + Register a handler to be called when Ajax requests complete. This is an AjaxEvent. + + 1.0 + + The function to be invoked. + + + +
+

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

+
+
+ + + +
diff --git a/entries/ajaxComplete.xml b/entries/ajaxComplete.xml index f96dc4cfd..0c133516f 100644 --- a/entries/ajaxComplete.xml +++ b/entries/ajaxComplete.xml @@ -1,18 +1,24 @@ - - .ajaxComplete() + + ajaxComplete event + Register a handler to be called when Ajax requests complete. This is an AjaxEvent. - 1.0 - + 1.7 + + The string "ajaxComplete". + + The function to be invoked. - Register a handler to be called when Ajax requests complete. This is an AjaxEvent. -

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

+
+

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

+
+

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

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


 <div class="trigger">Trigger</div>
@@ -21,38 +27,39 @@
     

Attach the event handler to the document:


-$( document ).ajaxComplete(function() {
+$( document ).on( "ajaxComplete", function() {
   $( ".log" ).text( "Triggered ajaxComplete 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.

All ajaxComplete handlers are invoked, regardless of what Ajax request was completed. If you must differentiate between the requests, use the parameters passed to the handler. Each time an ajaxComplete 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 ).ajaxComplete(function( event, xhr, settings ) {
+$( document ).on( "ajaxComplete", function( event, xhr, settings ) {
   if ( settings.url === "ajax/test.html" ) {
     $( ".log" ).text( "Triggered ajaxComplete handler. The result is " +
       xhr.responseText );
   }
-});
+} );
     

Note: You can get the returned Ajax contents by looking at xhr.responseText.

- - + + Show a message when an Ajax request completes. Request Complete." ); -}); +} ); ]]> +
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 19abee09f..d18cf9775 100644 --- a/entries/ajaxError.xml +++ b/entries/ajaxError.xml @@ -1,8 +1,12 @@ - - .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. @@ -11,9 +15,11 @@ - 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>
@@ -22,35 +28,37 @@
     

Attach the event handler to the document:


-$( document ).ajaxError(function() {
+$( 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.

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, thrownError ) {
+$( 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. Error requesting page " + settings.url + "" ); -}); +} ); ]]> +
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 db814fee1..cbd1641cd 100644 --- a/entries/ajaxSend.xml +++ b/entries/ajaxSend.xml @@ -1,8 +1,12 @@ - - .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. @@ -10,9 +14,11 @@ - 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>
@@ -21,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.

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. Starting request at " + settings.url + "" ); -}); +} ); ]]> +
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 bf7fc14a7..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.

- - + + 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 073dd208f..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:


-$( document ).ajaxStop(function() {
+$( 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.

- - + + 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 840ec0287..8824a6212 100644 --- a/entries/ajaxSuccess.xml +++ b/entries/ajaxSuccess.xml @@ -1,8 +1,12 @@ - - .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. @@ -11,9 +15,11 @@ - 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>
@@ -22,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.

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: " +
       xhr.responseText );
   }
-});
+} );
     

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. Successful Request!" ); -}); +} ); ]]> +
diff --git a/entries/andSelf.xml b/entries/andSelf.xml index 5adfd1aea..967c72ef5 100644 --- a/entries/andSelf.xml +++ b/entries/andSelf.xml @@ -6,72 +6,10 @@
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. - p" ).addClass( "border" ); - -// First Example -$( "div.before-andself" ).find( "p" ).addClass( "background" ); - -// Second Example -$( "div.after-andself" ).find( "p" ).andSelf().addClass( "background" ); -]]> - - -

Before andSelf()

-
-

First Paragraph

-

Second Paragraph

-
- -
-

After andSelf()

-
-

First Paragraph

-

Second Paragraph

-
-
-]]> -
diff --git a/entries/animate.xml b/entries/animate.xml index 97cac6162..c4ac9e70f 100644 --- a/entries/animate.xml +++ b/entries/animate.xml @@ -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",
@@ -101,7 +101,7 @@ $( "li" ).animate({
     

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" ],
@@ -113,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"
@@ -137,7 +137,7 @@ $( "#clickme" ).click(function() {
     
     Animates a div's left property with a relative value. Click several times on the buttons to see the relative animations queued up.
     
@@ -191,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.
     
     Animates the first div's left property and synchronizes the remaining divs, using the step function to set their left properties at each stage of the animation. 
     
     Change the color of any div that is animated.
     

If there is more than one target element, however, cloned copies of the inserted element will be created for each target except the last, and that new set (the original element plus clones) is returned.

-

Before jQuery 1.9, the append-to-single-element case did not create a new set, but instead returned the original set which made it difficult to use the .end() method reliably when being used with an unknown number of elements.

+

Before jQuery 1.9, the append-to-single-element case did not create a new set, but instead returned the original set which made it difficult to use the .end() method reliably when being used with an unknown number of elements.

diff --git a/entries/attr.xml b/entries/attr.xml index 2dc8a25e6..ac3e5a1bb 100644 --- a/entries/attr.xml +++ b/entries/attr.xml @@ -26,7 +26,7 @@

Attributes vs. Properties

The difference between attributes and properties can be important in specific situations. Before jQuery 1.6, the .attr() method sometimes took property values into account when retrieving some attributes, which could cause inconsistent behavior. As of jQuery 1.6, the .prop() method provides a way to explicitly retrieve property values, while .attr() retrieves attributes.

For example, selectedIndex, tagName, nodeName, nodeType, ownerDocument, defaultChecked, and defaultSelected should be retrieved and set with the .prop() method. Prior to jQuery 1.6, these properties were retrievable with the .attr() method, but this was not within the scope of attr. These do not have corresponding attributes and are only properties.

-

Concerning boolean attributes, consider a DOM element defined by the HTML markup <input type="checkbox" checked="checked" />, and assume it is in a JavaScript variable named elem:

+

Concerning boolean attributes, consider a DOM element defined by the HTML markup <input type="checkbox" checked="" />, and assume it is in a JavaScript variable named elem:

- + - + - + - - - -
@@ -44,21 +44,21 @@ elem.getAttribute( "checked" ) "checked" (String) Initial state of the checkbox; does not change"" (String) Initial state of the checkbox; does not change
$( elem ).attr( "checked" ) - (1.6) + (4.0+) "checked" (String) Initial state of the checkbox; does not change"" (String) Initial state of the checkbox; does not change
$( elem ).attr( "checked" ) - (1.6.1+) + (1.6-3.x) "checked" (String) Will change with checkbox state"checked" (String) Initial state of the checkbox; does not change
@@ -89,13 +89,13 @@ Display the checked attribute and property of a checkbox as it changes. " + $input.attr( "checked" ) + "
" + ".prop( 'checked' ): " + $input.prop( "checked" ) + "
" + ".is( ':checked' ): " + $input.is( ":checked" ) + "" ); - }) - .change(); + } ) + .trigger( "change" ); ]]>
+ @@ -149,7 +150,8 @@ The title of the emphasis is:
- A value to set for the attribute. If null, the specified attribute will be removed (as in .removeAttr()). + + A value to set for the attribute. If null, the specified attribute will be removed (as in .removeAttr()). Non-ARIA attributes can also be removed by passing false.
@@ -169,7 +171,7 @@ The title of the emphasis is:
- +
@@ -195,6 +197,11 @@ $( "#greatphoto" ).attr({ });

When setting multiple attributes, the quotes around attribute names are optional.

+

Removing an attribute

+

To remove an attribute, either call .attr( name, null ) or use .removeAttr( name ). For non-ARIA attributes, in jQuery 4.0+ you can also call .attr( name, false ).

+
+

Note: Because ARIA attributes frequently associate behavior with "false" values that differs from attribute absence, passing false as the value for an attribute whose name starts with "aria-…" will stringify that value to "false" rather than remove the attribute. To guarantee removal of an attribute, use the .removeAttr() method or provide null as the value to the .attr() setter.

+

WARNING: When setting the 'class' attribute, you must always use quotes!

Note: Attempting to change the type attribute on an input or button element created via document.createElement() will throw an exception on Internet Explorer 8 or older.

@@ -280,5 +287,6 @@ $( "img" ).attr( "src", function() { + diff --git a/entries/before.xml b/entries/before.xml index 1a1fcdeab..577f588b0 100644 --- a/entries/before.xml +++ b/entries/before.xml @@ -35,7 +35,7 @@ - 1.10 + 1.10-and-2.0 diff --git a/entries/bind.xml b/entries/bind.xml index 150c645ba..aa45c4551 100644 --- a/entries/bind.xml +++ b/entries/bind.xml @@ -37,7 +37,7 @@

As of jQuery 3.0, .bind() has been deprecated. It was superseded by the .on() method for attaching event handlers to a document since jQuery 1.7, so its use was already discouraged. For earlier versions, the .bind() method is used for attaching an event handler directly to elements. Handlers are attached to the currently selected elements in the jQuery object, so those elements must exist at the point the call to .bind() occurs. For more flexible event binding, see the discussion of event delegation in .on().

Any string is legal for eventType; if the string is not the name of a native DOM event, then the handler is bound to a custom event. These events are never called by the browser, but may be triggered manually from other JavaScript code using .trigger() or .triggerHandler().

If the eventType string contains a period (.) character, then the event is namespaced. The period character separates the event from its namespace. For example, in the call .bind( "click.name", handler ), the string click is the event type, and the string name is the namespace. Namespacing allows us to unbind or trigger some events of a type without affecting others. See the discussion of .unbind() for more information.

-

There are shorthand methods for some standard browser events such as .click() that can be used to attach or trigger event handlers. For a complete list of shorthand methods, see the events category.

+

Some events have dedicated pages, describing specifics of their usage. For a complete list of those events, see the events category.

When an event reaches an element, all handlers bound to that event type for the element are fired. If there are multiple handlers registered, they will always execute in the order in which they were bound. After all handlers have executed, the event continues along the normal event propagation path.

A basic usage of .bind() is:


@@ -221,7 +221,7 @@ $( "p" ).bind( "myCustomEvent", function( e, myName, myValue ) {
     .fadeIn( 30 )
     .fadeOut( 1000 );
   });
-$( "button" ).click(function() {
+$( "button" ).on( "click", function() {
   $( "p" ).trigger( "myCustomEvent", [ "John" ] );
 });
 ]]>
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 11afbd6ab..68636a0ce 100644 --- a/entries/blur.xml +++ b/entries/blur.xml @@ -1,16 +1,15 @@ - - .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. @@ -19,11 +18,10 @@ - - 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:


@@ -34,33 +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() + Bind an event handler to the "change" 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 .change( handler ) or .change( eventData, handler ), use .on( "change", handler ) or .on( "change", eventData, handler ), respectively.

+

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

+
+
+ + + + +
diff --git a/entries/change.xml b/entries/change.xml index 67d521d93..e179c5061 100644 --- a/entries/change.xml +++ b/entries/change.xml @@ -1,16 +1,15 @@ - - .change() - Bind an event handler to the "change" JavaScript event, or trigger that event on an element. + +Bind an event handler to the "change" event, or trigger that event on an element. + + + change event + Bind an event handler to the "change" event. - 1.0 - - A function to execute each time the event is triggered. - + 1.7 + + The string "change". - - - 1.4.3 An object containing data that will be passed to the event handler. @@ -19,11 +18,10 @@ - - 1.0 - -

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

+
+

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

+

The change event is sent to an element when its value changes. This event is limited to <input> elements, <textarea> boxes and <select> elements. For select boxes, checkboxes, and radio buttons, the event is fired immediately when the user makes a selection with the mouse, but for the other element types the event is deferred until the element loses focus.

For example, consider the HTML:


@@ -40,35 +38,34 @@
     

The event handler can be bound to the text input and the select box:


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

Now when the second option is selected from the dropdown, the alert is displayed. It is also displayed if you change the text in the field and then click away. If the field loses focus without the contents having changed, though, the event is not triggered. To trigger the event manually, apply .change() without arguments:

+

Now when the second option is selected from the dropdown, the alert is displayed. It is also displayed if you change the text in the field and then click away. If the field loses focus without the contents having changed, though, the event is not triggered. To trigger the event manually, use .trigger( "change" ):


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

After this code executes, clicks on Trigger the handler will also alert the message. The message will display twice, because the handler has been bound to the change event on both of the form elements.

As of jQuery 1.4, the change event bubbles in Internet Explorer, behaving consistently with the event in other modern browsers.

-

Note: Changing the value of an input element using JavaScript, using .val() for example, won't fire the event.

+

Note: Changing the value of an input element using JavaScript, using .val() for example, won't fire the event.

- 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. To add a validity test to all text input elements: - + +
+ + + 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(); -}); +} ); ]]> Find all children of the clicked element. Empty the queue. + + .click() + Bind an event handler to the "click" 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 .click( handler ) or .click( eventData, handler ), use .on( "click", handler ) or .on( "click", eventData, handler ), respectively.

+

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

+
+
+ + + + +
diff --git a/entries/click.xml b/entries/click.xml index 56475da4f..c5f9deb2b 100644 --- a/entries/click.xml +++ b/entries/click.xml @@ -1,16 +1,15 @@ - - .click() - Bind an event handler to the "click" JavaScript event, or trigger that event on an element. + + +Bind an event handler to the "click" event, or trigger that event on an element. + + click event + Bind an event handler to the "click" event. - 1.0 - - A function to execute each time the event is triggered. - + 1.7 + + The string "click". - - - 1.4.3 An object containing data that will be passed to the event handler. @@ -19,12 +18,11 @@ - - 1.0 - -

This method is a shortcut for .on( "click", handler ) in the first two variations, and .trigger( "click" ) in the third. - The click event is sent to an element when the mouse pointer is over the element, and the mouse button is pressed and released. Any HTML element can receive this event. +

+

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

+
+

The click event is sent to an element when the mouse pointer is over the element, and the mouse button is pressed and released. Any HTML element can receive this event. For example, consider the HTML:


 <div id="target">
@@ -40,19 +38,19 @@
     
     

The event handler can be bound to any <div>:


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

Now if we click on this element, the alert is displayed:

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

We can also trigger the event when a different element is clicked:


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

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

The click event is only triggered after this exact series of events:

@@ -62,13 +60,12 @@ $( "#other" ).click(function() {

This is usually the desired sequence before taking an action. If this is not required, the mousedown or mouseup event may be more suitable.

- Hide paragraphs on a page when they are clicked: - 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/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 70188f7bd..6cfa73bae 100644 --- a/entries/contents.xml +++ b/entries/contents.xml @@ -8,6 +8,7 @@

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

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

+

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

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


 <div class="container">
@@ -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. @@ -55,9 +56,10 @@ $( "p" ) $( "#frameDemo" ).contents().find( "a" ).css( "background-color", "#BADA55" ); ]]>
+ ]]> + diff --git a/entries/context.xml b/entries/context.xml index 5fc5362a7..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,13 +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 index a3645ef70..63d9c179c 100644 --- a/entries/contextmenu.xml +++ b/entries/contextmenu.xml @@ -1,7 +1,10 @@ - - .contextmenu() - Bind an event handler to the "contextmenu" JavaScript event, or trigger that event on an element. + +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 @@ -19,12 +22,11 @@ - - 1.0 - -

    This method is a shortcut for .on( "contextmenu", handler ) in the first two variations, and .trigger( "contextmenu" ) in the third. - 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. +

    +

    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">
    @@ -33,35 +35,34 @@
         

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

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

    Now right-clicking on this element displays the alert:

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

    -

    To trigger the event manually, call .contextmenu() without an argument:

    +

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

    
    -$( "#target" ).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 34fc7237c..85a304e82 100644 --- a/entries/css.xml +++ b/entries/css.xml @@ -19,15 +19,16 @@

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

    +

    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. " + color + "." ); @@ -53,7 +54,7 @@ $( "div" ).click(function() { Get the width, height, text color, and background color of a clicked div. + +
    @@ -128,7 +131,7 @@ $( "div" ).click(function() { 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. - + @@ -144,9 +147,17 @@ $( "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 a number is passed as the value, jQuery will convert it to a string and add px to the end of that string. 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 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() ignores !important declarations. So, the statement $( "p" ).css( "color", "red !important" ) does not turn the color of all paragraphs in the page to red. It's strongly advised to use classes instead; otherwise use a jQuery plugin.

    +

    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:

    @@ -157,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. @@ -282,5 +294,7 @@ $( "div" ).on( "click", function() { + +
    diff --git a/entries/data.xml b/entries/data.xml index a8ff396c7..d998d38c7 100644 --- a/entries/data.xml +++ b/entries/data.xml @@ -24,14 +24,14 @@

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

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

    In jQuery 1.4.3 setting an element's data object with .data(obj) extends the data previously stored with that element.

    -

    Prior to jQuery 1.4.3 (starting in jQuery 1.4) the .data() method completely replaced all data, instead of just extending the data object. If you are using third-party plugins it may not be advisable to completely replace the element's data object, since plugins may have also set data.

    -

    jQuery 3 changes the behavior of this method to align it to the Dataset API specifications. Specifically, jQuery 3 transforms every two-character sequence of "-" (U+002D) followed by a lowercase ASCII letter by the uppercase version of the letter as per definition of the algorithm of the Dataset API. Writing a statement like $( "body" ).data( { "my-name": "aValue" } ).data(); will return { myName: "aValue" }.

    +

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

    +

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

    +

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

    Due to the way browsers interact with plugins and external code, the .data() method cannot be used on <object> (unless it's a Flash plugin), <applet> or <embed> elements.

    @@ -40,8 +40,8 @@ $( "body" ).data(); // { foo: 52, bar: { myType: "test", count: 40 }, baz: [ 1, Store then retrieve a value from the div element. 1.4 - Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. + Return arbitrary data associated with the first element in the jQuery collection, as set by data() or by an HTML5 data-* attribute. -

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

    +

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

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

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

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

    jQuery 3 changes the behavior of this method to align it to the Dataset API specifications. Specifically, jQuery 3 transforms every two-character sequence of "-" (U+002D) followed by a lowercase ASCII letter by the uppercase version of the letter as per definition of the algorithm of the Dataset API. Writing a statement like $( "body" ).data( { "my-name": "aValue" } ).data(); will return { myName: "aValue" }.

    +

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

    +

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

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

    -

    As of jQuery 1.4.3 HTML 5 data- attributes will be automatically pulled in to jQuery's data object. The treatment of attributes with embedded dashes was changed in jQuery 1.6 to conform to the W3C HTML5 specification.

    +

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

    +

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

    +

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

    +

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

    For example, given the following HTML:

    <div data-role="page" data-last-value="43" data-hidden="true" data-options='{"name":"John"}'></div>
    -

    All of the following jQuery code will work.

    +

    The following comparisons are all true:

    
     $( "div" ).data( "role" ) === "page";
     $( "div" ).data( "lastValue" ) === 43;
     $( "div" ).data( "hidden" ) === true;
     $( "div" ).data( "options" ).name === "John";
           
    -

    The second statement of the code above correctly refers to the data-last-value attribute of the element. In case no data is stored with the passed key, jQuery searches among the attributes of the element, converting a camel-cased string into a dashed string and then prepending data- to the result. So, the string lastValue is converted to data-last-value.

    -

    Every attempt is made to convert the string to a JavaScript value (this includes booleans, numbers, objects, arrays, and null). A value is only converted to a number if doing so doesn't change the value's representation. For example, "1E02" and "100.000" are equivalent as numbers (numeric value 100) but converting them would alter their representation so they are left as strings. The string value "100" is converted to the number 100.

    -

    When the data attribute is an object (starts with '{') or array (starts with '[') then jQuery.parseJSON is used to parse the string; it must follow valid JSON syntax including quoted property names. If the value isn't parseable as a JavaScript value, it is left as a string.

    -

    To retrieve the value's attribute as a string without any attempt to convert it, use the attr() method.

    -

    The data- attributes are pulled in the first time the data property is accessed and then are no longer accessed or mutated (all data values are then stored internally in jQuery).

    -

    Calling .data() with no parameters retrieves all of the values as a JavaScript object. This object can be safely cached in a variable as long as a new object is not set with .data(obj). Using the object directly to get or set values is faster than making individual calls to .data() to get or set each value:

    -
    
    -var mydata = $( "#mydiv" ).data();
    -if ( mydata.count < 9 ) {
    -  mydata.count = 43;
    -  mydata.status = "embiggened";
    -}
    -    
    Get the data named "blah" stored at for an element. + + .dblclick() + Bind an event handler to the "dblclick" 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 .dblclick( handler ) or .dblclick( eventData, handler ), use .on( "dblclick", handler ) or .on( "dblclick", eventData, handler ), respectively.

    +

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

    +
    +
    + + + + +
    diff --git a/entries/dblclick.xml b/entries/dblclick.xml index c5ffe14b0..9c4cf59a0 100644 --- a/entries/dblclick.xml +++ b/entries/dblclick.xml @@ -1,16 +1,15 @@ - - .dblclick() - Bind an event handler to the "dblclick" JavaScript event, or trigger that event on an element. + + +Bind an event handler to the "dblclick" event, or trigger that event on an element. + + dblclick event + Bind an event handler to the "dblclick" event. - 1.0 - - A function to execute each time the event is triggered. - + 1.7 + + The string "dblclick". - - - 1.4.3 An object containing data that will be passed to the event handler. @@ -19,12 +18,11 @@ - - 1.0 - -

    This method is a shortcut for .on( "dblclick", handler ) in the first two variations, and .trigger( "dblclick" ) in the third. - The dblclick event is sent to an element when the element is double-clicked. Any HTML element can receive this event. +

    +

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

    +
    +

    The dblclick event is sent to an element when the element is double-clicked. Any HTML element can receive this event. For example, consider the HTML:

    
     <div id="target">
    @@ -40,19 +38,19 @@
         
         

    The event handler can be bound to any <div>:

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

    Now double-clicking on this element displays the alert:

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

    -

    To trigger the event manually, call .dblclick() without an argument:

    +

    To trigger the event manually, call .trigger( "dblclick" ):

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

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

    The dblclick event is only triggered after this exact series of events:

    @@ -65,22 +63,21 @@ $( "#other" ).click(function() {

    It is inadvisable to bind handlers to both the click and dblclick events for the same element. The sequence of events triggered varies from browser to browser, with some receiving two click events before the dblclick and others only one. Double-click sensitivity (maximum time between clicks that is detected as a double click) can vary by operating system and browser, and is often user-configurable.

    - To bind a "Hello World!" alert box to the dblclick event on every paragraph on the page: Double click to toggle background color. - + + + + + dblclick event + Trigger the "dblclick" event on an element. + + 1.0 + + The string "dblclick". + + + +

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

    +
    + +
    + + diff --git a/entries/deferred.catch.xml b/entries/deferred.catch.xml index 17df8dda7..e6e3d95aa 100644 --- a/entries/deferred.catch.xml +++ b/entries/deferred.catch.xml @@ -15,7 +15,7 @@

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

    - Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can rejection handlers using the .catch method. + Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can add rejection handlers using the .catch method. 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 b59413220..9c046e5ae 100644 --- a/entries/deferred.isResolved.xml +++ b/entries/deferred.isResolved.xml @@ -6,7 +6,9 @@ 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.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/delay.xml b/entries/delay.xml index c94b2a0b1..b2066217d 100644 --- a/entries/delay.xml +++ b/entries/delay.xml @@ -21,7 +21,7 @@ $( "#foo" ).slideUp( 300 ).delay( 800 ).fadeIn( 400 );

    When this statement is executed, the element slides up for 300 milliseconds and then pauses for 800 milliseconds before fading in for 400 milliseconds.

    - The .delay() method is best for delaying between queued jQuery effects. Because it is limited—it doesn't, for example, offer a way to cancel the delay—.delay() is not a replacement for JavaScript's native setTimeout function, which may be more appropriate for certain use cases. + The .delay() method is best for delaying between queued jQuery effects. Because it is limited—it doesn't, for example, offer a way to cancel the delay—.delay() is not a replacement for JavaScript's native setTimeout function, which may be more appropriate for certain use cases.

    @@ -44,7 +44,7 @@ $( "#foo" ).slideUp( 300 ).delay( 800 ).fadeIn( 400 ); } ]]>
    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. Detach all paragraphs from the DOM +
    +

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

    +

    Any handler that has been attached with .live() can be removed with .die(). This method is analogous to calling .off() with no arguments, which is used to remove all handlers attached with .on(). See the discussions of .live() and .off() for further details.

    If used without an argument, .die() removes all event handlers previously attached using .live() from the elements.

    diff --git a/entries/each.xml b/entries/each.xml index 9a882fb2a..fd2db6483 100644 --- a/entries/each.xml +++ b/entries/each.xml @@ -6,7 +6,7 @@ A function to execute for each matched element. - + Iterate over a jQuery object, executing a function for each matched element. @@ -46,15 +46,15 @@ $( "li" ).addClass( "bar" ); Iterate over three divs and sets their color property. To access a jQuery object instead of the regular DOM element, use $( this ). For example: (click here to change) Use return false to break out of each() loops early. Removes all child nodes (including text nodes) from all paragraphs - + :eq() Selector :eq(index) @@ -17,6 +17,9 @@ Select the element at index n within the matched set. +
    +

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

    +

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

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

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

    @@ -92,4 +95,5 @@ $( "li:eq(-2)" ).addClass( "foo" ) +
    diff --git a/entries/error-shorthand.xml b/entries/error-shorthand.xml new file mode 100644 index 000000000..b40d9b755 --- /dev/null +++ b/entries/error-shorthand.xml @@ -0,0 +1,37 @@ + + + .error() + Bind an event handler to the "error" 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 .error( handler ) or .error( eventData, handler ), use .on( "error", handler ) or .on( "error", eventData, handler ), respectively.

    +

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

    +
    +
    + + + + + +
    diff --git a/entries/error.xml b/entries/error.xml index 6f646aa23..d1f9493ea 100644 --- a/entries/error.xml +++ b/entries/error.xml @@ -1,16 +1,15 @@ - - .error() - Bind an event handler to the "error" JavaScript event. + +Bind an event handler to the "error" event, or trigger that event on an element. + + + error event + Bind an event handler to the "error" event. - 1.0 - - A function to execute when the event is triggered. - + 1.7 + + The string "error". - - - 1.4.3 An object containing data that will be passed to the event handler. @@ -20,8 +19,9 @@
    -

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

    -

    As of jQuery 1.8, the .error() method is deprecated. Use .on( "error", handler ) to attach event handlers to the error event instead.

    +
    +

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

    +

    The error event is sent to elements, such as images, that are referenced by a document and loaded by the browser. It is called if the element was not loaded correctly.

    For example, consider a page with a simple image element:

    
    @@ -30,35 +30,50 @@
         

    The event handler can be bound to the image:

    
     $( "#book" )
    -  .error(function() {
    -    alert( "Handler for .error() called." )
    -  })
    +  .on( "error", function() {
    +    alert( "Handler for `error` called." )
    +  } )
       .attr( "src", "missing.png" );
         

    If the image cannot be loaded (for example, because it is not present at the supplied URL), the alert is displayed:

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

    The event handler must be attached before the browser fires the error event, which is why the example sets the src attribute after attaching the handler. Also, the error event may not be correctly fired when the page is served locally; error relies on HTTP status codes and will generally not be triggered if the URL uses the file: protocol.

    Note: A jQuery error event handler should not be attached to the window object. The browser fires the window's error event when a script error occurs. However, the window error event receives different arguments and has different return value requirements than conventional event handlers. Use window.onerror instead.

    - - To replace all the missing images with another, you can update the src attribute inside the callback passed to .error(). Be sure that the replacement image exists; otherwise the error event will be triggered indefinitely. + To replace all the missing images with another, you can update the src attribute inside the error handler. Be sure that the replacement image exists; otherwise the error event will be triggered indefinitely. - - - + + + + + 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. + + + +
  • Look:
  • +
  • This is some text in a list.
  • +
  • This is a note about it.
  • +
  • This is another note about it.
  • + +]]> +
    + + +
    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. " + msg + "
    " ); } -$( "button" ).click(function( event ) { +$( "button" ).on( "click", function( event ) { immediatePropStopped( event ); event.stopImmediatePropagation(); immediatePropStopped( event ); diff --git a/entries/event.isPropagationStopped.xml b/entries/event.isPropagationStopped.xml index 26a85b760..c6c270b4d 100644 --- a/entries/event.isPropagationStopped.xml +++ b/entries/event.isPropagationStopped.xml @@ -21,11 +21,11 @@ function propStopped( event ) { $( "#stop-log" ).append( "
    " + msg + "
    " ); } -$( "button" ).click(function(event) { +$( "button" ).on( "click", function( event ) { propStopped( event ); event.stopPropagation(); propStopped( event ); -}); +} ); ]]>
    click me diff --git a/entries/event.metaKey.xml b/entries/event.metaKey.xml index f27b6e463..0c00d6b9b 100644 --- a/entries/event.metaKey.xml +++ b/entries/event.metaKey.xml @@ -26,7 +26,7 @@
    ]]> 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 ac534fcbc..82b4e1047 100644 --- a/entries/event.preventDefault.xml +++ b/entries/event.preventDefault.xml @@ -11,7 +11,7 @@ Cancel the default action (navigation) of the click. " ) .append( "default " + event.type + " prevented" ) 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 e5b53eba9..dd86bd7cc 100644 --- a/entries/event.stopImmediatePropagation.xml +++ b/entries/event.stopImmediatePropagation.xml @@ -25,14 +25,14 @@ } ]]>
    Kill the bubbling on the click event. Display the tag's name on click @@ -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.timeStamp.xml b/entries/event.timeStamp.xml index f63b62cea..089997ba7 100644 --- a/entries/event.timeStamp.xml +++ b/entries/event.timeStamp.xml @@ -22,7 +22,7 @@ ]]> " ); diff --git a/entries/event.type.xml b/entries/event.type.xml index 8bde75591..a51cc1c85 100644 --- a/entries/event.type.xml +++ b/entries/event.type.xml @@ -9,7 +9,7 @@ On all anchor clicks, alert the event type. diff --git a/entries/event.which.xml b/entries/event.which.xml index 1d36d5277..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 MDN.

    +

    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.

    diff --git a/entries/fadeIn.xml b/entries/fadeIn.xml index 0f4b6888b..1975c039c 100644 --- a/entries/fadeIn.xml +++ b/entries/fadeIn.xml @@ -29,7 +29,7 @@ <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 }); @@ -52,9 +52,9 @@ $( "#clickme" ).click(function() { Animates hidden divs to fade in one by one, completing each animation within 600 milliseconds. Fades a red block in over the text. Once the animation is done, it quickly fades in more text on top.

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

    
    -$( "#clickme" ).click(function() {
    +$( "#clickme" ).on( "click", function() {
       $( "#book" ).fadeOut( "slow", function() {
         // Animation complete.
       });
    @@ -56,7 +56,7 @@ $( "#clickme" ).click(function() {
       
         Animates all paragraphs to fade out, completing the animation within 600 milliseconds.
         
    @@ -76,7 +76,7 @@ $( "p" ).click(function() {
       
         Fades out spans in one section that you click on.
         
         Fades out two divs, one with a "linear" easing and one with the default, "swing," easing.
         " ).text( this.id ).appendTo( "#log" );
       }
    @@ -121,7 +121,7 @@ $( "#btn1" ).click(function() {
       $( "#box2" ).fadeOut( 1600, complete );
     });
     
    -$( "#btn2" ).click(function() {
    +$( "#btn2" ).on( "click", function() {
       $( "div" ).show();
       $( "#log" ).empty();
     });
    diff --git a/entries/fadeTo.xml b/entries/fadeTo.xml
    index 4bf38be14..c77da0d68 100644
    --- a/entries/fadeTo.xml
    +++ b/entries/fadeTo.xml
    @@ -44,7 +44,7 @@
     </div>
     <img id="book" src="book.png" alt="" width="100" height="123">
     // With the element initially shown, we can dim it slowly:
    -$( "#clickme" ).click(function() {
    +$( "#clickme" ).on( "click", function() {
       $( "#book" ).fadeTo( "slow" , 0.5, function() {
         // Animation complete.
       });
    @@ -63,9 +63,9 @@ $( "#clickme" ).click(function() {
       
         Animates first paragraph to fade to an opacity of 0.33 (33%, about one third visible), completing the animation within 600 milliseconds.
         
         
    @@ -80,7 +80,7 @@ Compare to this one that won't fade.
       
         Fade div to a random opacity on each click, completing the animation within 200 milliseconds.
         
    @@ -128,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"
    -          });
    -    });
    -  });
    +          } );
    +    } );
    +  } );
     ]]>
         
         Fades first paragraph in or out, completing the animation within 600 milliseconds and using a linear easing. Fades last paragraph in or out for 200 milliseconds, inserting a "finished" message upon completion. 
         finished" );
    -  });
    -});
    +  } );
    +} );
     ]]>
         fadeToggle p1
    diff --git a/entries/file-selector.xml b/entries/file-selector.xml
    index db9c7b867..c5295eca0 100644
    --- a/entries/file-selector.xml
    +++ b/entries/file-selector.xml
    @@ -13,16 +13,16 @@
       
         Finds all file inputs.
         
         

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

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

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

    +

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

    Using a Filter Function

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

    
    diff --git a/entries/find.xml b/entries/find.xml
    index c6a32e84c..fc10241bd 100644
    --- a/entries/find.xml
    +++ b/entries/find.xml
    @@ -18,7 +18,7 @@
       Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.
       
         

    Given a jQuery object that represents a set of DOM elements, the .find() method allows us to search through the descendants of these elements in the DOM tree and construct a new jQuery object from the matching elements. The .find() and .children() methods are similar, except that the latter only travels a single level down the DOM tree.

    -

    The first signature for the .find()method accepts a selector expression of the same type that we can pass to the $() function. The elements will be filtered by testing whether they match this selector. The expressions allowed include selectors like > p which will find all the paragraphs that are children of the elements in the jQuery object.

    +

    The first signature for the .find()method accepts a selector expression of the same type that we can pass to the $() function. The elements will be filtered by testing whether they match this selector; all parts of the selector must lie inside of an element on which .find() is called. The expressions allowed include selectors like > p which will find all the paragraphs that are children of the elements in the jQuery object.

    Consider a page with a basic nested list on it:

    
     <ul class="level-1">
    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 0676d85fc..1308ff5ec 100644 --- a/entries/first-selector.xml +++ b/entries/first-selector.xml @@ -1,5 +1,5 @@ - + :first Selector :first @@ -7,6 +7,9 @@ Selects the first matched DOM element. +
    +

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

    +

    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. - Look: - This is some text in a paragraph. - This is a note about it. -

    +
      +
    • Look:
    • +
    • This is some text in a list.
    • +
    • This is a note about it.
    • +
    • This is another note about it.
    • +
    ]]>
    diff --git a/entries/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 1db6b6437..c9736a295 100644 --- a/entries/focus.xml +++ b/entries/focus.xml @@ -1,16 +1,15 @@ - - .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. @@ -19,17 +18,16 @@ - - 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:

    
    @@ -43,24 +41,24 @@
         

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

    @@ -81,21 +79,41 @@ $( "input" ).focus(function() { To stop people from writing in text input boxes, try: 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 aaff429dc..7b5288f67 100644 --- a/entries/focusin.xml +++ b/entries/focusin.xml @@ -1,16 +1,15 @@ - - .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. @@ -19,15 +18,13 @@ - - 1.0 - -

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

    +
    +

    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.

    - Watch for a focus to occur within the paragraphs on the page. focusin fire

    @@ -47,6 +44,27 @@ $( "p" ).focusin(function() {
    + + + +
    + + + 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 6b633c897..7b90cb82d 100644 --- a/entries/focusout.xml +++ b/entries/focusout.xml @@ -1,16 +1,15 @@ - - .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. @@ -19,15 +18,13 @@ - - 1.0 - -

    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.

    - Watch for a loss of focus to occur inside paragraphs and note the difference between the focusout count and the blur count. (The blur count does not change because those events do not bubble.) @@ -68,6 +65,27 @@ $( "p" ) + + + +
    + + + 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 64272cf47..cb52eb2d0 100644 --- a/entries/get.xml +++ b/entries/get.xml @@ -43,10 +43,10 @@ console.log( $( "li" ).get( -1 ) ); Display the tag name of the click element. - + :gt() Selector :gt(index) @@ -17,6 +17,9 @@ Select all elements at an index greater than index within the matched set. +
    +

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

    +

    index-related selectors

    @@ -42,4 +45,5 @@ $( "td:gt(-2)" ).css( "color", "red" ); +
    diff --git a/entries/hasClass.xml b/entries/hasClass.xml index ddf5d893a..622570e93 100644 --- a/entries/hasClass.xml +++ b/entries/hasClass.xml @@ -30,8 +30,8 @@ $( "#mydiv" ).hasClass( "quux" ) Looks for the paragraph that contains 'selected' as a class.
    diff --git a/entries/hidden-selector.xml b/entries/hidden-selector.xml index e44d732bd..44b8397c6 100644 --- a/entries/hidden-selector.xml +++ b/entries/hidden-selector.xml @@ -29,9 +29,9 @@ // In some browsers :hidden includes head, title, script, etc... var hiddenElements = $( "body" ).find( ":hidden" ).not( "script" ); -$( "span:first" ).text( "Found " + hiddenElements.length + " hidden elements total." ); +$( "span" ).first().text( "Found " + hiddenElements.length + " hidden elements total." ); $( "div:hidden" ).show( 3000 ); -$( "span:last" ).text( "Found " + $( "input:hidden" ).length + " hidden inputs." ); +$( "span" ).last().text( "Found " + $( "input:hidden" ).length + " hidden inputs." ); ]]>
    
     // With the element initially shown, we can hide it slowly:
    -$( "#clickme" ).click(function() {
    +$( "#clickme" ).on( "click", function() {
       $( "#book" ).hide( "slow", function() {
         alert( "Animation complete." );
       });
    @@ -68,7 +68,7 @@ $( "#clickme" ).click(function() {
         Hides all paragraphs then the link on click.
         
         Animates all shown paragraphs to hide slowly, completing the animation within 600 milliseconds.
         
    @@ -101,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.
         
    @@ -134,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 3eb38753b..a924d368f 100644 --- a/entries/hover.xml +++ b/entries/hover.xml @@ -1,7 +1,7 @@ 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. @@ -16,12 +16,15 @@ +
    +

    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: @@ -30,7 +33,7 @@ $( "li" ).hover( function() { $( this ).append( $( " ***" ) ); }, function() { - $( this ).find( "span:last" ).remove(); + $( this ).find( "span" ).last().remove(); } ); @@ -80,8 +83,10 @@ $( "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 @@ -91,21 +96,24 @@ $( "td" ).off( "mouseenter mouseleave" ); +
    +

    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/html.xml b/entries/html.xml index b830c566b..1a29d361a 100644 --- a/entries/html.xml +++ b/entries/html.xml @@ -29,7 +29,7 @@ $( "div.demo-container" ).html(); Click a paragraph to convert it from html to text.

    Given a document with six paragraphs, this example will set the HTML of <div class="demo-container"> to <p>All new content for <em>6 paragraphs!</em></p>.

    -

    This method uses the browser's innerHTML property. Some browsers may not generate a DOM that exactly replicates the HTML source provided. For example, Internet Explorer prior to version 8 will convert all href properties on links to absolute URLs, and Internet Explorer prior to version 9 will not correctly handle HTML5 elements without the addition of a separate compatibility layer.

    +

    This method uses the browser's innerHTML property. Some browsers may not generate a DOM that exactly replicates the HTML source provided. For example, Internet Explorer prior to version 8 will convert all href properties on links to absolute URLs, and Internet Explorer prior to version 9 will not correctly handle HTML5 elements without the addition of a separate compatibility layer.

    To set the content of a <script> element, which does not contain HTML, use the .text() method and not .html().

    Note: In Internet Explorer up to and including version 9, setting the text content of an HTML element may corrupt the text nodes of its children that are being removed from the document as a result of the operation. If you are keeping references to these DOM elements and need them to be unchanged, use .empty().html( string ) instead of .html(string) so that the elements are removed from the document before the new string is assigned to the element.

    diff --git a/entries/image-selector.xml b/entries/image-selector.xml index 8af0a3515..2b569d3a8 100644 --- a/entries/image-selector.xml +++ b/entries/image-selector.xml @@ -13,16 +13,16 @@ Finds all image inputs.

    Note that if the jQuery collection used as the .index() method's argument contains more than one element, the first element within the matched set of elements will be used.

    
    -var listItems = $( "li:gt(0)" );
    +var listItems = $( "li" ).slice( 1 );
     alert( "Index: " + $( "li" ).index( listItems ) );
         

    We get back the zero-based position of the first list item within the matched set:

    @@ -81,7 +81,7 @@ alert( "Index: " + $( "#bar" ).index() ); On click, returns the index (zero-based) of that div in the page.
    Figure 1 - Illustration of the measured height - + Get the innerHeight of a paragraph. - 1.8.0 + 1.8 @@ -52,7 +52,7 @@ $( "p:last" ).text( "innerHeight:" + p.innerHeight() ); - 1.8.0 + 1.8 diff --git a/entries/innerWidth.xml b/entries/innerWidth.xml index d3641b007..54b6b3588 100644 --- a/entries/innerWidth.xml +++ b/entries/innerWidth.xml @@ -15,13 +15,13 @@
    Figure 1 - Illustration of the measured width
    - + Get the innerWidth of a paragraph. - 1.8.0 + 1.8 - - - A number representing the number of pixels, or a number along with an optional unit of measure appended (as a string). + + + A number representing the number of pixels, or a number along with an optional unit of measure appended (as a string). - 1.8.0 + 1.8 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(); -}); +} ); ]]>
    Insert every element in the set of matched elements after the target. -

    The .after() and .insertAfter() methods perform the same task. The major difference is in the syntax-specifically, in the placement of the content and target. With .after(), the selector expression preceding the method is the container after which the content is inserted. With .insertAfter(), 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 after the target container.

    +

    The .after() and .insertAfter() methods perform the same task. The major difference is in the syntax—specifically, in the placement of the content and target. With .after(), the selector expression preceding the method is the container after which the content is inserted. With .insertAfter(), 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 after the target container.

    Consider the following HTML:

    
     <div class="container">
    diff --git a/entries/is.xml b/entries/is.xml
    index 5595d26ac..e6eb2ce55 100644
    --- a/entries/is.xml
    +++ b/entries/is.xml
    @@ -13,7 +13,7 @@
           A function used as a test for every element in the set. It accepts two arguments, index, which is the element's index in the jQuery collection, and element, which is the DOM element. Within the function, this refers to the current DOM element.
           
           
    -            
    +      
         
       
       
    @@ -41,7 +41,7 @@
         

    You can attach a click handler to the <ul> element, and then limit the code to be triggered only when a list item itself, not one of its children, is clicked:

    
    -$( "ul" ).click(function( event ) {
    +$( "ul" ).on( "click", function( event ) {
       var target = $( event.target );
       if ( target.is( "li" ) ) {
         target.css( "background-color", "red" );
    @@ -49,8 +49,6 @@ $( "ul" ).click(function( event ) {
     });
         

    Now, when the user clicks on the word "list" in the first item or anywhere in the third item, the clicked list item will be given a red background. However, when the user clicks on item 1 in the first item or anywhere in the second item, nothing will occur, because in those cases the target of the event would be <strong> or <span>, respectively.

    -

    Prior to jQuery 1.7, in selector strings with positional selectors such as :first, :gt(), or :even, the positional filtering is done against the jQuery object passed to .is(), not against the containing document. So for the HTML shown above, an expression such as $( "li:first" ).is( "li:last" ) returns true, but $( "li:first-child" ).is( "li:last-child" ) returns false. In addition, a bug in Sizzle prevented many positional selectors from working properly. These two factors made positional selectors almost unusable in filters.

    -

    Starting with jQuery 1.7, selector strings with positional selectors apply the selector against the document, and then determine whether the first element of the current jQuery set matches any of the resulting elements. So for the HTML shown above, an expression such as $( "li:first" ).is( "li:last" ) returns false. Note that since positional selectors are jQuery additions and not W3C standard, we recommend using the W3C selectors whenever feasible.

    Using a Function

    The second form of this method evaluates expressions related to elements based on a function rather than a selector. For each element, if the function returns true, .is() returns true as well. For example, given a somewhat more involved HTML snippet:

    
    @@ -65,7 +63,7 @@ $( "ul" ).click(function( event ) {
         

    You can attach a click handler to every <li> that evaluates the number of <strong> elements within the clicked <li> at that time like so:

    
    -$( "li" ).click(function() {
    +$( "li" ).on( "click", function() {
       var li = $( this ),
         isWithTwo = li.is(function() {
           return $( "strong", this ).length === 2;
    @@ -179,7 +177,7 @@ $( "div" ).text( "isFormParent = " + isFormParent );
         Checks against an existing collection of alternating list elements. Blue, alternating list elements slide up while others turn red.
         An alternate way to achieve the above example using an element rather than a jQuery object. Checks against an existing collection of alternating list elements. Blue, alternating list elements slide up while others turn red.
         
    +
    +  jQuery.Deferred.exceptionHook()
    +  
    +    3.0
    +  
    +  Handle errors produced by Deferreds.
    +  
    +    

    This API is called every time an error is thrown inside Deferreds. By default, it only warns about errors that are more likely to be programmer errors than errors thrown due to application logic. This includes errors like SyntaxError or ReferenceError.

    +

    The function accepts two parameters - the first one is the error thrown and the second, optional parameter is a "fake" error created before the handler is called so that a stack trace from before an async barrier is available. This second error is only provided if jQuery.Deferred.getErrorHook is defined; see the docs for that API for more details.

    +

    Example

    +
    +
    + + +
    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.ajax.xml b/entries/jQuery.ajax.xml index 80157d286..9074388b9 100644 --- a/entries/jQuery.ajax.xml +++ b/entries/jQuery.ajax.xml @@ -84,7 +84,12 @@ $.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).

    +
    @@ -97,7 +102,7 @@ $.ajax({
    • "xml": Returns a XML document that can be processed via jQuery.
    • "html": Returns HTML as plain text; included script tags are evaluated when inserted in the DOM.
    • -
    • "script": Evaluates the response as JavaScript and returns it as plain text. Disables caching by appending a query string parameter, _=[TIMESTAMP], to the URL unless the cache option is set to true. Note: This will turn POSTs into GETs for remote-domain requests.
    • +
    • "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.
    • @@ -109,7 +114,7 @@ $.ajax({ - 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. @@ -133,7 +138,7 @@ $.ajax({ 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"). @@ -145,8 +150,11 @@ $.ajax({ By default, data passed in to the data option as an object (technically, anything other than a string) will be processed and transformed into a query string, fitting to the default content-type "application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data, set this option to false. + + Defines an object with additional attributes to be used in a "script" or "jsonp" request. The key represents the name of the attribute and the value is the attribute's value. If this object is provided it will force the use of a script-tag transport. For example, this can be used to set nonce, integrity, or crossorigin attributes to satisfy Content Security Policy requirements. + - Only applies when the "script" transport is used (e.g., cross-domain requests with "jsonp" or "script" dataType and "GET" type). Sets the charset attribute on the script tag used in the request. Used when the character set on the local page is not the same as the one on the remote script. + Only applies when the "script" transport is used. Sets the charset attribute on the script tag used in the request. Used when the character set on the local page is not the same as the one on the remote script. Alternatively, the charset attribute can be specified in scriptAttrs instead, which will also ensure the use of the "script" transport. @@ -287,7 +295,7 @@ jqxhr.always(function() { status
    • - statusText + statusText (may be an empty string in HTTP/2)
    • abort( [ statusText ] ) @@ -335,7 +343,7 @@ jqxhr.always(function() {

      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.

      +

      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.

      @@ -454,4 +462,6 @@ $.ajax({ + + diff --git a/entries/jQuery.ajaxSetup.xml b/entries/jQuery.ajaxSetup.xml index d175c54ac..b0b54447e 100644 --- a/entries/jQuery.ajaxSetup.xml +++ b/entries/jQuery.ajaxSetup.xml @@ -26,7 +26,7 @@ $.ajax({ });
    -

    Note: Global callback functions should be set with their respective global Ajax event handler methods—.ajaxStart(), .ajaxStop(), .ajaxComplete(), .ajaxError(), .ajaxSuccess(), .ajaxSend()—rather than within the options object for $.ajaxSetup().

    +

    Note: Global callback functions should be set via .on() with their respective global Ajax events—ajaxStart, ajaxStop, ajaxComplete, ajaxError, ajaxSuccess, ajaxSend—rather than within the options object for $.ajaxSetup().

    diff --git a/entries/jQuery.boxModel.xml b/entries/jQuery.boxModel.xml index ac4648503..b80abe29a 100644 --- a/entries/jQuery.boxModel.xml +++ b/entries/jQuery.boxModel.xml @@ -4,8 +4,12 @@ 1.0 - States if the current page, in the user's browser, is being rendered using the W3C CSS Box Model. This property was removed in jQuery 1.8. Please try to use feature detection instead. - + States if the current page, in the user's browser, is being rendered using the W3C CSS Box Model. + +
    +

    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 667ed5f15..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:

      @@ -56,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 19bb9054e..ec36ccfe1 100644 --- a/entries/jQuery.cssHooks.xml +++ b/entries/jQuery.cssHooks.xml @@ -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 index ce5af8867..c49b3c785 100644 --- a/entries/jQuery.cssNumber.xml +++ b/entries/jQuery.cssNumber.xml @@ -1,30 +1,50 @@ - + jQuery.cssNumber 1.4.3 - An object containing all CSS properties that may be used without a unit. The .css() method uses this object to see if it may append px to unitless values. + 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. -

    You can think about jQuery.cssNumber as a list of all CSS properties you might use without a unit. It's 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, you can add an extra property to the jQuery.cssNumber object.

    +
    +

    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:

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

    By default the object contains the following properties:

      -
    • zIndex
    • -
    • fontWeight
    • -
    • opacity
    • -
    • zoom
    • -
    • lineHeight
    • -
    • widows (added in jQuery 1.6)
    • -
    • orphans (added in jQuery 1.6)
    • -
    • fillOpacity (added in jQuery 1.6.2)
    • -
    • columnCount (added in jQuery 1.9)
    • -
    • order (added in jQuery 1.10.2)
    • -
    • flexGrow (added in jQuery 1.11.1)
    • -
    • flexShrink (added in jQuery 1.11.1)
    • +
    • 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 bc1bab43f..5207c8b89 100644 --- a/entries/jQuery.data.xml +++ b/entries/jQuery.data.xml @@ -34,8 +34,8 @@ jQuery.data( div, "test", { first: 16, last: "pizza!" }); -$( "span:first" ).text( jQuery.data( div, "test" ).first ); -$( "span:last" ).text( jQuery.data( div, "test" ).last ); +$( "span" ).first().text( jQuery.data( div, "test" ).first ); +$( "span" ).last().text( jQuery.data( div, "test" ).last ); ]]> Get the data named "blah" stored at for an element. Use jQuery.dequeue() to end a custom queue function which allows the queue to keep going. Takes a string and throws an exception containing it.

    This method exists primarily for plugin developers who wish to override it and provide a better display (or more information) for the error messages.

    +

    If you do override the method, remember to still throw an error at the end to preserve semantics.

    - Override jQuery.error for display in Firebug. + Override jQuery.error to send it to a logging service, assuming the sendErrorLog method is provided by this service. diff --git a/entries/jQuery.extend.xml b/entries/jQuery.extend.xml index b28ec2e0c..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. @@ -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,6 +41,7 @@

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

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

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

    +

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

    Warning: Passing false for the first argument is not supported.

    Undefined properties are not copied. However, properties inherited from the object's prototype will be copied over. Properties that are an object constructed via new MyCustomObject(args), or built-in JavaScript types such as Date or RegExp, are not re-constructed and will appear as plain Objects in the resulting object or array.

    On a deep extend, Object and Array are extended, but object wrappers on primitive types such as String, Boolean, and Number are not. Deep-extending a cyclical data structure will result in an error.

    @@ -106,4 +113,5 @@ $( "#log" ).append( "
    settings -- " + JSON.stringify( settings ) + "< + diff --git a/entries/jQuery.find.xml b/entries/jQuery.find.xml new file mode 100644 index 000000000..f7e3de431 --- /dev/null +++ b/entries/jQuery.find.xml @@ -0,0 +1,248 @@ + + + jQuery.find() + The jQuery selector engine, formerly known as Sizzle, is exposed under jQuery.find. This page describes all the APIs under jQuery.find. + + +

    Note

    + +

    jQuery selector engine first tries to run the passed selector — with some modifications — through native querySelectorAll, so selectors natively supported by the current browsers generally work out of the box. However, if the browser does not recognize the selector, jQuery does the whole selection on its own. Some newer selectors may not work with such a jQuery selection.

    + +

    Selectors

    + +

    CSS 3

    + +

    jQuery supports virtually all CSS 3 Selectors, including escaped selectors (.foo\+bar), Unicode selectors, and results returned in document order. The only exceptions are those that would require additional DOM event listeners to keep track of the state of elements.

    + +

    As such, the following pseudo-selectors are not supported:

    +
      +
    • :hover
    • +
    • :active
    • +
    • :visited, :link
    • +
    + +

    Note: These CSS3 pseudo-selectors were unsupported prior to version 1.9:

    +
      +
    • :target
    • +
    • :root
    • +
    • :nth-last-child
    • +
    • :nth-of-type, :nth-last-of-type, :first-of-type, :last-of-type, :only-of-type
    • +
    • :lang()
    • +
    + +

    Other selectors and conventions

    + +

    Changes

    + +
      +
    • Full selector lists in :not(); e.g. :not(a.b), :not(div > p), :not(div, p)
    • +
    • Nested pseudo-selectors; e.g. :not(:has(div:first-child))
    • +
    + +

    Additions

    + +
      +
    • [NAME!=VALUE]: Elements whose NAME attribute doesn't match the specified value. Equivalent to :not([NAME=VALUE]).
    • +
    • :contains(TEXT): Elements with textContent containing the word 'TEXT'. Case-sensitive.
    • +
    • :header: Header elements (h1, h2, h3, h4, h5, h6).
    • +
    • :parent: Elements with at least one child node (either text or an element).
    • +
    • :selected: (option) elements that are currently selected
    • +
    + +

    Form Selector Additions

    + +

    Note: In this context, input, button, select, and textarea are all considered to be input elements.

    + +
      +
    • :input: Input elements
    • +
    • :button: Input elements that are buttons or have type "button"
    • +
    • :checkbox, :file, :image, :password, :radio, :reset, :submit, :text: Input elements with the specified type
    • +
    + +

    Positional Selector Additions

    + +

    In this context, "positional" refers to an element's placement in the collection after a selection, based on document order. For example, div:first would return an array containing the first div on the page, while div:first em would target the first div on the page and select all em elements within.

    + +

    Note: Positional indexes begin at zero.

    + +
      +
    • :first/:last: The first/last matching element
    • +
    • :even/:odd: Even/odd-numbered elements
    • +
    • :eq/:nth: The nth element; e.g. :eq(5) finds the 6th element
    • +
    • :lt/:gt: Elements at positions above/below the specified position
    • +
    + +

    API

    + +

    The jQuery Selection API consists of 3 parts:

    + + + +

    Public API

    + +

    jQuery.find( String selector[, DOMNode context[, Array results]] )

    + +

    The main function for finding elements. Uses querySelectorAll if available.

    + +

    returns (Array): All elements matching the selector

    + +

    Parameters

    + +

    selector: A CSS selector

    + +

    context: An element, document, or document fragment to use as the context for finding elements. Defaults to document. + Note: Prior to version 2.1, document fragments were not valid here.

    + +

    results: An array or an array-like object, to which jQuery will append results. For example, jQuery passes a jQuery collection. An "array-like object" is an object with a nonnegative numeric length property and a push method.

    + +

    jQuery.find.matchesSelector( DOMElement element, String selector )

    + +

    Uses native matchesSelector if available

    + +

    returns(Boolean): Whether the given element matches the selector

    + +

    Parameters

    + +

    element: A DOMElement against which jQuery will test the selector

    + +

    selector: A CSS selector

    + +

    jQuery.find.matches( String selector, Array<DOMElement> elements )

    + +

    returns(Array): Elements in the array that match the given selector

    + +

    Parameters

    + +

    selector: A CSS selector

    + +

    elements: An array of DOMElements to filter against the specified selector

    + +

    Extension API

    + +

    jQuery.expr.match.NAME = RegExp

    + +

    This contains the regular expressions used to parse a selector into different parts, to be used for finding and filtering. The name of each of the regular expressions should correspond to the names specified in the jQuery.expr.find and jQuery.expr.filter objects.

    + +

    Finding

    + +

    In order to add a new find function:

    +
      +
    • A regular expression must be added to the match object.
    • +
    • A function to find must be defined.
    • +
    • "|" + NAME must be appended to the jQuery.expr.order regex.
    • +
    + +
    jQuery.expr.find.NAME = function( match, context, isXML ) {}
    + +

    A method for finding some elements on a page. The specified function will be called no more than once per selector.

    +
      +
    • match is the array of results returned from matching the specified regex against the selector.
    • +
    • context is the DOMElement or DOMDocument from which selection will occur.
    • +
    • isXML is a boolean value indicating whether the function is currently operating within an XML document.
    • +
    + +

    Filtering

    + +

    In order to add a new filtering statement:

    +
      +
    • A regular expression must be added to the match object.
    • +
    • A function must be added to the filter object.
    • +
    • A function may optionally be added to the preFilter object.
    • +
    + +
    jQuery.expr.preFilter.NAME = function( match ) {}
    + +

    An optional pre-filter function which allows filtering of the matched array against the corresponding regular expression, which will return a new matched array. This matched array will eventually be passed and flattened as arguments against the corresponding filter function. This is intended to clean up some of the repetitive processing that occurs in a filter function.

    + +
    jQuery.expr.filter.NAME: function( element, match[1][, match[2], match[3], ...] ) {}
    + +

    Note: match[0] will be deleted prior to being passed to a filter, and must not be used.

    + +

    The arguments for a filter method are the element and the captures from the regex corresponding to this filter (indicated above by what is in the match, starting at index 1). The return result must be boolean: true if the element matches the selector, false if not.

    + +

    Attributes

    + +
    jQuery.expr.attrHandle.LOWERCASE_NAME = function( elem, casePreservedName, isXML ) {}
    + +

    Handle an attribute which requires specialized processing (such as href, which has cross-browser issues). The return result must be the actual string value of that attribute.

    + +

    Pseudo-selectors (pseudos)

    + +
    jQuery.expr.pseudos.NAME = function( elem ) {}
    + +

    The most common extension to a selector engine: adding a new pseudo. The return result from this function must be boolean: true if the element matches the selector, false if not.

    + +

    For example, this defines a simple :fixed pseudo:

    +
    
    +var $test = jQuery( document );
    +jQuery.expr.pseudos.fixed = function( elem ) {
    +  $test[ 0 ] = elem;
    +  return $test.css( "position" ) === "fixed";
    +};
    +    
    + +
    jQuery.expr.createPseudo( function )
    + +

    createPseudo is only required if the custom pseudo-selector accepts an argument.

    + +

    Note: In jQuery 1.8 and earlier, the API for creating custom pseudos with arguments was broken. In jQuery 1.8.1+, the API is backwards-compatible. Regardless, the use of createPseudo is greatly encouraged.

    + +

    Now that the parser compiles a single function containing other functions, custom pseudo-selectors with arguments are much cleaner.

    + +

    For example, within jQuery, the implementation of the :not( <sub-selector> ) pseudo is very similar to:

    + +
    
    +jQuery.expr.pseudos.not =
    +  jQuery.expr.createPseudo( function( subSelector ) {
    +    var matcher = jQuery.find.compile( subSelector );
    +    return function( elem ) {
    +      return !matcher( elem );
    +    };
    +  } );
    +    
    + +
    jQuery.expr.setFilters.LOWERCASE_NAME = function( elements, argument, not ) {}
    + +

    These filters are run after a previous part of a selector has already returned results. setFilters are found from matching jQuery.expr.match.POS. When applicable, argument is expected to be an integer. The not argument is a boolean indicating whether the result should be inverted (as in div:not(:first)).

    + +

    For example, the code for the :first setFilter is similar to:

    +
    
    +var first = function( elements, argument, not ) {
    +  // No argument for first
    +  return not ? elements.slice( 1 ) : [ elements[ 0 ] ];
    +};
    +jQuery.expr.setFilters.first = first;
    +    
    + +

    It is easy to extend jQuery selection engine — even jQuery's POS selectors. For example, to rename :first as :uno:

    +
     [ 
    ] + ]]>
    + +

    Internal API

    + +

    Note: Functionality should be accessed via the Public and Extension APIs. While the Internal API is intended specifically for internal use, it has been exposed for edge cases.

    + +

    jQuery.expr.cacheLength

    + +

    jQuery internally caches compiled selector functions and tokenization objects. The length of these caches defaults to 50, but can be set to any positive integer by assigning to this property.

    + +

    jQuery.find.compile( selector )

    + +

    This method compiles a selector function and caches it for later use. For example, calling jQuery.find.compile( ".myWidget:myPseudo" ) during initialization of a plugin will speed up the first selection of matching elements.

    + +

    returns(Function): The compiled function to be used when filtering the set of possibly matching elements

    + +

    Parameters

    + +

    selector: A CSS selector

    + +
    +
    diff --git a/entries/jQuery.fx.interval.xml b/entries/jQuery.fx.interval.xml index 2dfd1719f..b86516c3e 100644 --- a/entries/jQuery.fx.interval.xml +++ b/entries/jQuery.fx.interval.xml @@ -1,12 +1,14 @@ - + jQuery.fx.interval The rate (in milliseconds) at which animations fire. 1.4.3 -

    This property is deprecated as of version 3.0, and has no effect in browsers that support the requestAnimationFrame method.

    +
    +

    This property is deprecated as of version 3.0, and has no effect in browsers that support the requestAnimationFrame method.

    +

    On browsers that do not support requestAnimationFrame, this property can be changed to adjust the interval at which animations will run. The default is 13 milliseconds.

    Since jQuery uses one global interval, no animation should be running or all animations should stop for the change of this property to take effect.

    @@ -14,7 +16,7 @@ Cause all animations to run with less frames. diff --git a/entries/jQuery.fx.off.xml b/entries/jQuery.fx.off.xml index 74bfd60a3..8464f69f5 100644 --- a/entries/jQuery.fx.off.xml +++ b/entries/jQuery.fx.off.xml @@ -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" ); -}); +} ); ]]>
    - A callback function that is executed if the request succeeds. Required if dataType is provided, but you can use null or jQuery.noop as a placeholder. + A callback function that is executed if the request succeeds. Required if dataType is provided, but you can use 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 null or undefined. The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). - 1.12/2.2 + 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. The type option will automatically be set to GET. + A set of key/value pairs that configure the Ajax request. All properties except for url are optional. A default can be set for any option with $.ajaxSetup(). See jQuery.ajax( settings ) for a complete list of all settings. The type option will automatically be set to GET. Load data from the server using a HTTP GET request. @@ -116,16 +116,28 @@ $.get( "test.cgi", { name: "John", time: "2pm" } ) ]]> - 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 11a263411..1449293d2 100644 --- a/entries/jQuery.getJSON.xml +++ b/entries/jQuery.getJSON.xml @@ -56,7 +56,7 @@ $.getJSON( "ajax/test.json", function( data ) {

    The success callback is passed the returned data, which is typically a JavaScript object or array as defined by the JSON structure and parsed using the $.parseJSON() method. It is also passed the text status of the response.

    As of jQuery 1.5, the success callback function receives a "jqXHR" object (in jQuery 1.4, it received the XMLHttpRequest object). However, since JSONP and cross-domain GET requests do not use XHR, in those cases the jqXHR and textStatus parameters passed to the success callback are undefined.

    -

    Important: As of jQuery 1.4, if the JSON file contains a syntax error, the request will usually fail silently. Avoid frequent hand-editing of JSON data for this reason. JSON is a data-interchange format with syntax rules that are stricter than those of JavaScript's object literal notation. For example, all strings represented in JSON, whether they are properties or values, must be enclosed in double-quotes. For details on the JSON format, see http://json.org/.

    +

    Important: As of jQuery 1.4, if the JSON file contains a syntax error, the request will usually fail silently. Avoid frequent hand-editing of JSON data for this reason. JSON is a data-interchange format with syntax rules that are stricter than those of JavaScript's object literal notation. For example, all strings represented in JSON, whether they are properties or values, must be enclosed in double-quotes. For details on the JSON format, see https://json.org/.

    JSONP

    If the URL includes the string "callback=?" (or similar, as defined by the server-side API), the request is treated as JSONP instead. See the discussion of the jsonp data type in $.ajax() for more details.

    @@ -82,7 +82,7 @@ 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" ); }); diff --git a/entries/jQuery.getScript.xml b/entries/jQuery.getScript.xml index be884042e..d44d1f3a1 100644 --- a/entries/jQuery.getScript.xml +++ b/entries/jQuery.getScript.xml @@ -27,7 +27,7 @@ $.ajax({

    Success Callback

    -

    The callback is fired once the script has been loaded but not necessarily executed.

    +

    The callback is fired once the script has been loaded and executed.

    Scripts are included and run by referencing the file name:

    
     $.getScript( "ajax/test.js", function( data, textStatus, jqxhr ) {
    @@ -48,14 +48,15 @@ $.getScript( "ajax/test.js" )
         $( "div.log" ).text( "Triggered ajaxError handler." );
     });
         
    -

    Prior to jQuery 1.5, the global .ajaxError() callback event had to be used in order to handle $.getScript() errors:

    +

    Prior to jQuery 1.5, the global ajaxError callback event had to be used in order to handle $.getScript() errors:

    
    -$( "div.log" ).ajaxError(function( e, jqxhr, settings, exception ) {
    +$( "div.log" ).on( "ajaxError", function( e, jqxhr, settings, exception ) {
       if ( settings.dataType == "script" ) {
         $( this ).text( "Triggered ajaxError handler." );
       }
    -});
    +} );
         
    +

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

    Caching Responses

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

    
    @@ -91,9 +92,9 @@ $.cachedScript( "ajax/test.js" ).done(function( script, textStatus ) {
       
         Load the official jQuery Color Animation plugin dynamically and bind some color animations to occur once the new functionality is loaded.
         
       
       
    +  
     
    diff --git a/entries/jQuery.globalEval.xml b/entries/jQuery.globalEval.xml
    index ad6b7d1e5..f6234efed 100644
    --- a/entries/jQuery.globalEval.xml
    +++ b/entries/jQuery.globalEval.xml
    @@ -7,6 +7,31 @@
           The JavaScript code to execute.
         
       
    +  
    +    3.4
    +    
    +      The JavaScript code to execute.
    +    
    +    
    +      
    +        The nonce attribute passed to the executed script.
    +      
    +    
    +  
    +  
    +    3.5
    +    
    +      The JavaScript code to execute.
    +    
    +    
    +      
    +        The nonce attribute passed to the executed script.
    +      
    +    
    +    
    +      A document in which context the code will be evaluated.
    +    
    +  
       Execute some JavaScript code globally.
       
         

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

    @@ -15,7 +40,19 @@ Execute a script in the global context. +
    + + Execute a script with a nonce value on a site with Content Security Policy enabled. + - + jQuery.holdReady() Holds or releases the execution of jQuery's ready event. @@ -9,6 +9,16 @@ +
    +

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

    + +

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

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

    @@ -25,4 +35,5 @@ $.getScript( "myplugin.js", function() { +
    diff --git a/entries/jQuery.htmlPrefilter.xml b/entries/jQuery.htmlPrefilter.xml index 3682ed5bd..753819039 100644 --- a/entries/jQuery.htmlPrefilter.xml +++ b/entries/jQuery.htmlPrefilter.xml @@ -3,75 +3,15 @@ jQuery.htmlPrefilter() Modify and filter HTML strings passed through jQuery manipulation methods. - 1.12/2.2 + 1.12-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. For instance, to remove all <del> tags from incoming HTML strings, do this:

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

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

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

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

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

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

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

    +

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

    +
    diff --git a/entries/jQuery.isArray.xml b/entries/jQuery.isArray.xml index 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 7aed55748..5160f0a70 100644 --- a/entries/jQuery.isFunction.xml +++ b/entries/jQuery.isFunction.xml @@ -1,5 +1,5 @@ - + jQuery.isFunction() 1.2 @@ -9,7 +9,9 @@ Determines if its argument is callable as a function. -

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

    +
    +

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

    +

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

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

    Note: This API has been deprecated in jQuery 3.3.

    +

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

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

    @@ -39,4 +42,5 @@ $.isNumeric( undefined )
    +
    diff --git a/entries/jQuery.isWindow.xml b/entries/jQuery.isWindow.xml index ee8ed3b13..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).

    diff --git a/entries/jQuery.map.xml b/entries/jQuery.map.xml index 3c499e6c8..2016df876 100644 --- a/entries/jQuery.map.xml +++ b/entries/jQuery.map.xml @@ -3,8 +3,8 @@ jQuery.map() 1.0 - - The Array to translate. + + The Array or an Array-like object to translate. @@ -16,7 +16,7 @@ 1.6 - The Object to translate. + The non-Array-like Object to translate. @@ -28,16 +28,13 @@ 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.now.xml b/entries/jQuery.now.xml
    index 6c41af36c..00992aba8 100644
    --- a/entries/jQuery.now.xml
    +++ b/entries/jQuery.now.xml
    @@ -1,13 +1,17 @@
     
    -
    +
       jQuery.now()
       
         1.4.3
       
       Return a number representing the current time.
       
    -    

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

    +
    +

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

    +
    +

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

    -
    \ No newline at end of file + +
    diff --git a/entries/jQuery.parseHTML.xml b/entries/jQuery.parseHTML.xml index 5354627ae..5ff74ce77 100644 --- a/entries/jQuery.parseHTML.xml +++ b/entries/jQuery.parseHTML.xml @@ -18,8 +18,8 @@

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

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

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

    -

    Security Considerations

    -

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

    +

    Security Considerations

    +

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

    Create an array of DOM nodes using an HTML string and insert it into a div. diff --git a/entries/jQuery.parseJSON.xml b/entries/jQuery.parseJSON.xml index d47eab4b9..2023ebc83 100644 --- a/entries/jQuery.parseJSON.xml +++ b/entries/jQuery.parseJSON.xml @@ -1,5 +1,5 @@ - + @@ -14,7 +14,9 @@ Takes a well-formed JSON string and returns the resulting JavaScript value. -

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

    +
    +

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

    +

    Passing in a malformed JSON string results in a JavaScript exception being thrown. For example, the following are all invalid JSON strings:

    • "{test: 1}" (test does not have double quotes around it).
    • @@ -25,7 +27,7 @@
    • "NaN" (NaN cannot be represented in a JSON string; direct representation of Infinity is also not permitted).

    The JSON standard does not permit "control characters" such as a tab or newline. An example like $.parseJSON( '{ "testing":"1\t2\n3" }' ) will throw an error in most implementations because the JavaScript parser converts the string's tab and newline escapes into literal tab and newline; doubling the backslashes like "1\\t2\\n3" yields expected results. This problem is often seen when injecting JSON into a JavaScript file from a server-side language such as PHP.

    -

    Where the browser provides a native implementation of JSON.parse, jQuery uses it to parse the string. For details on the JSON format, see http://json.org/.

    +

    Where the browser provides a native implementation of JSON.parse, jQuery uses it to parse the string. For details on the JSON format, see https://json.org/.

    Prior to jQuery 1.9, $.parseJSON returned null instead of throwing an error if it was passed an empty string, null, or undefined, even though those are not valid JSON.

    @@ -37,4 +39,5 @@ alert( obj.name === "John" ); +
    diff --git a/entries/jQuery.post.xml b/entries/jQuery.post.xml index 6152350a0..e862071fa 100644 --- a/entries/jQuery.post.xml +++ b/entries/jQuery.post.xml @@ -15,19 +15,19 @@ - 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). - 1.12/2.2 + 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. + 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. - Load data from the server using a HTTP POST request. + Send data to the server using a HTTP POST request.

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

    
    @@ -50,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; 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.

    +

    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,
    @@ -135,7 +135,7 @@ $.post( "test.php", { func: "getNameAndTime" }, function( data ) {
         Post a form using Ajax and put results in a div
         
         
    @@ -167,4 +167,5 @@ $( "#searchForm" ).submit(function( event ) {
       
       
       
    +  
     
    diff --git a/entries/jQuery.proxy.xml b/entries/jQuery.proxy.xml
    index e7c5f0ff8..d00748b93 100644
    --- a/entries/jQuery.proxy.xml
    +++ b/entries/jQuery.proxy.xml
    @@ -1,5 +1,5 @@
     
    -
    +
       jQuery.proxy()
       
         1.4
    @@ -46,6 +46,9 @@
     
       Takes a function and returns a new one that will always have a particular context.
       
    +    
    +

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

    +

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

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

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

    @@ -170,4 +173,5 @@ $( "#test" ) +
    diff --git a/entries/jQuery.queue.xml b/entries/jQuery.queue.xml index 3921e0206..16fa17531 100644 --- a/entries/jQuery.queue.xml +++ b/entries/jQuery.queue.xml @@ -19,7 +19,7 @@ Show the length of the queue.
    - + 1.3 @@ -105,21 +105,21 @@ runIt(); Queue a custom function. Set a queue array to delete the queue. - + jQuery.removeData() 1.2.3 @@ -19,13 +19,13 @@ Set a data store for 2 names then remove one of them. Creates a new copy of jQuery whose properties and methods can be modified without affecting the original jQuery object. -

    - This method is deprecated as of jQuery 1.7 and will be moved to a plugin in jQuery 1.8. -

    +
    +

    Note: This API has been removed in jQuery 1.9.

    +

    There are two specific use cases for which jQuery.sub() was created. The first was for providing a painless way of overriding jQuery methods without completely destroying the original methods and another was for helping to do encapsulation and basic namespacing for jQuery plugins.

    Note that jQuery.sub() doesn't attempt to do any sort of isolation - that's not its intention. All the methods on the sub'd version of jQuery will still point to the original jQuery (events bound and triggered will still be through the main jQuery, data will be bound to elements through the main jQuery, Ajax queries and events will run through the main jQuery, etc.).

    Note that if you're looking to use this for plugin development you should first strongly consider using something like the jQuery UI widget factory which manages both state and plugin sub-methods. Some examples of using the jQuery UI widget factory to build a plugin.

    @@ -47,7 +47,7 @@ typeof jQuery( "body" ).myCustomMethod // undefined }; myjQuery(function( $ ) { - $( ".menu" ).click(function() { + $( ".menu" ).on( "click", function() { $( this ).find( ".submenu" ).remove(); }); diff --git a/entries/jQuery.support.xml b/entries/jQuery.support.xml index 636ec72eb..3252fd6ea 100644 --- a/entries/jQuery.support.xml +++ b/entries/jQuery.support.xml @@ -4,10 +4,15 @@ 1.3 - A collection of properties that represent the presence of different browser features or bugs. Intended for jQuery's internal use; specific properties may be removed when they are no longer needed internally to improve page startup performance. For your own project's feature-detection needs, we strongly recommend the use of an external library such as Modernizr instead of dependency on properties in jQuery.support. + A collection of properties that represent the presence of different browser features or bugs; intended for jQuery's internal use. + +

    A collection of properties that represent the presence of different browser features or bugs. Intended for jQuery's internal use; specific properties may be removed when they are no longer needed internally to improve page startup performance. For your own project's feature-detection needs, we strongly recommend the use of an external library such as Modernizr instead of dependency on properties in jQuery.support.

    +

    As of jQuery 1.11 or 1.12, jQuery.support is no longer JSON-serializable; some properties point to functions that return the support test result when called. This was necessary to support lazy execution of support tests.

    +
    +
    diff --git a/entries/jQuery.trim.xml b/entries/jQuery.trim.xml index d0dcfa68e..cfc537b63 100644 --- a/entries/jQuery.trim.xml +++ b/entries/jQuery.trim.xml @@ -1,5 +1,5 @@ - + jQuery.trim() 1.0 @@ -9,6 +9,9 @@ Remove the whitespace from the beginning and end of a string. +
    +

    Note: This API has been deprecated in jQuery 3.5; please use the native String.prototype.trim method instead. Unlike jQuery.trim, String.prototype.trim does not work with types other than strings (null, undefined, Number). Make sure that your code is compatible when migrating.

    +

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

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

    Note: This API has been deprecated in jQuery 3.3.

    +

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

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

    +
    +

    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.

    @@ -21,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.uniqueSort.xml b/entries/jQuery.uniqueSort.xml index 88735af95..4cc086645 100644 --- a/entries/jQuery.uniqueSort.xml +++ b/entries/jQuery.uniqueSort.xml @@ -2,29 +2,29 @@ jQuery.uniqueSort() - 1.12-2.2 - - The Array of DOM elements. + 1.12-and-2.2 + + The Array or an Array-like object of DOM elements. - Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers. + Sorts an array or an array-like object of DOM elements, in place, with the duplicates removed. Note that this only works on arrays/array-likes of DOM elements, not strings or numbers. -

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

    +

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

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

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

    Removes any duplicate elements from the array of divs. - +
    diff --git a/entries/jQuery.xml b/entries/jQuery.xml index a0ff76d18..8df77906f 100644 --- a/entries/jQuery.xml +++ b/entries/jQuery.xml @@ -11,7 +11,8 @@ - A DOM Element, Document, or jQuery to use as context + + A DOM Element, Document, jQuery or selector to use as context @@ -49,7 +50,7 @@

    Selector Context

    By default, selectors perform their searches within the DOM starting at the document root. However, an alternate context can be given for the search by using the optional second parameter to the $() function. For example, to do a search within an event handler, the search can be restricted like so:

    
    -$( "div.foo" ).click(function() {
    +$( "div.foo" ).on( "click", function() {
       $( "span", this ).addClass( "bar" );
     });
           
    @@ -61,7 +62,7 @@ $( "div.foo" ).click(function() {

    Please note that although you can pass text nodes and comment nodes into a jQuery collection this way, most operations don't support them. The few that do will have an explicit note on their API documentation page.

    A common use of single-DOM-element construction is to call jQuery methods on an element that has been passed to a callback function through the keyword this:

    
    -$( "div.foo" ).click(function() {
    +$( "div.foo" ).on( "click", function() {
       $( this ).slideUp();
     });
           
    @@ -77,7 +78,7 @@ $.post( "url.xml", function( data ) {

    When a jQuery object is passed to the $() function, a clone of the object is created. This new jQuery object references the same DOM elements as the initial one.

    Returning an Empty Set

    -

    As of jQuery 1.4, calling the jQuery() method with no arguments returns an empty jQuery set (with a .length property of 0). In previous versions of jQuery, this would return a set containing the document node.

    +

    Calling the jQuery() method with no arguments returns an empty jQuery set (with a .length property of 0). Similarly, if an argument of null, undefined, an empty array ([]), 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.
           
         
    @@ -177,12 +178,12 @@ $( myForm.elements ).hide();
           

    By default, elements are created with an .ownerDocument matching the document into which the jQuery library was loaded. Elements being injected into a different document should be created using that document, e.g., $("<p>hello iframe</p>", $("#myiframe").prop("contentWindow").document).

    If the HTML is more complex than a single tag without attributes, as it is in the above example, the actual creation of the elements is handled by the browser's .innerHTML mechanism. In most cases, jQuery creates a new <div> element and sets the innerHTML property of the element to the HTML snippet that was passed in. When the parameter has a single tag (with optional closing tag or quick-closing) — $( "<img />" ) or $( "<img>" ), $( "<a></a>" ) or $( "<a>" ) — jQuery creates the element using the native JavaScript .createElement() function.

    When passing in complex HTML, some browsers may not generate a DOM that exactly replicates the HTML source provided. As mentioned, jQuery uses the browser's .innerHTML property to parse the passed HTML and insert it into the current document. During this process, some browsers filter out certain elements such as <html>, <title>, or <head> elements. As a result, the elements inserted may not be representative of the original string passed.

    -

    Filtering isn't, however, limited to these tags. For example, Internet Explorer prior to version 8 will also convert all href properties on links to absolute URLs, and Internet Explorer prior to version 9 will not correctly handle HTML5 elements without the addition of a separate compatibility layer.

    +

    Filtering isn't, however, limited to these tags. For example, Internet Explorer prior to version 8 will also convert all href properties on links to absolute URLs, and Internet Explorer prior to version 9 will not correctly handle HTML5 elements without the addition of a separate compatibility layer.

    To ensure cross-platform compatibility, the snippet must be well-formed. Tags that can contain other elements should be paired with a closing tag:

    $( "<a href='https://jquery.com'></a>" );

    Tags that cannot contain elements may be quick-closed or not:

    
    -$( "<img>" );
    +$( "<img />" );
     $( "<input>" );
           

    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:

    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 f21ae4e0f..576a1ad0c 100644 --- a/entries/keydown.xml +++ b/entries/keydown.xml @@ -1,15 +1,15 @@ - - .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. @@ -18,12 +18,10 @@ - - 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.

    +
    +

    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:

    
    @@ -36,42 +34,41 @@
         

    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.

    To determine which key was pressed, examine the event object that is passed to the handler function. While browsers use differing properties to store this information, jQuery normalizes the .which property so you can reliably use it to retrieve the key code. This code corresponds to a key on the keyboard, including codes for special keys such as arrows. For catching actual text entry, .keypress() may be a better choice.

    - Show the event object for the keydown handler when a key is pressed in the input. - +
    + + + keydown event + Trigger the "keydown" event on an element. + + 1.0 + + The string "keydown". + + + +

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

    +
    + + +
    + +
    diff --git a/entries/keypress-shorthand.xml b/entries/keypress-shorthand.xml new file mode 100644 index 000000000..56a0d1d85 --- /dev/null +++ b/entries/keypress-shorthand.xml @@ -0,0 +1,36 @@ + + + .keypress() + Bind an event handler to the "keypress" 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 .keypress( handler ) or .keypress( eventData, handler ), use .on( "keypress", handler ) or .on( "keypress", eventData, handler ), respectively.

    +

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

    +
    +
    + + + + +
    diff --git a/entries/keypress.xml b/entries/keypress.xml index 0fd28cf3d..089765bfa 100644 --- a/entries/keypress.xml +++ b/entries/keypress.xml @@ -1,16 +1,15 @@ - - .keypress() - Bind an event handler to the "keypress" JavaScript event, or trigger that event on an element. + +Bind an event handler to the "keypress" event, or trigger that event on an element. + + + keypress event + Bind an event handler to the "keypress" event. - 1.0 - - A function to execute each time the event is triggered. - + 1.7 + + The string "keypress". - - - 1.4.3 An object containing data that will be passed to the event handler. @@ -19,12 +18,11 @@ - - 1.0 - +
    +

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

    +

    Note: as the keypress event isn't covered by any official specification, the actual behavior encountered when using it may differ across browsers, browser versions, and platforms.

    -

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

    The keypress event is sent to an element when the browser registers keyboard input. This is similar to the keydown event, except that modifier and non-printing keys such as Shift, Esc, and delete trigger keydown events but not keypress events. Other differences between the two events may arise depending on platform and browser.

    A keypress event handler 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 controls can always get focus so are reasonable candidates for this event type.

    For example, consider the HTML:

    @@ -40,43 +38,42 @@

    The event handler can be bound to the input field:

    
    -$( "#target" ).keypress(function() {
    -  console.log( "Handler for .keypress() called." );
    -});
    +$( "#target" ).on( "keypress", function() {
    +  console.log( "Handler for `keypress` called." );
    +} );
         

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

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

    -

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

    +

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

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

    After this code executes, clicks on the Trigger the handler div will also log 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.

    To determine which character was entered, examine the event object that is passed to the handler function. While browsers use differing properties to store this information, jQuery normalizes the .which property so you can reliably use it to retrieve the character code.

    Note that keydown and keyup provide a code indicating which key is pressed, while keypress indicates which character was entered. For example, a lowercase "a" will be reported as 65 by keydown and keyup, but as 97 by keypress. An uppercase "A" is reported as 65 by all events. Because of this distinction, when catching special keystrokes such as arrow keys, .keydown() or .keyup() is a better choice.

    - Show the event object when a key is pressed in the input. Note: This demo relies on a simple $.print() plugin (https://api.jquery.com/resources/events.js) for the event object's output. - + + + + 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 91193b538..b0d6399f4 100644 --- a/entries/keyup.xml +++ b/entries/keyup.xml @@ -1,16 +1,15 @@ - - .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. @@ -19,11 +18,10 @@ - - 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:

    
    @@ -36,43 +34,42 @@
         

    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.

    To determine which key was pressed, examine the event object that is passed to the handler function. While browsers use differing properties to store this information, jQuery normalizes the .which property so you can reliably use it to retrieve the key code. This code corresponds to a key on the keyboard, including codes for special keys such as arrows. For catching actual text entry, .keypress() may be a better choice.

    - Show the event object for the keyup handler (using a simple $.print plugin) when a key is released in the input. - +
    + + + keyup event + Trigger the "keyup" event on an element. + + 1.0 + + The string "keyup". + + + +

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

    +
    + + +
    + +
    diff --git a/entries/last-child-selector.xml b/entries/last-child-selector.xml index 8e5d81e35..06d8e61b1 100644 --- a/entries/last-child-selector.xml +++ b/entries/last-child-selector.xml @@ -7,7 +7,7 @@
    Selects all elements that are the last child of their parent. -

    While :last matches only a single element, :last-child can match more than one: one for each parent.

    +

    While .last() matches only a single element, :last-child can match more than one: one for each parent.

    Find the last span in each matched div and add some css plus a hover state. diff --git a/entries/last-selector.xml b/entries/last-selector.xml index 2cbd886f5..128eec49c 100644 --- a/entries/last-selector.xml +++ b/entries/last-selector.xml @@ -1,5 +1,5 @@ - + :last Selector :last @@ -7,13 +7,16 @@ Selects the last matched element. +
    +

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

    +

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

    Finds the last table row. @@ -26,4 +29,5 @@ $( "tr:last" ).css({ backgroundColor: "yellow", fontWeight: "bolder" }); +
    diff --git a/entries/last.xml b/entries/last.xml index 4f9b59df4..73ddafa5d 100644 --- a/entries/last.xml +++ b/entries/last.xml @@ -24,17 +24,22 @@ $( "li" ).last().css( "background-color", "red" );

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

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

    +
      +
    • Look:
    • +
    • This is some text in a list.
    • +
    • This is a note about it.
    • +
    • This is another note about it.
    • +
    ]]>
    diff --git a/entries/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. " ) ); var n = $( "div" ).length; $( "span" ).text( "There are " + n + " divs." + "Click to add more."); - }) + } ) // Trigger the click to start .trigger( "click" ); ]]> diff --git a/entries/live.xml b/entries/live.xml index 049322e27..0943af956 100644 --- a/entries/live.xml +++ b/entries/live.xml @@ -32,7 +32,9 @@ -

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

    +
    +

    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:

    
    @@ -102,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 e3739cb71..f7dbc65a7 100644
    --- a/entries/load-event.xml
    +++ b/entries/load-event.xml
    @@ -1,16 +1,15 @@
     
    -
    -  .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.
         
    @@ -20,7 +19,9 @@
         
       
       
    -    

    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:

    
    @@ -28,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
    • @@ -57,24 +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 than 100 upon each image load. 100) { $( this ).addClass( "bigImg" ); } -}); +} ); ]]> - - - + + + + + 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 3444cb901..c0f6a46fc 100644 --- a/entries/load.xml +++ b/entries/load.xml @@ -18,12 +18,12 @@ A callback function that is executed when the request completes. - Load data from the server and place the returned HTML into the matched element. + Load data from the server and place the returned HTML into the matched elements.

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

      -

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

      +

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

      
       $( "#result" ).load( "ajax/test.html" );
           
      diff --git a/entries/lt-selector.xml b/entries/lt-selector.xml index b85b5f777..703c427f1 100644 --- a/entries/lt-selector.xml +++ b/entries/lt-selector.xml @@ -1,5 +1,5 @@ - + :lt() Selector :lt(index) @@ -17,6 +17,9 @@ Select all elements at an index less than index within the matched set. +
      +

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

      +

      index-related selectors

      @@ -42,4 +45,5 @@ $( "td:lt(-2)" ).css( "color", "red" ); +
      diff --git a/entries/map.xml b/entries/map.xml index c151e8313..101fa001b 100644 --- a/entries/map.xml +++ b/entries/map.xml @@ -135,9 +135,9 @@ $.fn.equalizeHeights = function() { return this.height( Math.max.apply( this, maxHeight ) ); }; -$( "input" ).click(function() { +$( "input" ).on( "click", function() { $( "div" ).equalizeHeights(); -}); +} ); ]]>
      + + .mousedown() + Bind an event handler to the "mousedown" 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 .mousedown( handler ) or .mousedown( eventData, handler ), use .on( "mousedown", handler ) or .on( "mousedown", eventData, handler ), respectively.

      +

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

      +
      +
      + + + + +
      diff --git a/entries/mousedown.xml b/entries/mousedown.xml index ea8d9a0e9..5ce0e273d 100644 --- a/entries/mousedown.xml +++ b/entries/mousedown.xml @@ -1,16 +1,15 @@ - - .mousedown() - Bind an event handler to the "mousedown" JavaScript event, or trigger that event on an element. + +Bind an event handler to the "mousedown" event, or trigger that event on an element. + + + mousedown event + Bind an event handler to the "mousedown" event. - 1.0 - - A function to execute each time the event is triggered. - + 1.7 + + The string "mousedown". - - - 1.4.3 An object containing data that will be passed to the event handler. @@ -19,11 +18,10 @@ - - 1.0 - -

      This method is a shortcut for .on( "mousedown", handler) in the first variation, and .trigger( "mousedown" ) in the second.

      +
      +

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

      +

      The mousedown event is sent to an element when the mouse pointer is over the element, and the mouse button is pressed. Any HTML element can receive this event.

      For example, consider the HTML:

      <div id="target">
      @@ -39,36 +37,35 @@
           
           

      The event handler can be bound to any <div>:

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

      Now if we click on this element, the alert is displayed:

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

      We can also trigger the event when a different element is clicked:

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

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

      The mousedown event is sent when any mouse button is clicked. To act only on specific buttons, we can use the event object's which property. Not all browsers support this property (Internet Explorer uses button instead), but jQuery normalizes the property so that it is safe to use in any browser. The value of which will be 1 for the left button, 2 for the middle button, or 3 for the right button.

      This event is primarily useful for ensuring that the primary button was used to begin a drag operation; if ignored, strange results can occur when the user attempts to use a context menu. While the middle and right buttons can be detected with these properties, this is not reliable. In Opera and Safari, for example, right mouse button clicks are not detectable by default.

      If the user clicks on an element, drags away from it, and releases the button, this is still counted as a mousedown event. This sequence of actions is treated as a "canceling" of the button press in most user interfaces, so it is usually better to use the click event unless we know that the mousedown event is preferable for a particular situation.

      - Show texts when mouseup and mousedown event triggering. Mouse up." ); - }) - .mousedown(function() { + } ) + .on( "mousedown", function() { $( this ).append( "Mouse down." ); - }); + } ); ]]> Press mouse and release here.

      @@ -76,5 +73,23 @@ $( "p" )
      - + + + + + mousedown event + Trigger the "mousedown" event on an element. + + 1.0 + + The string "mousedown". + + + +

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

      +
      + +
      + + diff --git a/entries/mouseenter-shorthand.xml b/entries/mouseenter-shorthand.xml new file mode 100644 index 000000000..49b2285a3 --- /dev/null +++ b/entries/mouseenter-shorthand.xml @@ -0,0 +1,36 @@ + + + .mouseenter() + Bind an event handler to the "mouseenter" 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 .mouseenter( handler ) or .mouseenter( eventData, handler ), use .on( "mouseenter", handler ) or .on( "mouseenter", eventData, handler ), respectively.

      +

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

      +
      +
      + + + + +
      diff --git a/entries/mouseenter.xml b/entries/mouseenter.xml index f9c396973..d22329266 100644 --- a/entries/mouseenter.xml +++ b/entries/mouseenter.xml @@ -1,16 +1,15 @@ - - .mouseenter() - Bind an event handler to be fired when the mouse enters an element, or trigger that handler on an element. + +Bind an event handler to be fired when the mouse enters an element, or trigger that handler on an element. + + + mouseenter event + Bind an event handler to be fired when the mouse enters an element. - 1.0 - - A function to execute each time the event is triggered. - + 1.7 + + The string "mouseenter". - - - 1.4.3 An object containing data that will be passed to the event handler. @@ -19,11 +18,10 @@ - - 1.0 - -

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

      +
      +

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

      +

      The mouseenter JavaScript event is proprietary to Internet Explorer. Because of the event's general utility, jQuery simulates this event so that it can be used regardless of browser. This event is sent to an element when the mouse pointer enters the element. Any HTML element can receive this event.

      For example, consider the HTML:

      
      @@ -43,20 +41,19 @@
           
           

      The event handler can be bound to any element:

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

      Now when the mouse pointer moves over the Outer <div>, the message is appended to <div id="log">. You can also trigger the event when another element is clicked:

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

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

      The mouseenter event differs from mouseover in the way it handles event bubbling. If mouseover were used in this example, then when the mouse pointer moved over the Inner element, the handler would be triggered. This is usually undesirable behavior. The mouseenter event, on the other hand, only triggers its handler when the mouse enters the element it is bound to, not a descendant. So in this example, the handler is triggered when the mouse enters the Outer element, but not the Inner element.

      - Show texts when mouseenter and mouseout event triggering. mouseover fires when the pointer moves into the child element as well, while mouseenter fires only when the pointer moves into the bound element. @@ -83,23 +80,23 @@ $( "#other" ).click(function() { @@ -117,5 +114,23 @@ $( "div.enterleave" ) - + + + + mouseenter event + Trigger the "mouseenter" event on an element. + + 1.0 + + The string "mouseenter". + + + +

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

      +
      + + +
      + + diff --git a/entries/mouseleave-shorthand.xml b/entries/mouseleave-shorthand.xml new file mode 100644 index 000000000..9ff235eb8 --- /dev/null +++ b/entries/mouseleave-shorthand.xml @@ -0,0 +1,36 @@ + + + .mouseleave() + Bind an event handler to the "mouseleave" 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 .mouseleave( handler ) or .mouseleave( eventData, handler ), use .on( "mouseleave", handler ) or .on( "mouseleave", eventData, handler ), respectively.

      +

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

      +
      +
      + + + + +
      diff --git a/entries/mouseleave.xml b/entries/mouseleave.xml index edb8fa441..98c1ff971 100644 --- a/entries/mouseleave.xml +++ b/entries/mouseleave.xml @@ -1,16 +1,15 @@ - - .mouseleave() - Bind an event handler to be fired when the mouse leaves an element, or trigger that handler on an element. + +Bind an event handler to be fired when the mouse leaves an element, or trigger that handler on an element. + + + mouseleave event + Bind an event handler to be fired when the mouse leaves an element. - 1.0 - - A function to execute each time the event is triggered. - + 1.7 + + The string "mouseleave". - - - 1.4.3 An object containing data that will be passed to the event handler. @@ -19,11 +18,10 @@ - - 1.0 - -

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

      +
      +

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

      +

      The mouseleave JavaScript event is proprietary to Internet Explorer. Because of the event's general utility, jQuery simulates this event so that it can be used regardless of browser. This event is sent to an element when the mouse pointer leaves the element. Any HTML element can receive this event.

      For example, consider the HTML:

      
      @@ -43,20 +41,19 @@
           
           

      The event handler can be bound to any element:

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

      Now when the mouse pointer moves out of the Outer <div>, the message is appended to <div id="log">. You can also trigger the event when another element is clicked:

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

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

      The mouseleave event differs from mouseout in the way it handles event bubbling. If mouseout were used in this example, then when the mouse pointer moved out of the Inner element, the handler would be triggered. This is usually undesirable behavior. The mouseleave event, on the other hand, only triggers its handler when the mouse leaves the element it is bound to, not a descendant. So in this example, the handler is triggered when the mouse leaves the Outer element, but not the Inner element.

      - Show number of times mouseout and mouseleave events are triggered. mouseout fires when the pointer moves out of child element as well, while mouseleave fires only when the pointer moves out of the bound element.
      @@ -115,5 +112,23 @@ $( "div.enterleave" ) - + + + + mouseleave event + Trigger the "mouseleave" event on an element. + + 1.0 + + The string "mouseleave". + + + +

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

      +
      + + +
      + + diff --git a/entries/mousemove-shorthand.xml b/entries/mousemove-shorthand.xml new file mode 100644 index 000000000..7b5e5c314 --- /dev/null +++ b/entries/mousemove-shorthand.xml @@ -0,0 +1,36 @@ + + + .mousemove() + Bind an event handler to the "mousemove" 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 .mousemove( handler ) or .mousemove( eventData, handler ), use .on( "mousemove", handler ) or .on( "mousemove", eventData, handler ), respectively.

      +

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

      +
      +
      + + + + +
      diff --git a/entries/mousemove.xml b/entries/mousemove.xml index b22b014ac..5aaeef0b6 100644 --- a/entries/mousemove.xml +++ b/entries/mousemove.xml @@ -1,16 +1,15 @@ - - .mousemove() - Bind an event handler to the "mousemove" JavaScript event, or trigger that event on an element. + +Bind an event handler to the "mousemove" event, or trigger that event on an element. + + + mousemove event + Bind an event handler to the "mousemove" event. - 1.0 - - A function to execute each time the event is triggered. - + 1.7 + + The string "mousemove". - - - 1.4.3 An object containing data that will be passed to the event handler. @@ -19,11 +18,10 @@ - - 1.0 - -

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

      +
      +

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

      +

      The mousemove event is sent to an element when the mouse pointer moves inside the element. Any HTML element can receive this event.

      For example, consider the HTML:

      
      @@ -37,47 +35,46 @@
           

      The event handler can be bound to the target:

      
      -$( "#target" ).mousemove(function( event ) {
      -  var msg = "Handler for .mousemove() called at ";
      +$( "#target" ).on( "mousemove", function( event ) {
      +  var msg = "Handler for `mousemove` called at ";
         msg += event.pageX + ", " + event.pageY;
         $( "#log" ).append( "<div>" + msg + "</div>" );
      -});
      +} );
           

      Now when the mouse pointer moves within the target button, the messages are appended to <div id="log">:

      - Handler for .mousemove() called at (399, 48) + Handler for `mousemove` called at (399, 48)
      - Handler for .mousemove() called at (398, 46) + Handler for `mousemove` called at (398, 46)
      - Handler for .mousemove() called at (397, 44) + Handler for `mousemove` called at (397, 44)
      - Handler for .mousemove() called at (396, 42) + Handler for `mousemove` called at (396, 42)

      -

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

      +

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

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

      After this code executes, clicks on the Trigger button will also append the message:

      - Handler for .mousemove() called at (undefined, undefined) + Handler for `mousemove` called at (undefined, undefined)

      When tracking mouse movement, you usually need to know the actual position of the mouse pointer. The event object that is passed to the handler contains some information about the mouse coordinates. Properties such as .clientX, .offsetX, and .pageX are available, but support for them differs between browsers. Fortunately, jQuery normalizes the .pageX and .pageY properties so that they can be used in all browsers. These properties provide the X and Y coordinates of the mouse pointer relative to the top-left corner of the document, as illustrated in the example output above.

      Keep in mind that the mousemove event is triggered whenever the mouse pointer moves, even for a pixel. This means that hundreds of events can be generated over a very small amount of time. If the handler has to do any significant processing, or if multiple handlers for the event exist, this can be a serious performance drain on the browser. It is important, therefore, to optimize mousemove handlers as much as possible, and to unbind them as soon as they are no longer needed.

      -

      A common pattern is to bind the mousemove handler from within a mousedown hander, and to unbind it from a corresponding mouseup handler. If implementing this sequence of events, remember that the mouseup event might be sent to a different HTML element than the mousemove event was. To account for this, the mouseup handler should typically be bound to an element high up in the DOM tree, such as <body>.

      +

      A common pattern is to bind the mousemove handler from within a mousedown handler, and to unbind it from a corresponding mouseup handler. If implementing this sequence of events, remember that the mouseup event might be sent to a different HTML element than the mousemove event was. To account for this, the mouseup handler should typically be bound to an element high up in the DOM tree, such as <body>.

      - Show the mouse coordinates when the mouse is moved over the yellow div. Coordinates are relative to the window, which in this case is the iframe. 300 - + +
      + + + mousemove event + Trigger the "mousemove" event on an element. + + 1.0 + + The string "mousemove". + + + +

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

      +
      + +
      + +
      diff --git a/entries/mouseout-shorthand.xml b/entries/mouseout-shorthand.xml new file mode 100644 index 000000000..25761ce44 --- /dev/null +++ b/entries/mouseout-shorthand.xml @@ -0,0 +1,36 @@ + + + .mouseout() + Bind an event handler to the "mouseout" 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 .mouseout( handler ) or .mouseout( eventData, handler ), use .on( "mouseout", handler ) or .on( "mouseout", eventData, handler ), respectively.

      +

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

      +
      +
      + + + + +
      diff --git a/entries/mouseout.xml b/entries/mouseout.xml index 57304cb1d..3b0148287 100644 --- a/entries/mouseout.xml +++ b/entries/mouseout.xml @@ -1,16 +1,15 @@ - - .mouseout() - Bind an event handler to the "mouseout" JavaScript event, or trigger that event on an element. + +Bind an event handler to the "mouseout" event, or trigger that event on an element. + + + mouseout event + Bind an event handler to the "mouseout" event. - 1.0 - - A function to execute each time the event is triggered. - + 1.7 + + The string "mouseout". - - - 1.4.3 An object containing data that will be passed to the event handler. @@ -19,11 +18,10 @@ - - 1.0 - -

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

      +
      +

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

      +

      The mouseout event is sent to an element when the mouse pointer leaves the element. Any HTML element can receive this event.

      For example, consider the HTML:

      
      @@ -44,20 +42,19 @@
           
           

      The event handler can be bound to any element:

      
      -$( "#outer" ).mouseout(function() {
      -  $( "#log" ).append( "Handler for .mouseout() called." );
      -});
      +$( "#outer" ).on( "mouseout", function() {
      +  $( "#log" ).append( "Handler for `mouseout` called." );
      +} );
           
      -

      Now when the mouse pointer moves out of the Outer <div>, the message is appended to <div id="log">. To trigger the event manually, apply .mouseout() without an argument::

      +

      Now when the mouse pointer moves out of the Outer <div>, the message is appended to <div id="log">. To trigger the event manually, use .trigger( "mouseout" ):

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

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

      This event type can cause many headaches due to event bubbling. For instance, when the mouse pointer moves out of the Inner element in this example, a mouseout event will be sent to that, then trickle up to Outer. This can trigger the bound mouseout handler at inopportune times. See the discussion for .mouseleave() for a useful alternative.

      - Show the number of times mouseout and mouseleave events are triggered. mouseout fires when the pointer moves out of the child element as well, while mouseleave fires only when the pointer moves out of the bound element. @@ -84,23 +81,23 @@ $( "#other" ).click(function() { @@ -118,5 +115,23 @@ $( "div.enterleave" ) - + + + + mouseout event + Trigger the "mouseout" event on an element. + + 1.0 + + The string "mouseout". + + + +

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

      +
      + + +
      + + diff --git a/entries/mouseover-shorthand.xml b/entries/mouseover-shorthand.xml new file mode 100644 index 000000000..25bc4c013 --- /dev/null +++ b/entries/mouseover-shorthand.xml @@ -0,0 +1,36 @@ + + + .mouseover() + Bind an event handler to the "mouseover" 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 .mouseover( handler ) or .mouseover( eventData, handler ), use .on( "mouseover", handler ) or .on( "mouseover", eventData, handler ), respectively.

      +

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

      +
      +
      + + + + +
      diff --git a/entries/mouseover.xml b/entries/mouseover.xml index 88ddb981e..6897db069 100644 --- a/entries/mouseover.xml +++ b/entries/mouseover.xml @@ -1,16 +1,15 @@ - - .mouseover() - Bind an event handler to the "mouseover" JavaScript event, or trigger that event on an element. + +Bind an event handler to the "mouseover" event, or trigger that event on an element. + + + mouseover event + Bind an event handler to the "mouseover" event. - 1.0 - - A function to execute each time the event is triggered. - + 1.7 + + The string "mouseover". - - - 1.4.3 An object containing data that will be passed to the event handler. @@ -19,11 +18,10 @@ - - 1.0 - -

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

      +
      +

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

      +

      The mouseover event is sent to an element when the mouse pointer enters the element. Any HTML element can receive this event.

      For example, consider the HTML:

      
      @@ -44,20 +42,19 @@
           
           

      The event handler can be bound to any element:

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

      Now when the mouse pointer moves over the Outer <div>, the message is appended to <div id="log">. We can also trigger the event when another element is clicked:

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

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

      This event type can cause many headaches due to event bubbling. For instance, when the mouse pointer moves over the Inner element in this example, a mouseover event will be sent to that, then trickle up to Outer. This can trigger our bound mouseover handler at inopportune times. See the discussion for .mouseenter() for a useful alternative.

      - Show the number of times mouseover and mouseenter events are triggered. mouseover fires when the pointer moves into the child element as well, while mouseenter fires only when the pointer moves into the bound element. @@ -84,23 +81,23 @@ $( "#other" ).click(function() { @@ -118,5 +115,23 @@ $( "div.enterleave" ) - + + + + + mouseover event + Trigger the "mouseover" event on an element. + + 1.0 + + The string "mouseover". + + + +

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

      +
      + +
      + + diff --git a/entries/mouseup-shorthand.xml b/entries/mouseup-shorthand.xml new file mode 100644 index 000000000..edbf836c5 --- /dev/null +++ b/entries/mouseup-shorthand.xml @@ -0,0 +1,36 @@ + + + .mouseup() + Bind an event handler to the "mouseup" 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 .mouseup( handler ) or .mouseup( eventData, handler ), use .on( "mouseup", handler ) or .on( "mouseup", eventData, handler ), respectively.

      +

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

      +
      +
      + + + + +
      diff --git a/entries/mouseup.xml b/entries/mouseup.xml index e18080a6d..205c0794e 100644 --- a/entries/mouseup.xml +++ b/entries/mouseup.xml @@ -1,16 +1,15 @@ - - .mouseup() - Bind an event handler to the "mouseup" JavaScript event, or trigger that event on an element. + +Bind an event handler to the "mouseup" event, or trigger that event on an element. + + + mouseup event + Bind an event handler to the "mouseup" event. - 1.0 - - A function to execute each time the event is triggered. - + 1.7 + + The string "mouseup". - - - 1.4.3 An object containing data that will be passed to the event handler. @@ -19,11 +18,10 @@ - - 1.0 - -

      This method is a shortcut for .on('mouseup', handler) in the first variation, and .trigger('mouseup') in the second.

      +
      +

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

      +

      The mouseup event is sent to an element when the mouse pointer is over the element, and the mouse button is released. Any HTML element can receive this event.

      For example, consider the HTML:

      
      @@ -40,34 +38,33 @@
           
           

      The event handler can be bound to any <div>:

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

      Now if we click on this element, the alert is displayed:

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

      We can also trigger the event when a different element is clicked:

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

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

      If the user clicks outside an element, drags onto it, and releases the button, this is still counted as a mouseup event. This sequence of actions is not treated as a button press in most user interfaces, so it is usually better to use the click event unless we know that the mouseup event is preferable for a particular situation.

      - Show texts when mouseup and mousedown event triggering. Mouse up." ); - }) - .mousedown(function() { + } ) + .on( "mousedown", function() { $( this ).append( "Mouse down." ); - }); + } ); ]]> Press mouse and release here.

      @@ -75,5 +72,23 @@ $( "p" )
      - + + + + + mouseup event + Trigger the "mouseup" event on an element. + + 1.0 + + The string "mouseup". + + + +

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

      +
      + +
      + + diff --git a/entries/nextAll.xml b/entries/nextAll.xml index 8965aab67..e60220934 100644 --- a/entries/nextAll.xml +++ b/entries/nextAll.xml @@ -30,7 +30,7 @@ $( "li.third-item" ).nextAll().css( "background-color", "red" ); Locate all the divs after the first and give them a class.

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

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

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

      +

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

      Removing Specific Elements

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

      
      diff --git a/entries/nth-child-selector.xml b/entries/nth-child-selector.xml
      index 68da261d0..8a5efc4c0 100644
      --- a/entries/nth-child-selector.xml
      +++ b/entries/nth-child-selector.xml
      @@ -10,8 +10,8 @@
         
         Selects all elements that are the nth-child of their parent.
         
      -    

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

      -

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

      +

      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. jQuery methods like .first() or .eq() jQuery follows JavaScript's "0-indexed" counting. Given a single <ul> containing two <li>s, $( "li:nth-child(1)" ) selects the first <li> while $( "li" ).eq( 1 ) selects the second.

      +

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

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

      @@ -51,12 +51,17 @@ $( "ul li:nth-child(2)" ).append( " - 2nd!" ); ]]> - This is a playground to see how the selector works with different strings. Notice that this is different from the :even and :odd which have no regard for parent and just filter the list of elements to every other one. The :nth-child, however, counts the index of the child to its particular parent. In any case, it's easier to see than explain so... + This is a playground to see how the selector works with different strings. Notice that this is different from the even and odd which have no regard for parent and just filter the list of elements to every other one. The :nth-child, however, counts the index of the child to its particular parent. In any case, it's easier to see than explain so... @@ -94,8 +99,8 @@ $( "button" ).click(function() {
      - - + +
      diff --git a/entries/nth-last-child-selector.xml b/entries/nth-last-child-selector.xml index 9d63636a3..def39a3bd 100644 --- a/entries/nth-last-child-selector.xml +++ b/entries/nth-last-child-selector.xml @@ -10,7 +10,7 @@ Selects all elements that are the nth-child of their parent, counting from the last element to the first. -

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

      +

      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.

      @@ -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. Selects all the elements that are the nth-child of their parent in relation to siblings with the same element name, counting from the last element to the first. -

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

      +

      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-of-type(1)') selects the third, last, <li>.

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

      @@ -52,7 +52,7 @@ $( "ul li:nth-last-of-type(2)" ).append( " - 2nd to last!" ); This is a playground to see how the selector works with different strings. Selects all elements that are the nth child of their parent in relation to siblings with the same element name. -

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

      +

      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.

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

      diff --git a/entries/odd-selector.xml b/entries/odd-selector.xml index 12a75cb84..8b907e15d 100644 --- a/entries/odd-selector.xml +++ b/entries/odd-selector.xml @@ -1,12 +1,15 @@ - + :odd Selector :odd 1.0 - Selects odd elements, zero-indexed. See also even. + Selects odd elements, zero-indexed. See also :even. +
      +

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

      +

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

      @@ -33,4 +36,5 @@ $( "tr:odd" ).css( "background-color", "#bbbbff" ); +
      diff --git a/entries/odd.xml b/entries/odd.xml new file mode 100644 index 000000000..52fe3baf6 --- /dev/null +++ b/entries/odd.xml @@ -0,0 +1,47 @@ + + + .odd() + + 3.5 + + Reduce the set of matched elements to the odd ones in the set, numbered from zero. + +

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

      +

      Consider a page with a simple list on it:

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

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

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

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

      +
      + + Highlight the odd items in a list. + + + +
    • Look:
    • +
    • This is some text in a list.
    • +
    • This is a note about it.
    • +
    • This is another note about it.
    • +
    +]]> + + + + diff --git a/entries/off.xml b/entries/off.xml index 2c711a68d..fba3925c0 100644 --- a/entries/off.xml +++ b/entries/off.xml @@ -46,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 9a588ca25..819232879 100644 --- a/entries/offset.xml +++ b/entries/offset.xml @@ -11,15 +11,15 @@

    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 margins set on the <html> document 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: @@ -35,7 +35,7 @@ p.html( "left: " + offset.left + ", top: " + offset.top ); Click to see the offset. - + A function to return the coordinates to set. Receives the index of the element in the collection as the first argument and the current coordinates as the second argument. The function should return an object with the new top and left properties. @@ -101,7 +101,7 @@ $( "*", document.body ).click(function( event ) { Set the offset of the second paragraph: The majority of browser events bubble, or propagate, from the deepest, innermost element (the event target) in the document where they occur all the way up to the body and the document element. In Internet Explorer 8 and lower, a few events such as change and submit do not natively bubble but jQuery patches these to bubble and create consistent cross-browser behavior.

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

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

    -

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

    -

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

    -

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

    +

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

    +

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

    +

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

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

    Attaching many delegated event handlers near the top of the document tree can degrade performance. Each time the event occurs, jQuery must compare all selectors of all attached events of that type to every element in the path from the event target up to the top of the document. For best performance, attach delegated events at a document location as close as possible to the target elements. Avoid excessive use of document or document.body for delegated events on large documents.

    jQuery can process simple selectors of the form tag#id.class very quickly when they are used to filter delegated events. So, "#myForm", "a.external", and "button" are all fast selectors. Delegated events that use more complex selectors, particularly hierarchical ones, can be several times slower--although they are still fast enough for most applications. Hierarchical selectors can often be avoided simply by attaching the handler to a more appropriate point in the document. For example, instead of $( "body" ).on( "click", "#commentForm .addNew", addComment ) use $( "#commentForm" ).on( "click", ".addNew", addComment ).

    Additional notes

    -

    There are shorthand methods for some events such as .click() that can be used to attach or trigger event handlers. For a complete list of shorthand methods, see the events category.

    +

    Some events have dedicated pages, describing specifics of their usage. For a complete list of those events, see the events category.

    Deprecated in jQuery 1.8, removed in 1.9: The name "hover" used as a shorthand for the string "mouseenter mouseleave". It attaches a single event handler for those two events, and the handler must examine event.type to determine whether the event is mouseenter or mouseleave. Do not confuse the "hover" pseudo-event-name with the .hover() method, which accepts one or two functions.

    jQuery's event system requires that a DOM element allow attaching data via a property on the element, so that events can be tracked and delivered. The object, embed, and applet elements cannot attach data, and therefore cannot have jQuery events bound to them.

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

    @@ -161,7 +161,7 @@ $( "div" ).trigger( "click", { name: "Jim" } ); ]]>
    - Use the the second argument of .trigger() to pass an array of data to the event handler + Use the second argument of .trigger() to pass an array of data to the event handler Figure 1 - Illustration of the measured height - + Get the outerHeight of a paragraph. @@ -47,15 +47,18 @@ $( "p:last" ).text( - 1.8.0 + 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.0 + 1.8 diff --git a/entries/outerWidth.xml b/entries/outerWidth.xml index 4e613cc19..2c5856bea 100644 --- a/entries/outerWidth.xml +++ b/entries/outerWidth.xml @@ -18,13 +18,13 @@
    Figure 1 - Illustration of the measured width
    - + Get the outerWidth of a paragraph. @@ -47,15 +47,18 @@ $( "p:last" ).text( - 1.8.0 + 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.0 + 1.8 diff --git a/entries/parent-selector.xml b/entries/parent-selector.xml index 72832a23a..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/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/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. Note: jQuery does not support getting the position coordinates of hidden elements or accounting for margins set on the <html> document element.

    - + Access the position of the second paragraph: A string containing a selector expression to match elements against. - Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector. + Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector, in the reverse document order.

    Given a jQuery object that represents a set of DOM elements, the .prevAll() method searches through the predecessors of these elements in the DOM tree and construct a new jQuery object from the matching elements; the elements are returned in order beginning with the closest sibling.

    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.

    @@ -26,11 +26,48 @@ $( "li.third-item" ).prevAll().css( "background-color", "red" );

    The result of this call is a red background behind items 1 and 2. Since we do not supply a selector expression, these preceding elements are unequivocally included as part of the object. If we had supplied one, the elements would be tested for a match before they were included.

    +

    Note: Many APIs, like append or wrapAll process node in the order in which they appear in the jQuery object. This can pose issues with APIs like .prevAll() in which the reverse document order is used. Consider the following example:

    +
    
    +<div>
    +  <div>First</div>
    +  <div>Second</div>
    +  <div class="last-item">Last</div>
    +</div>
    +    
    +

    The following call:

    +
    
    +$( ".last-item" )
    +  .prevAll()
    +  .wrapAll( "<div class='wrapper'></div>" );
    +    
    +

    would result in the following HTML:

    +
    
    +<div>
    +  <div class="wrapper">
    +    <div>Second</div>
    +    <div>First</div>
    +  </div>
    +  <div class="last-item">Last</div>
    +</div>
    +    
    +

    because "Item 2" gets appended to the wrapper div first. To work around the issue, you may use .uniqueSort() on the .prevAll() output first:

    +
    
    +$( ".last-item" )
    +  .prevAll()
    +  .uniqueSort()
    +  .wrapAll( "<div class='wrapper'></div>" );
    +    
    +

    Note that the .uniqueSort() method is only available in jQuery 3.7.0 or newer. In older versions, you will need to use $.uniqueSort() to achieve a similar effect:

    +
    
    +var prevSiblings = $( ".last-item" ).prevAll();
    +$.uniqueSort( prevSiblings );
    +prevSiblings.wrapAll( "<div class='wrapper'></div>" );
    +    
    Locate all the divs preceding the last div and give them a class.
    +]]> +
    + + Locate all the divs preceding the last item and wrap them with a div with class wrapper - with or without .uniqueSort(). + " ); + +$( "#container-2" ) + .find( ".item" ) + .last() + .prevAll() + .uniqueSort() + .wrapAll( "
    " ); +]]>
    + + +
    1
    +
    2
    +
    3
    + + +
    +
    1
    +
    2
    +
    3
    +
    ]]>
    diff --git a/entries/prop.xml b/entries/prop.xml index 49cccedae..5506d40b9 100644 --- a/entries/prop.xml +++ b/entries/prop.xml @@ -42,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" ) @@ -81,13 +74,13 @@ Display the checked property and attribute of a checkbox as it changes. " + $input.attr( "checked" ) + "
    " + ".prop( \"checked\" ): " + $input.prop( "checked" ) + "
    " + ".is( \":checked\" ): " + $input.is( ":checked" ) + "" ); -}).change(); +} ).trigger( "change" ); ]]>
    -

    Important: the .removeProp() method should not be used to set these properties to false. Once a native property is removed, it cannot be added again. See .removeProp() for more information.

    +

    Important: the .removeProp() method should not be used to remove native properties. This will lead to unexpected behavior. See .removeProp() for more information.

    Computed property values

    By using a function to set properties, you can compute the value based on other properties of the element. For example, to toggle all checkboxes based off their individual values:

    
    diff --git a/entries/queue.xml b/entries/queue.xml
    index 08c5f09aa..ec66c39fd 100644
    --- a/entries/queue.xml
    +++ b/entries/queue.xml
    @@ -119,19 +119,19 @@ $( "#test" ).queue(function( next ) {
         
           Queue a custom function.
           
           
           Set a queue array to delete the queue.
           " )
       .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();
    -});
    +} );
     ]]>
         
         Removes all paragraphs from the DOM
         
         
         Removes all paragraphs that contain "Hello" from the DOM.  Analogous to doing $("p").filter(":contains('Hello')").remove().
         
    diff --git a/entries/removeAttr.xml b/entries/removeAttr.xml
    index 92a92b228..6df348209 100644
    --- a/entries/removeAttr.xml
    +++ b/entries/removeAttr.xml
    @@ -22,7 +22,7 @@ console.log( "onclick property: ", $element[ 0 ].onclick );
         
    -
    -  .removeClass()
    -  
    -    1.0
    -    
    -      One or more space-separated 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.
    -    
    -  
    +
       Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
    -  
    -    

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

    -

    Before jQuery version 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. - - - Hello

    -

    and

    -

    then

    -

    Goodbye

    -]]> -
    - - Remove the class 'blue' and 'under' from the matched elements. - - - Hello

    -

    and

    -

    then

    -

    Goodbye

    -]]> -
    - - Remove all the classes from the matched elements. - - - Hello

    -

    and

    -

    then

    -

    Goodbye

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

    +

    and

    +

    then

    +

    Goodbye

    + ]]> +
    + + Remove the class 'blue' and 'under' from the matched elements. + + + Hello

    +

    and

    +

    then

    +

    Goodbye

    + ]]> +
    + + Remove the class 'blue' and 'under' from the matched elements (3.3+ syntax). + + + Hello

    +

    and

    +

    then

    +

    Goodbye

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

    +

    and

    +

    then

    +

    Goodbye

    + ]]> +
    + + + + + +
    + diff --git a/entries/removeData.xml b/entries/removeData.xml index 3c2cf8ff4..e4dd08b1f 100644 --- a/entries/removeData.xml +++ b/entries/removeData.xml @@ -28,13 +28,13 @@ Set a data store for 2 names then remove one of them. Remove a property for the set of matched elements.

    The .removeProp() method removes properties set by the .prop() method.

    -

    With some built-in properties of a DOM element or window object, browsers may generate an error if an attempt is made to remove the property. jQuery first assigns the value undefined to the property and ignores any error the browser generates. In general, it is only necessary to remove custom properties that have been set on an object, and not built-in (native) properties.

    -

    Note: Do not use this method to remove native properties such as checked, disabled, or selected. This will remove the property completely and, once removed, cannot be added again to element. Use .prop() to set these properties to false instead.

    +

    Note:This method should not be used to remove built-in (native) properties such as "checked", "disabled", "selected", or others. This can lead to unexpected behavior.

    +

    It's almost always better to use .prop() to set native properties to false instead of removing them.

    diff --git a/entries/replaceWith.xml b/entries/replaceWith.xml index dfdd39a79..219e3e640 100644 --- a/entries/replaceWith.xml +++ b/entries/replaceWith.xml @@ -69,7 +69,7 @@ $( "div.third" ).replaceWith( $( ".first" ) ); On click, replace the button with a div containing the same word. " + $( this ).text() + "" ); }); ]]> @@ -108,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() + Bind an event handler to the "resize" 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 .resize( handler ) or .resize( eventData, handler ), use .on( "resize", handler ) or .on( "resize", eventData, handler ), respectively.

    +

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

    +
    +
    + + + + +
    diff --git a/entries/resize.xml b/entries/resize.xml index 3c4f844d3..74cc61fe8 100644 --- a/entries/resize.xml +++ b/entries/resize.xml @@ -1,16 +1,15 @@ - - .resize() - Bind an event handler to the "resize" JavaScript event, or trigger that event on an element. + + +Bind an event handler to the "resize" event, or trigger that event on an element. + + resize event + Bind an event handler to the "resize" event. - 1.0 - - A function to execute each time the event is triggered. - + 1.7 + + The string "resize". - - - 1.4.3 An object containing data that will be passed to the event handler. @@ -19,30 +18,46 @@ - - 1.0 - -

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

    +
    +

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

    +

    The resize event is sent to the window element when the size of the browser window changes:

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

    Now whenever the browser window's size is changed, the message is appended to <div id="log"> one or more times, depending on the browser.

    Code in a resize handler should never rely on the number of times the handler is called. Depending on implementation, resize events can be sent continuously as the resizing is in progress (the typical behavior in Internet Explorer and WebKit-based browsers such as Safari and Chrome), or only once at the end of the resize operation (the typical behavior in some other browsers such as Opera).

    - To see the window width while (or after) it is resized, try: " + $( window ).width() + "" ); -}); +} ); ]]> - + +
    + + + 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 8529cb0c7..5f46ddfe0 100644 --- a/entries/scroll.xml +++ b/entries/scroll.xml @@ -1,16 +1,15 @@ - - .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. @@ -19,11 +18,10 @@ - - 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:

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

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

    @@ -49,33 +47,32 @@

    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.

    - To do something when your page is scrolled: - + + + + + scroll event + Trigger the "scroll" event on an element. + + 1.0 + + The string "scroll". + + + +

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

    +
    + +
    + + diff --git a/entries/scrollLeft.xml b/entries/scrollLeft.xml index 2b53896bd..7fe21491a 100644 --- a/entries/scrollLeft.xml +++ b/entries/scrollLeft.xml @@ -16,8 +16,8 @@ Get the scrollLeft of a paragraph. Get the scrollTop of a paragraph. + + .select() + Bind an event handler to the "select" 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 .select( handler ) or .select( eventData, handler ), use .on( "select", handler ) or .on( "select", eventData, handler ), respectively.

    +

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

    +
    +
    + + + + +
    diff --git a/entries/select.xml b/entries/select.xml index 244cee7cb..605738810 100644 --- a/entries/select.xml +++ b/entries/select.xml @@ -1,16 +1,15 @@ - - .select() - Bind an event handler to the "select" JavaScript event, or trigger that event on an element. + +Bind an event handler to the "select" event, or trigger that event on an element. + + + select event + Bind an event handler to the "select" event. - 1.0 - - A function to execute each time the event is triggered. - + 1.7 + + The string "select". - - - 1.4.3 An object containing data that will be passed to the event handler. @@ -19,11 +18,10 @@ - - 1.0 - -

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

    +
    +

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

    +

    The select event is sent to an element when the user makes a text selection inside it. This event is limited to <input type="text"> fields and <textarea> boxes.

    For example, consider the HTML:

    
    @@ -35,32 +33,31 @@
     </div>

    The event handler can be bound to the text input:

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

    Now when any portion of the text is selected, the alert is displayed. Merely setting the location of the insertion point will not trigger the event. To trigger the event manually, apply .select() without an argument:

    +

    Now when any portion of the text is selected, the alert is displayed. Merely setting the location of the insertion point will not trigger the event. To trigger the event manually, use .trigger( "select" ):

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

    After this code executes, clicks on the Trigger button will also alert the message:

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

    In addition, the default select action on the field will be fired, so the entire text field will be selected.

    The method for retrieving the current selected text differs from one browser to another. A number of jQuery plug-ins offer cross-platform solutions.

    - To do something when text in input boxes is selected: To trigger the select event on all input elements, try: - + +
    + + + 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. A selector representing selector passed to jQuery(), if any, when creating the original set. -

    The .selector property was deprecated in jQuery 1.7 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. The property was never a reliable indicator of the selector that could be used to obtain the set of elements currently contained in the jQuery set where it was a property, since subsequent traversal methods may have changed the set. Plugins that need to use a selector string within their plugin can require it as a parameter of the method. For example, a "foo" plugin could be written as $.fn.foo = function( selector, options ) { /* plugin code goes here */ };, and the person using the plugin would write $( "div.bar" ).foo( "div.bar", {dog: "bark"} ); with the "div.bar" selector repeated as the first argument of .foo().

    +
    +

    Note: This API has been removed in jQuery 3.0. The property was never a reliable indicator of the selector that could be used to obtain the set of elements currently contained in the jQuery set where it was a property, since subsequent traversal methods may have changed the set. Plugins that need to use a selector string within their plugin can require it as a parameter of the method. For example, a "foo" plugin could be written as $.fn.foo = function( selector, options ) { /* plugin code goes here */ };, and the person using the plugin would write $( "div.bar" ).foo( "div.bar", {dog: "bark"} ); with the "div.bar" selector repeated as the first argument of .foo().

    +
    diff --git a/entries/serializeArray.xml b/entries/serializeArray.xml index b2df233e1..09125d062 100644 --- a/entries/serializeArray.xml +++ b/entries/serializeArray.xml @@ -31,10 +31,10 @@

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

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

    
    -$( "form" ).submit(function( event ) {
    +$( "form" ).on( "submit", function( event ) {
       console.log( $( this ).serializeArray() );
       event.preventDefault();
    -});
    +} );
         

    This produces the following data structure (provided that the browser supports console.log):

    
    @@ -70,11 +70,11 @@ $( "form" ).submit(function( event ) {
         $( "#results" ).empty();
         jQuery.each( fields, function( i, field ) {
           $( "#results" ).append( field.value + " " );
    -    });
    +    } );
       }
     
    -  $( ":checkbox, :radio" ).click( showValues );
    -  $( "select" ).change( showValues );
    +  $( ":checkbox, :radio" ).on( "click", showValues );
    +  $( "select" ).on( "change", showValues );
       showValues();
     ]]>
         
         Animates all hidden paragraphs to show slowly, completing the animation within 600 milliseconds.
         
    @@ -84,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.
         
    @@ -120,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();
    -});
    +} );
     ]]>
         
       Return the number of elements in the jQuery object.
       
    -    

    The .size() method is deprecated as of jQuery 1.8. Use the .length property instead.

    +
    +

    Note: This method has been removed in jQuery 3.0. Use the .length property instead.

    +

    The .size() method is functionally equivalent to the .length property; however, the .length property is preferred because it does not have the overhead of a function call.

    Given a simple unordered list on the page:

    @@ -30,38 +32,18 @@ alert( "Size: " + $( "li" ).length );

    - Count the divs. Click to add more. + Count the divs. " ) ); var n = $( "div" ).size(); $( "span" ).text( "There are " + n + " divs. Click to add more." ); - }) + } ) // Trigger the click to start - .click(); + .trigger( "click" ); ]]> - - -
    -]]>
    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 ); ]]>

    With the element initially hidden, we can show it slowly:

    
    -$( "#clickme" ).click(function() {
    +$( "#clickme" ).on( "click", function() {
       $( "#book" ).slideDown( "slow", function() {
         // Animation complete.
       });
    @@ -54,13 +54,13 @@ $( "#clickme" ).click(function() {
       
         Animates all divs to slide down and show themselves over 600 milliseconds.
         
         
         Animates all inputs to slide down, completing the animation within 1000 milliseconds. Once the animation is done, the input look is changed especially if it is the middle input which gets the focus.
         
         

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

    
    -$( "#clickme" ).click(function() {
    +$( "#clickme" ).on( "click", function() {
       $( "#book" ).slideToggle( "slow", function() {
         // Animation complete.
       });
    @@ -63,7 +63,7 @@ $( "#clickme" ).click(function() {
       
         Animates all paragraphs to slide up or down, completing the animation within 600 milliseconds.
         
    @@ -84,7 +84,7 @@ $( "button" ).click(function() {
       
         Animates divs between dividers with a toggle that makes some appear and some disappear.
         

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

    
    -$( "#clickme" ).click(function() {
    +$( "#clickme" ).on( "click", function() {
       $( "#book" ).slideUp( "slow", function() {
         // Animation complete.
       });
    @@ -54,13 +54,13 @@ $( "#clickme" ).click(function() {
       
         Animates all divs to slide up, completing the animation within 400 milliseconds.
         
         
         Animates the parent paragraph to slide up, completing the animation within 200 milliseconds. Once the animation is done, it displays an alert.
         Click the Go button once to start the animation, then click the STOP button to stop it where it's currently positioned.  Another option is to click several buttons to queue them up and see that stop just kills the currently playing one.
         
    diff --git a/entries/submit-selector.xml b/entries/submit-selector.xml
    index a4c9aa01d..f6c48b8ff 100644
    --- a/entries/submit-selector.xml
    +++ b/entries/submit-selector.xml
    @@ -15,25 +15,25 @@
         " + inputEl[ 0 ].nodeName + inputType + "" );
    -})
    +} );
     ]]>
         
    +
    +  .submit()
    +  Bind an event handler to the "submit" 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 .submit( handler ) or .submit( eventData, handler ), use .on( "submit", handler ) or .on( "submit", eventData, handler ), respectively.

    +

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

    +
    +
    + + + + +
    diff --git a/entries/submit.xml b/entries/submit.xml index 2bae27644..42a32ea11 100644 --- a/entries/submit.xml +++ b/entries/submit.xml @@ -1,16 +1,15 @@ - - .submit() - Bind an event handler to the "submit" JavaScript event, or trigger that event on an element. + +Bind an event handler to the "submit" event, or trigger that event on an element. + + + submit event + Bind an event handler to the "submit" event. - 1.0 - - A function to execute each time the event is triggered. - + 1.7 + + The string "submit". - - - 1.4.3 An object containing data that will be passed to the event handler. @@ -19,11 +18,10 @@ - - 1.0 - -

    This method is a shortcut for .on( "submit", handler ) in the first variation, and .trigger( "submit" ) in the third.

    +
    +

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

    +

    The submit event is sent to an element when the user is attempting to submit a form. It can only be attached to <form> elements. Forms can be submitted either by clicking an explicit <input type="submit">, <input type="image">, or <button type="submit">, or by pressing Enter when certain form elements have focus.

    Depending on the browser, the Enter key may only cause a form submission if the form has exactly one text field, or only when there is a submit button present. The interface should not rely on a particular behavior for this key unless the issue is forced by observing the keypress event for presses of the Enter key.

    @@ -39,34 +37,33 @@ </div>

    The event handler can be bound to the form:

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

    Now when the form is submitted, the message is alerted. This happens prior to the actual submission, so we can cancel the submit action by calling .preventDefault() on the event object or by returning false from our handler. We can trigger the event manually when another element is clicked:

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

    After this code executes, clicks on Trigger the handler will also display the message. In addition, the default submit action on the form will be fired, so the form will be submitted.

    The JavaScript submit event does not bubble in Internet Explorer. However, scripts that rely on event delegation with the submit event will work consistently across browsers as of jQuery 1.4, which has normalized the event's behavior.

    - If you'd like to prevent forms from being submitted unless a flag variable is set, try: If you'd like to prevent forms from being submitted unless a flag variable is set, try: 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/text-selector.xml b/entries/text-selector.xml index 9af4dc445..4886c3a50 100644 --- a/entries/text-selector.xml +++ b/entries/text-selector.xml @@ -19,19 +19,19 @@ $( "<input>" ).is( ":text" ); // true Finds all text inputs. Demonstration Box list item 1 list item 2

    -

    The .text() method cannot be used on form inputs or scripts. To set or get the text value of input or textarea elements, use the .val() method. To get the value of a script element, use the .html() method.

    +

    The .text() method should not be used on form inputs or scripts. To set or get the text value of input or textarea elements, use the .val() method. To get the value of a script element, use the .html() method.

    As of jQuery 1.4, the .text() method returns the value of text and CDATA nodes as well as element nodes.

    Find the text in the first paragraph (stripping out the html), then set the html of the last paragraph to show it is just text (the red bold is gone). <p>This is a test</p> -

    The .text() method cannot be used on input elements. For input field text, use the .val() method.

    +

    The .text() method should not be used on input elements. For input field text, use the .val() method.

    As of jQuery 1.4, the .text() method allows us to set the text content by passing in a function.

    
     $( "ul li" ).text(function( index ) {
    diff --git a/entries/toggle.xml b/entries/toggle.xml
    index deb0224dd..7d74577fe 100644
    --- a/entries/toggle.xml
    +++ b/entries/toggle.xml
    @@ -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.
       });
    @@ -92,9 +92,9 @@ if ( display === true ) {
       
         Toggles all paragraphs.
         
         Toggle
    @@ -105,7 +105,7 @@ $( "button" ).click(function() {
       
         Animates all paragraphs to be shown if they are hidden and hidden if they are visible, completing the animation within 600 milliseconds.
         
    @@ -126,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 dfe45f2d0..b42f23290 100644
    --- a/entries/toggleClass.xml
    +++ b/entries/toggleClass.xml
    @@ -5,16 +5,31 @@
         
           1.0
           
    -        One or more class names (separated by spaces) to be toggled for each element in the matched set.
    +        One or more classes (separated by spaces) to be toggled for each element in the matched set.
           
         
         
           1.3
           
    -        One or more class names (separated by spaces) to be toggled for each element in the matched set.
    +        One or more classes (separated by spaces) to be toggled for each element in the matched set.
           
           
    -        A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed.
    +        A boolean (not just truthy/falsy) value to determine whether the class should be added or removed.
    +      
    +    
    +    
    +      3.3
    +      
    +        An array of classes to be toggled for each element in the matched set.
    +      
    +    
    +    
    +      3.3
    +      
    +        An array of classes to be toggled for each element in the matched set.
    +      
    +      
    +        A boolean (not just truthy/falsy) value to determine whether the class should be added or removed.
           
         
         
    @@ -24,7 +39,21 @@
             
             
             
    -        A function that returns class names to be toggled in the class attribute of each element in the matched set. Receives the index position of the element in the set, the old class value, and the state as arguments.
    +        A function 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.
    @@ -32,7 +61,7 @@
         
         Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the state argument.
         
    -      

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

    +

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

    
     <div class="tumble">Some text.</div>
           
    @@ -55,7 +84,7 @@ if ( addOrRemove ) { $( "#foo" ).removeClass( className ); }
    -

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

    +

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

    
     $( "div.foo" ).toggleClass(function() {
       if ( $( this ).parent().is( ".bar" ) ) {
    @@ -70,7 +99,7 @@ $( "div.foo" ).toggleClass(function() {
         
           Toggle the class 'highlight' when a paragraph is clicked.
           
    @@ -99,15 +128,15 @@ $( "p" ).click(function() {
           Add the "highlight" class to the clicked paragraph on every third click of that paragraph, remove it every first and second click.
           
           
         
         
    +    
    +    
       
    -  
    +  
         
           1.4
           
    @@ -208,5 +239,6 @@ $( "a" ).on( "click", function( event ) {
         
           
    This signature (only!) is deprecated as of jQuery 3.0.
    +
    - \ No newline at end of file + diff --git a/entries/trigger.xml b/entries/trigger.xml index 91e3c26a8..caff8cb8f 100644 --- a/entries/trigger.xml +++ b/entries/trigger.xml @@ -51,14 +51,14 @@ $( "#foo").trigger( "custom", [ "Custom", "Event" ] ); Clicks to button #2 also trigger a click for button #1. To submit the first form without using the submit() function, try: To submit the first form without using the submit() function, try: To pass arbitrary data to an event: diff --git a/entries/triggerHandler.xml b/entries/triggerHandler.xml index d72516a8d..83b2a576f 100644 --- a/entries/triggerHandler.xml +++ b/entries/triggerHandler.xml @@ -37,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. Focused!" ).appendTo( "body" ).fadeOut( 1000 ); -}); +} ); ]]> .trigger( "focus" ) diff --git a/entries/unbind.xml b/entries/unbind.xml index 8b91e66a5..6a85004ec 100644 --- a/entries/unbind.xml +++ b/entries/unbind.xml @@ -102,12 +102,12 @@ This example is also an illustration of a closure. Since the handler refers to t function aClick() { $( "div" ).show().fadeOut( "slow" ); } -$( "#bind" ).click(function() { +$( "#bind" ).on( "click", function() { $( "#theone" ) .bind( "click", aClick ) .text( "Can Click!" ); }); -$( "#unbind" ).click(function() { +$( "#unbind" ).on( "click", function() { $( "#theone" ) .unbind( "click", aClick ) .text( "Does nothing..." ); diff --git a/entries/undelegate.xml b/entries/undelegate.xml index f97e6b01b..f3a985963 100644 --- a/entries/undelegate.xml +++ b/entries/undelegate.xml @@ -52,12 +52,12 @@ function aClick() { $( "div" ).show().fadeOut( "slow" ); } -$( "#bind" ).click(function() { +$( "#bind" ).on( "click", function() { $( "body" ) .delegate( "#theone", "click", aClick ) .find( "#theone" ).text( "Can Click!" ); }); -$( "#unbind" ).click(function() { +$( "#unbind" ).on( "click", function() { $( "body" ) .undelegate( "#theone", "click", aClick ) .find( "#theone" ).text( "Does nothing..." ); diff --git a/entries/uniqueSort.xml b/entries/uniqueSort.xml new file mode 100644 index 000000000..999f15b0f --- /dev/null +++ b/entries/uniqueSort.xml @@ -0,0 +1,112 @@ + + + .uniqueSort() + + 3.7 + + Sorts a jQuery object of DOM elements, in place, with the duplicates removed. Note that this only works on jQuery objects consisting of DOM elements, not strings or numbers. + +

    The .uniqueSort() function searches through a jQuery object, sorting it in document order, and removing any duplicate nodes. A node is considered a duplicate if it is the exact same node as one already in the jQuery object; two different nodes with identical attributes are not considered to be duplicates. This function only works on jQuery objects consisting of DOM elements.

    +
    + + Removes any duplicate elements from the jQuery object of divs. + + + There are 6 divs in this document. +
    +
    +
    +
    +
    +]]> +
    + + Locate all the divs preceding the last item and wrap them with a div with class wrapper - with or without .uniqueSort(). + " ); + +$( "#container-2" ) + .find( ".item" ) + .last() + .prevAll() + .uniqueSort() + .wrapAll( "
    " ); +]]>
    + + +
    1
    +
    2
    +
    3
    + + +
    +
    1
    +
    2
    +
    3
    +
    +]]> +
    + + +
    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 1306ddd6d..05d1c27a4 100644 --- a/entries/unload.xml +++ b/entries/unload.xml @@ -1,15 +1,15 @@ - - .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. @@ -18,33 +18,49 @@ - 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 similar beforeunload event.

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

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

    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 ff6d6100d..b2dde6046 100644 --- a/entries/unwrap.xml +++ b/entries/unwrap.xml @@ -18,7 +18,7 @@ Wrap/unwrap a div around each of the paragraphs. Multiple: " + multipleValues.join( ", " ) ); } -$( "select" ).change( displayVals ); +$( "select" ).on( "change", displayVals ); displayVals(); ]]> Find the value of an input box. Set the value of an input box. Make all visible divs turn yellow on click. Get the current computed width for the first element in the set of matched elements. -

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

    +

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

    Figure 1 - Illustration of the measured width
    @@ -26,7 +26,7 @@ $( document ).width();

    Note: Although style and script tags will report a value for .width() or height() when absolutely positioned and given display:block, it is strongly discouraged to call those methods on these tags. In addition to being a bad practice, the results may also prove unreliable.

    - + Show various widths. Note the values are from the iframe so might be smaller than you expected. The yellow highlight shows the iframe body. @@ -34,15 +34,15 @@ $( document ).width(); function showWidth( ele, w ) { $( "div" ).text( "The width for the " + ele + " is " + w + "px." ); } -$( "#getp" ).click(function() { +$( "#getp" ).on( "click", function() { showWidth( "paragraph", $( "p" ).width() ); -}); -$( "#getd" ).click(function() { +} ); +$( "#getd" ).on( "click", function() { showWidth( "document", $( document ).width() ); -}); -$("#getw").click(function() { +} ); +$("#getw").on( "click", function() { showWidth( "window", $( window ).width() ); -}); +} ); ]]>
    demo</title> <style> </style> - <script src="https://code.jquery.com/jquery-1.10.2.js"></script> + <script src="https://code.jquery.com/jquery-3.7.1.js"></script> <script> </script> diff --git a/includes/complete-argument.xml b/includes/complete-argument.xml index 5d109f39e..4ef06fa39 100644 --- a/includes/complete-argument.xml +++ b/includes/complete-argument.xml @@ -1,4 +1,4 @@ - A function to call once the animation is complete, called once per matched element. + 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 168e86488..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. - - - - - An object containing 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 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 - - + + 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 cfaf9bfb3..6963dad28 100644 --- a/notes.xsl +++ b/notes.xsl @@ -17,7 +17,7 @@ Selected elements are in the order of their appearance in the document. - Forms and their child elements should not use input names or ids that conflict with properties of a form, such as submit, length, or method. Name conflicts can cause confusing failures. For a complete list of rules and to check your markup for these problems, see DOMLint. + Forms and their child elements should not use input names or ids that conflict with properties of a form, such as submit, length, or method. Name conflicts can cause confusing failures. For a complete list of rules and to check your markup for these problems, see DOMLint. The value reported by is not guaranteed to be accurate when the element or its parent is hidden. To get an accurate value, ensure the element is visible before using . jQuery will attempt to temporarily show and then re-hide an element in order to measure its dimensions, but this is unreliable and (even when accurate) can significantly impact page performance. This show-and-rehide measurement feature may be removed in a future version of jQuery. @@ -50,10 +50,10 @@ 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. @@ -64,11 +64,8 @@ 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 the .() method is just a shorthand for .on( "", handler ), detaching is possible using .off( "" ). - - As of jQuery 1.9, all the handlers for the jQuery global Ajax events, including those added with the method, must be attached to document. + 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 index fb070fc42..5469efe8e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,665 +1,1291 @@ { "name": "api.jquery.com", - "version": "1.12.31", - "lockfileVersion": 1, + "version": "3.3.14", + "lockfileVersion": 3, "requires": true, - "dependencies": { - "abbrev": { + "packages": { + "": { + "name": "api.jquery.com", + "version": "3.3.14", + "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/abbrev/-/abbrev-1.1.0.tgz", - "integrity": "sha1-0FVMIlZjbi9W58LlrRg/hZQo2B8=" - }, - "argparse": { - "version": "0.1.16", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-0.1.16.tgz", - "integrity": "sha1-z9AeD7uj1srtBJ+9dY1A9lGW9Xw=", - "requires": { - "underscore": "1.7.0", - "underscore.string": "2.4.0" - }, - "dependencies": { - "underscore.string": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.4.0.tgz", - "integrity": "sha1-jN2PusTi0uoefi6Al8QvRCKA+Fs=" - } + "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", + "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==", + "engines": { + "node": ">=0.10.0" } }, - "async": { - "version": "0.1.22", - "resolved": "https://registry.npmjs.org/async/-/async-0.1.22.tgz", - "integrity": "sha1-D8GqoIig4+8Ovi2IMbqw3PiEUGE=" + "node_modules/async": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", + "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==" }, - "balanced-match": { + "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/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" - }, - "brace-expansion": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", - "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", - "requires": { - "balanced-match": "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" } }, - "cheerio": { - "version": "0.17.0", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.17.0.tgz", - "integrity": "sha1-+lrkLMYBIRM9KW0LRtmDIV9yaOo=", - "requires": { - "CSSselect": "0.4.1", - "dom-serializer": "0.0.1", - "entities": "1.1.1", - "htmlparser2": "3.7.3", - "lodash": "2.4.2" + "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": { - "lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=" - } + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "coffee-script": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.3.3.tgz", - "integrity": "sha1-FQ1rTLUiiUNp7+1qIQHCC8f0pPQ=" + "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" + } }, - "colors": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz", - "integrity": "sha1-JCP+ZnisDF2uiFLl0OW+CMmXq8w=" + "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" + } }, - "concat-map": { + "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=" }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + "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" + } }, - "CSSselect": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/CSSselect/-/CSSselect-0.4.1.tgz", - "integrity": "sha1-+Kt+H4QYzmPNput713ioXX7EkrI=", - "requires": { - "CSSwhat": "0.4.7", - "domutils": "1.4.3" + "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" } }, - "CSSwhat": { - "version": "0.4.7", - "resolved": "https://registry.npmjs.org/CSSwhat/-/CSSwhat-0.4.7.tgz", - "integrity": "sha1-hn2g/zn3eGEyQsRM/qg/CqTr35s=" + "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": "*" + } }, - "dateformat": { - "version": "1.0.2-1.2.3", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.2-1.2.3.tgz", - "integrity": "sha1-sCIMAt6YYXQztyhRz0fePfLNvuk=" + "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" + } }, - "dom-serializer": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.0.1.tgz", - "integrity": "sha1-lYmCfx4y0iw3yCmtq9WbMkevjq8=", - "requires": { - "domelementtype": "1.1.3", - "entities": "1.1.1" - }, + "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": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", - "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=" - } + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" } }, - "domelementtype": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz", - "integrity": "sha1-sXrtguirWeUt2cGbF1bg/BhyBMI=" + "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" + } + ] }, - "domhandler": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.2.1.tgz", - "integrity": "sha1-Wd+dzSJ+gIs2Wuc+H2aErD2Ub8I=", - "requires": { - "domelementtype": "1.3.0" + "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" } }, - "domutils": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.4.3.tgz", - "integrity": "sha1-CGVRN5bGswYDGFDhdVFrr4C3Km8=", - "requires": { - "domelementtype": "1.3.0" + "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" } }, - "entities": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz", - "integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA=" + "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" + } }, - "esprima": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz", - "integrity": "sha1-n1V+CPw7TSbs6d00+Pv0drYlha0=" + "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" + } }, - "eventemitter2": { + "node_modules/eventemitter2": { "version": "0.4.14", "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-0.4.14.tgz", "integrity": "sha1-j2G3XN4BKy6esoTUVFWDtWQ7Yas=" }, - "exit": { + "node_modules/exit": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=" - }, - "findup-sync": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.1.3.tgz", - "integrity": "sha1-fz56l7gjksZTvwZYm9hRkOk8NoM=", - "requires": { - "glob": "3.2.11", - "lodash": "2.4.2" - }, - "dependencies": { - "glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", - "integrity": "sha1-Spc/Y1uRkPcV0QmH1cAP0oFevj0=", - "requires": { - "inherits": "2.0.3", - "minimatch": "0.3.0" - } - }, - "lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=" - }, - "minimatch": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", - "integrity": "sha1-J12O2qxPG7MyZHIInnlJyDlGmd0=", - "requires": { - "lru-cache": "2.7.3", - "sigmund": "1.0.1" - } - } + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "engines": { + "node": ">= 0.8.0" } }, - "getobject": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/getobject/-/getobject-0.1.0.tgz", - "integrity": "sha1-BHpEl4n6Fg0Bj1SG7ZEyC27HiFw=" + "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" + } }, - "gilded-wordpress": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/gilded-wordpress/-/gilded-wordpress-1.0.3.tgz", - "integrity": "sha1-kh/iJ93yWyxAgp5QUjsOMXRDsz4=", - "requires": { - "async": "0.9.2", - "glob": "4.0.6", - "wordpress": "1.1.2" - }, - "dependencies": { - "async": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", - "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=" - }, - "glob": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-4.0.6.tgz", - "integrity": "sha1-aVxQvdTi+1xdNwsJHziNNwfikac=", - "requires": { - "graceful-fs": "3.0.11", - "inherits": "2.0.3", - "minimatch": "1.0.0", - "once": "1.4.0" - } - }, - "graceful-fs": { - "version": "3.0.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.11.tgz", - "integrity": "sha1-dhPHeKGv6mLyXGMKCG1/Osu92Bg=", - "requires": { - "natives": "1.1.0" - } - }, - "minimatch": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-1.0.0.tgz", - "integrity": "sha1-4N0hILSeG3JM6NcUxSCCKpQ4V20=", - "requires": { - "lru-cache": "2.7.3", - "sigmund": "1.0.1" - } - } + "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" } }, - "glob": { - "version": "3.1.21", - "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz", - "integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=", - "requires": { - "graceful-fs": "1.2.3", - "inherits": "1.0.2", - "minimatch": "0.2.14" + "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": { - "inherits": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz", - "integrity": "sha1-ykMJ2t7mtUzAuNJH6NfHoJdb3Js=" - } + "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" } }, - "graceful-fs": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz", - "integrity": "sha1-FaSAaldUfLLS2/J/QuiajDRRs2Q=" - }, - "grunt": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/grunt/-/grunt-0.4.5.tgz", - "integrity": "sha1-VpN81RlDJK3/bSB2MYMqnWuk5/A=", - "requires": { - "async": "0.1.22", - "coffee-script": "1.3.3", - "colors": "0.6.2", - "dateformat": "1.0.2-1.2.3", - "eventemitter2": "0.4.14", - "exit": "0.1.2", - "findup-sync": "0.1.3", - "getobject": "0.1.0", - "glob": "3.1.21", - "grunt-legacy-log": "0.1.3", - "grunt-legacy-util": "0.2.0", - "hooker": "0.2.3", - "iconv-lite": "0.2.11", - "js-yaml": "2.0.5", - "lodash": "0.9.2", - "minimatch": "0.2.14", - "nopt": "1.0.10", - "rimraf": "2.2.8", - "underscore.string": "2.2.1", - "which": "1.0.9" - } - }, - "grunt-check-modules": { + "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/grunt-check-modules/-/grunt-check-modules-1.0.0.tgz", - "integrity": "sha1-Y/9erkYTF5tKifaozTcfekAfd4I=" + "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" + } }, - "grunt-cli": { + "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-cli/-/grunt-cli-1.1.0.tgz", - "integrity": "sha1-r9eWmTTd8zYg6ER+3B+pTlHlWjQ=", - "requires": { - "findup-sync": "0.3.0", - "nopt": "3.0.6", - "resolve": "1.1.7" - }, - "dependencies": { - "findup-sync": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz", - "integrity": "sha1-N5MKpdgWt3fANEXhlmzGeQpMCxY=", - "requires": { - "glob": "5.0.15" - } - }, - "glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", - "requires": { - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "requires": { - "brace-expansion": "1.1.8" - } - }, - "nopt": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", - "requires": { - "abbrev": "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" } }, - "grunt-jquery-content": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/grunt-jquery-content/-/grunt-jquery-content-3.0.1.tgz", - "integrity": "sha1-aHdrx0G1SVEdaPBouVCsizd+g90=", - "requires": { - "async": "0.9.0", - "cheerio": "0.17.0", - "grunt-check-modules": "1.0.0", - "grunt-wordpress": "2.1.2", - "he": "0.5.0", - "highlight.js": "7.3.0", - "marked": "0.3.2", - "rimraf": "2.2.8", - "spawnback": "1.0.0", - "which": "1.0.5", - "wordpress": "1.1.2" - }, - "dependencies": { - "async": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/async/-/async-0.9.0.tgz", - "integrity": "sha1-rDYTsdqb7RtHUQu0ZRuJMeRxRsc=" - }, - "which": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/which/-/which-1.0.5.tgz", - "integrity": "sha1-VjDWgZ3aaS8UZEYueVbLQsCEJzk=" - } + "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" } }, - "grunt-legacy-log": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-0.1.3.tgz", - "integrity": "sha1-7ClCboAwIa9ZAp+H0vnNczWgVTE=", - "requires": { - "colors": "0.6.2", - "grunt-legacy-log-utils": "0.1.1", - "hooker": "0.2.3", - "lodash": "2.4.2", - "underscore.string": "2.3.3" - }, - "dependencies": { - "lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=" - }, - "underscore.string": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz", - "integrity": "sha1-ccCL9rQosRM/N+ePo6Icgvcymw0=" - } + "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" } }, - "grunt-legacy-log-utils": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/grunt-legacy-log-utils/-/grunt-legacy-log-utils-0.1.1.tgz", - "integrity": "sha1-wHBrndkGThFvNvI/5OawSGcsD34=", - "requires": { - "colors": "0.6.2", - "lodash": "2.4.2", - "underscore.string": "2.3.3" - }, - "dependencies": { - "lodash": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz", - "integrity": "sha1-+t2DS5aDBz2hebPq5tnA0VBT9z4=" - }, - "underscore.string": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz", - "integrity": "sha1-ccCL9rQosRM/N+ePo6Icgvcymw0=" - } + "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" } }, - "grunt-legacy-util": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/grunt-legacy-util/-/grunt-legacy-util-0.2.0.tgz", - "integrity": "sha1-kzJIhNv343qf98Am3/RR2UqeVUs=", - "requires": { - "async": "0.1.22", - "exit": "0.1.2", - "getobject": "0.1.0", - "hooker": "0.2.3", - "lodash": "0.9.2", - "underscore.string": "2.2.1", - "which": "1.0.9" + "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" } }, - "grunt-wordpress": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/grunt-wordpress/-/grunt-wordpress-2.1.2.tgz", - "integrity": "sha1-ue3Lv5jp6HM9F6gsMmWf2zbO2LE=", - "requires": { - "gilded-wordpress": "1.0.3" + "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" } }, - "he": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/he/-/he-0.5.0.tgz", - "integrity": "sha1-LAX/rvkLaOhg8/0rVO9YCYknfuI=" + "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" + } }, - "highlight.js": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-7.3.0.tgz", - "integrity": "sha1-bF8PZOcHj2ZAK82/yJEQw/0bqZ8=" + "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" + } }, - "hooker": { + "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=" - }, - "htmlparser2": { - "version": "3.7.3", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.7.3.tgz", - "integrity": "sha1-amTHdjfAjG8w7CqBV6UzM758sF4=", - "requires": { - "domelementtype": "1.3.0", - "domhandler": "2.2.1", - "domutils": "1.5.1", - "entities": "1.0.0", - "readable-stream": "1.1.14" - }, - "dependencies": { - "domutils": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", - "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", - "requires": { - "dom-serializer": "0.0.1", - "domelementtype": "1.3.0" - } - }, - "entities": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz", - "integrity": "sha1-sph6o4ITR/zeZCsk/fyeT7cSvyY=" + "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" } }, - "iconv-lite": { - "version": "0.2.11", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.2.11.tgz", - "integrity": "sha1-HOYKOleGSiktEyH/RgnKS7llrcg=" + "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" + } }, - "inflight": { + "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" } }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" }, - "js-yaml": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-2.0.5.tgz", - "integrity": "sha1-olrmUJmZ6X3yeMZxnaEb0Gh3Q6g=", - "requires": { - "argparse": "0.1.16", - "esprima": "1.0.4" + "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" } }, - "lodash": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-0.9.2.tgz", - "integrity": "sha1-jzSZxSRdNG1oLlsNO0B2fgnxqSw=" + "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" + } }, - "lru-cache": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", - "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=" + "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" + } }, - "marked": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.2.tgz", - "integrity": "sha1-AV2xWIZEOPJKZL3WGgQotBhwbQk=" + "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" + } }, - "minimatch": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", - "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", - "requires": { - "lru-cache": "2.7.3", - "sigmund": "1.0.1" + "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" } }, - "natives": { + "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/natives/-/natives-1.1.0.tgz", - "integrity": "sha1-6f+EFBimsux6SV6TmYT3jxY+bjE=" + "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" + } }, - "nopt": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", - "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", - "requires": { - "abbrev": "1.1.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" } }, - "once": { + "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "requires": { - "wrappy": "1.0.2" + "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" } }, - "path-is-absolute": { + "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=" - }, - "readable-stream": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=" - }, - "rimraf": { - "version": "2.2.8", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", - "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=" - }, - "sax": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/sax/-/sax-0.6.1.tgz", - "integrity": "sha1-VjsZx8HeiS4Jv8Ty/DDjwn8JUrk=" - }, - "sigmund": { + "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/sigmund/-/sigmund-1.0.1.tgz", - "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=" + "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" + } }, - "spawnback": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/spawnback/-/spawnback-1.0.0.tgz", - "integrity": "sha1-9zZi9+VNlTZ+ynTWQmxnfdfqaG8=" - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - }, - "underscore": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz", - "integrity": "sha1-a7rwh3UA02vjTsqlhODbn+8DUgk=" - }, - "underscore.string": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.2.1.tgz", - "integrity": "sha1-18D6KvXVoaZ/QlPa7pgTLnM/Dxk=" - }, - "which": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/which/-/which-1.0.9.tgz", - "integrity": "sha1-RgwdoPgQED0DIam2M6+eV15kSG8=" - }, - "wordpress": { + "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/wordpress/-/wordpress-1.1.2.tgz", - "integrity": "sha1-uDZhhSBVSXESG8VsQ7A5yzgg94M=", - "requires": { - "xmlrpc": "1.3.1" + "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" } }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + "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" + } }, - "xmlbuilder": { - "version": "2.6.5", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-2.6.5.tgz", - "integrity": "sha1-b/etYPty0idk8AehZLd/K/FABSY=", - "requires": { - "lodash": "3.10.1" + "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": { - "lodash": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", - "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=" - } + "homedir-polyfill": "^1.0.1" + }, + "engines": { + "node": ">= 0.10" } }, - "xmlrpc": { + "node_modules/which": { "version": "1.3.1", - "resolved": "https://registry.npmjs.org/xmlrpc/-/xmlrpc-1.3.1.tgz", - "integrity": "sha1-OqWCCG/vUwz+Hc2qDEyd3F0ORFE=", - "requires": { - "sax": "0.6.1", - "xmlbuilder": "2.6.5" + "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 4bfeeb705..8a6ed809d 100644 --- a/package.json +++ b/package.json @@ -1,31 +1,12 @@ { "name": "api.jquery.com", - "title": "jQuery API Docs", - "description": "API reference documentation for the jQuery JavaScript Library.", - "version": "1.12.31", - "homepage": "https://github.com/jquery/api.jquery.com", - "author": { - "name": "jQuery Foundation and other contributors" - }, - "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": "https://github.com/jquery/api.jquery.com/blob/master/LICENSE.txt" - } - ], + "version": "3.3.14", + "private": true, "scripts": { "test": "grunt lint" }, "dependencies": { - "grunt": "0.4.5", - "grunt-cli": "1.1.0", - "grunt-jquery-content": "3.0.1" + "grunt": "1.6.1", + "grunt-jquery-content": "3.3.2" } } diff --git a/pages/Ajax_Events.html b/pages/Ajax_Events.html index 26a59f0fd..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();
      });
     
    diff --git a/pages/Types.html b/pages/Types.html index 612caa101..16a3a7c1b 100644 --- a/pages/Types.html +++ b/pages/Types.html @@ -1,6 +1,6 @@