diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 00000000..8b808995
--- /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 00000000..2173722b
--- /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 00000000..aa2f7456
--- /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 00000000..26f673d8
--- /dev/null
+++ b/.github/workflows/node.js.yml
@@ -0,0 +1,30 @@
+# 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: Install xmllint
+ run: sudo apt-get install -y libxml2-utils
+ - name: Use Node.js ${{ matrix.node-version }}
+ uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.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 00000000..95ea1ea2
--- /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 00000000..de973410
--- /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 175ab74f..5f931fbc 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1 +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 00000000..3c032078
--- /dev/null
+++ b/.nvmrc
@@ -0,0 +1 @@
+18
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ba9f6b8f..9a004cd3 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,5 +1,5 @@
-Welcome! Thanks for your interest in contributing to api.jquery.com. You're **almost** in the right place. More information on how to contribute to this and all other jQuery Foundation projects is over at [contribute.jquery.org](http://contribute.jquery.org). You'll definitely want to take a look at the articles on contributing [documentation](http://contribute.jquery.org/documentation).
+Welcome! Thanks for your interest in contributing to api.jquery.com. You're **almost** in the right place. More information on how to contribute to this and all other jQuery Foundation projects is over at [contribute.jquery.org](https://contribute.jquery.org). You'll definitely want to take a look at the articles on contributing [documentation](https://contribute.jquery.org/documentation).
-You may also want to take a look at our [commit & pull request guide](http://contribute.jquery.org/commits-and-pull-requests/) and [style guides](http://contribute.jquery.org/style-guide/) for instructions on how to maintain your fork and submit your code. Before we can merge any pull request, we'll also need you to sign our [contributor license agreement](http://contribute.jquery.org/cla).
+You may also want to take a look at our [commit & pull request guide](https://contribute.jquery.org/commits-and-pull-requests/) and [style guides](https://contribute.jquery.org/style-guide/) for instructions on how to maintain your fork and submit your code. Before we can merge any pull request, we'll also need you to sign our [contributor license agreement](https://contribute.jquery.org/cla).
-You can find us on [IRC](http://irc.jquery.org), specifically in #jquery-dev and #jquery-content should you have any questions. If you've never contributed to open source before, we've put together [a short guide with tips, tricks, and ideas on getting started](http://contribute.jquery.org/open-source/).
+You can find us on [IRC](https://irc.jquery.org), specifically in #jquery-dev and #jquery-content should you have any questions. If you've never contributed to open source before, we've put together [a short guide with tips, tricks, and ideas on getting started](https://contribute.jquery.org/open-source/).
diff --git a/Gruntfile.js b/Gruntfile.js
index cc71e7be..10aa18ab 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -22,7 +22,12 @@ grunt.initConfig({
all: "resources/**"
},
wordpress: (function() {
- var config = require( "./config" );
+
+ // There's no config for CI, but we don't need one for basic testing
+ var config = {};
+ try {
+ config = require( "./config" );
+ } catch ( error ) {}
config.dir = "dist/wordpress";
return config;
})()
@@ -38,4 +43,6 @@ grunt.registerTask( "build", [
"build-xml-full"
]);
+grunt.registerTask( "deploy", [ "wordpress-deploy", "deploy-redirects" ] );
+
};
diff --git a/LICENSE.txt b/LICENSE.txt
index 19a9bad2..203b68a7 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,4 +1,4 @@
-Copyright Packt Publishing (http://packtpub.com/),
+Copyright Packt Publishing (https://www.packtpub.com/),
jQuery Foundation (https://jquery.org/), and other contributors.
This software consists of voluntary contributions made by many
@@ -35,7 +35,7 @@ Copyright and related rights for sample code are waived via CC0. Sample
code is defined as all source code displayed within the prose of the
documentation and all examples and demos.
-CC0: http://creativecommons.org/publicdomain/zero/1.0/
+CC0: https://creativecommons.org/publicdomain/zero/1.0/
====
diff --git a/README.md b/README.md
index f720120c..f7920803 100644
--- a/README.md
+++ b/README.md
@@ -2,14 +2,16 @@
## Building and Deploying
-To build and deploy your changes for previewing in a [`jquery-wp-content`](https://github.com/jquery/jquery-wp-content) instance, follow the [workflow instructions](http://contribute.jquery.org/web-sites/#workflow) from our documentation on [contributing to jQuery Foundation web sites](http://contribute.jquery.org/web-sites/).
+To build and deploy your changes for previewing in a [`jquery-wp-content`](https://github.com/jquery/jquery-wp-content) instance, follow the [workflow instructions](https://contribute.jquery.org/web-sites/#workflow) from our documentation on [contributing to jQuery Foundation web sites](https://contribute.jquery.org/web-sites/).
### Requirements
* [libxml2](http://xmlsoft.org/)
* [libxslt](http://xmlsoft.org/libxslt/)
-The `xmllint` and `xsltproc` utilities need to be in your path. If you are on Windows, you can get libxml2 and libxslt from zlatkovic.com.
+The `xmllint` and `xsltproc` utilities need to be in your path. If you are on Windows, you can get libxml2 and libxslt from zlatkovic.com.
+
+**Note**: If you're using Windows and you receive the error "Error" when executing the task `build-xml-entries:all`, try to add the DLL `libwinpthread-1.dll` in the root of the project.
## Style Guidelines
@@ -32,7 +34,7 @@ The `xmllint` and `xsltproc` utilities need to be in your path. If you are on Wi
#### Pronoun Usage
* Use second-person pronoun ("you") when necessary, but try to avoid it.
-* Favor the definite article ("the") over second-person possesive ("your").
+* Favor the definite article ("the") over second-person possessive ("your").
* **Yes**: Insert the paragraph after the unordered list.
* **No**: Insert your paragraph after the unordered list.
* When editing current entries, change first-person plural pronouns ("we," "our," "us") to second-person.
@@ -47,7 +49,7 @@ The `xmllint` and `xsltproc` utilities need to be in your path. If you are on Wi
### Code Style
-Code in the API documentation should follow the [jQuery Core Style Guide](http://contribute.jquery.org/style-guide/) with the following addition:
+Code in the API documentation should follow the [jQuery Core Style Guide](https://contribute.jquery.org/style-guide/) with the following addition:
* **Document ready syntax**: Use `$( document ).ready(function() {` instead of `$(function() {` as it's harder for new users to distinguish the difference between the latter and an IIFE.
@@ -83,5 +85,5 @@ Code in the API documentation should follow the [jQuery Core Style Guide](http:/
* Strong in English writing
* Tone
* Middle ground between formal and familiar. Err on the side of formality.
- * Authoritive
+ * Authoritative
* Tactful
diff --git a/categories.xml b/categories.xml
index d4941b0e..8dc523ec 100644
--- a/categories.xml
+++ b/categories.xml
@@ -37,38 +37,80 @@
- 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.
]]>
-
+
@@ -98,7 +140,7 @@
jQuery's event system normalizes the event object according to W3C standards. The event object is guaranteed to be passed to the event handler. Most properties from the original event are copied over and normalized to the new event object.
+
jQuery's event system normalizes the event object according to W3C standards. The event object is guaranteed to be passed to the event handler. Most properties from the original event are copied over and normalized to the new event object.
jQuery.Event Constructor
The jQuery.Event constructor is exposed and can be used when calling trigger. The new operator is optional.
@@ -120,7 +162,7 @@ var e = jQuery.Event( "keydown", { keyCode: 64 } );
// trigger an artificial keydown event with keyCode 64
jQuery( "body" ).trigger( e );
-
Event Properties
+
Common Event Properties
jQuery normalizes the following properties for cross-browser consistency:
@@ -143,14 +185,13 @@ jQuery( "body" ).trigger( e );
The following properties are also copied to the event object, though some of their values may be undefined depending on the event:
To access event properties not listed above, use the event.originalEvent object:
-// add the dataTransfer property for use with the native `drop` event
-// to capture information about files dropped into the browser window
-jQuery.event.props.push( "dataTransfer" );
+// Access the `dataTransfer` property from the `drop` event which
+// holds the files dropped into the browser window.
+var files = event.originalEvent.dataTransfer.files;
]]>
@@ -166,15 +207,15 @@ jQuery.event.props.push( "dataTransfer" );
-
+ 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.
+ ]]>
@@ -239,13 +280,13 @@ jQuery.event.props.push( "dataTransfer" );
Borrowing from CSS 1–3, and then adding its own, jQuery offers a powerful set of tools for matching a set of elements in a document.
-
To use any of the meta-characters ( such as !"#$%&'()*+,./:;<=>?@[\]^`{|}~ ) as a literal part of a name, it must be escaped with with two backslashes: \\. For example, an element with id="foo.bar", can use the selector $("#foo\\.bar"). The W3C CSS specification contains the complete set of rules regarding valid CSS selectors. Also useful is the blog entry by Mathias Bynens on CSS character escape sequences for identifiers.
+
To use any of the meta-characters ( such as !"#$%&'()*+,./:;<=>?@[\]^`{|}~ ) as a literal part of a name, it must be escaped with with two backslashes: \\. For example, an element with id="foo.bar", can use the selector $("#foo\\.bar"). The W3C CSS specification contains the complete set of rules regarding valid CSS selectors. Also useful is the blog entry by Mathias Bynens on CSS character escape sequences for identifiers.
]]>The CSS specification allows elements to be identified by their attributes. While not supported by some older browsers for the purpose of styling documents, jQuery allows you to employ them regardless of the browser being used.
When using any of the following attribute selectors, you should account for attributes that have multiple, space-separated values. Since these selectors see attribute values as a single string, this selector, for example, $("a[rel='nofollow']"), will select <a href="example.html" rel="nofollow">Some text</a> but not <a href="example.html" rel="nofollow foe">Some text</a>.
-
Attribute values in selector expressions must follow the rules for W3C CSS selectors; in general, that means anything other than a valid identifier should be surrounded by quotation marks.
+
Attribute values in selector expressions must follow the rules for W3C CSS selectors; in general, that means anything other than a valid identifier should be surrounded by quotation marks.
double quotes inside single quotes: $('a[rel="nofollow self"]')
single quotes inside double quotes: $("a[rel='nofollow self']")
- http://www.w3.org/Style/CSS/#specs. ]]>
+ https://www.w3.org/Style/CSS/#specs. ]]>
@@ -277,7 +318,7 @@ jQuery.event.props.push( "dataTransfer" );
- querySelectorAll() method. To achieve the best performance when using these selectors, first select some elements using a pure CSS selector, then use .filter().]]>
+ querySelectorAll() method. To achieve the best performance when using these selectors, first select some elements using a pure CSS selector, then use .filter().]]>
@@ -302,116 +343,284 @@ jQuery.event.props.push( "dataTransfer" );
- 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.
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.
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.
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.
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
-
-
]]>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.
-
-
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.
]]>Aspects of the API that were changed in the corresponding version of jQuery. Changes in jQuery 1.9 dealt primarily 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 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.
+
+ ]]>
+
+
+ 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.
+
+ ]]>
+
+
+ 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.
+
+ ]]>
+
+
+ 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.
+
+ ]]>
+
+
+ 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.
+
+ ]]>
+
+
+ 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.
]]>
diff --git a/config-sample.json b/config-sample.json
index b26cf9fc..2a56329c 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 00000000..f420af4a
--- /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 6f1d7870..bb95b0f0 100644
--- a/entries/add.xml
+++ b/entries/add.xml
@@ -20,7 +20,7 @@
- 1.3.2
+ 1.1An existing jQuery object to add to the set of matched elements.
diff --git a/entries/addClass.xml b/entries/addClass.xml
index 476251d8..39d6a0bf 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,9 +22,21 @@
+
+ 3.3
+
+ A function returning one or more space-separated class names or an array of class names to be added to the existing class name(s). Receives the index position of the element in the set and the existing class name(s) as arguments. Within the function, this refers to the current element in the set.
+
+
+
+
+
+ Adds the specified class(es) to each element in the set of matched elements.
It's important to note that this method does not replace a class. It simply adds the class, appending it to any which may already be assigned to the elements.
+
Before jQuery version 1.12/2.2, the .addClass() method manipulated the classNameproperty of the selected elements, not the classattribute. Once the property was changed, it was the browser that updated the attribute accordingly. An implication of this behavior was that this method only worked for documents with HTML DOM semantics (e.g., not pure XML documents).
+
As of jQuery 1.12/2.2, this behavior is changed to improve the support for XML documents, including SVG. Starting from this version, the classattribute is used instead. So, .addClass() can be used on XML or SVG documents.
More than one class may be added at a time, separated by a space, to the set of matched elements, like so:
$( "p" ).addClass( "myClass yourClass" );
@@ -62,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 1e195510..2ea48a9c 100644
--- a/entries/after.xml
+++ b/entries/after.xml
@@ -4,16 +4,18 @@
1.0
- HTML string, DOM element, array of elements, or jQuery object to insert after each element in the set of matched elements.
+ HTML string, DOM element, text node, array of elements and text nodes, or jQuery object to insert after each element in the set of matched elements.
+
- One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements.
+ One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or jQuery objects to insert after each element in the set of matched elements.
+
@@ -21,24 +23,26 @@
1.4
- A function that returns an HTML string, DOM element(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 as an argument. Within the function, this refers to the current element in the set.
+ A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert after each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.
+
-
- 1.10
-
- A function that returns an HTML string, DOM element(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.
+
+ 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.
+
@@ -92,7 +96,7 @@ $( "p" ).after(function() {
Similar to other content-adding methods such as .prepend() and .before(), .after() also supports passing in multiple arguments as input. Supported input includes DOM elements, jQuery objects, HTML strings, and arrays of DOM elements.
For example, the following will insert two new <div>s and an existing <div> after the first paragraph:
-var $newdiv1 = $( "<div id='object1'/>" ),
+var $newdiv1 = $( "<div id='object1'></div>" ),
newdiv2 = document.createElement( "div" ),
existingdiv1 = document.getElementById( "foo" );
diff --git a/entries/ajaxComplete-shorthand.xml b/entries/ajaxComplete-shorthand.xml
new file mode 100644
index 00000000..3f44abc1
--- /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.
+
+
+
+
+
+
+
+
+
diff --git a/entries/ajaxComplete.xml b/entries/ajaxComplete.xml
index 7f045973..0c133516 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:
When the user clicks the element with class trigger and the Ajax request completes, the log message is displayed.
-
As of jQuery 1.8, the .ajaxComplete() method should only be attached to document.
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:
Note: You can get the returned ajax contents by looking at 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 00000000..f36ac54a
--- /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.
+
+
+
+
+
+
+
+
+
diff --git a/entries/ajaxError.xml b/entries/ajaxError.xml
index d13f71e6..d18cf977 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.
When the user clicks the button and the Ajax request fails, because the requested file is missing, the log message is displayed.
-
As of jQuery 1.8, the .ajaxError() method should only be attached to document.
All ajaxError handlers are invoked, regardless of what Ajax request was completed. To differentiate between the requests, use the parameters passed to the handler. Each time an ajaxError handler is executed, it is passed the event object, the jqXHR object (prior to jQuery 1.5, the XHR object), and the settings object that was used in the creation of the request. When an HTTP error occurs, the fourth argument (thrownError) receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." For example, to restrict the error callback to only handling events dealing with a particular URL:
-
+
+ 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 00000000..a9ae031e
--- /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.
+
+
+
+
+
+
+
+
+
diff --git a/entries/ajaxSend.xml b/entries/ajaxSend.xml
index 2d609b71..cbd1641c 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:
When the user clicks the element with class trigger and the Ajax request is about to begin, the log message is displayed.
-
As of jQuery 1.8, the .ajaxSend() method should only be attached to document.
All ajaxSend handlers are invoked, regardless of what Ajax request is to be sent. If you must differentiate between the requests, use the parameters passed to the handler. Each time an ajaxSend handler is executed, it is passed the event object, the jqXHR object (in version 1.4, XMLHttpRequestobject), and the settings object that was used in the creation of the Ajax request. For example, you can restrict the callback to only handling events dealing with a particular URL:
-
+
+ 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 00000000..51b2fc9e
--- /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.
+
+
+
+
+
+
+
+
+
diff --git a/entries/ajaxStart.xml b/entries/ajaxStart.xml
index 7747e5b6..3d8f4df4 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:
When the user clicks the element with class trigger and the Ajax request is sent, the log message is displayed.
-
As of jQuery 1.8, the .ajaxStart() method should only be attached to document.
-
+
+ Show a loading message whenever an Ajax request starts (and none is already active).
+
diff --git a/entries/ajaxStop-shorthand.xml b/entries/ajaxStop-shorthand.xml
new file mode 100644
index 00000000..78121657
--- /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.
+
+
+
+
+
+
+
+
+
diff --git a/entries/ajaxStop.xml b/entries/ajaxStop.xml
index 76b3bffc..f42c7444 100644
--- a/entries/ajaxStop.xml
+++ b/entries/ajaxStop.xml
@@ -1,15 +1,21 @@
-
- .ajaxStop()
+
+ ajaxStop eventRegister 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:
When the user clicks the element with class trigger and the Ajax request completes, the log message is displayed.
-
As of jQuery 1.8, the .ajaxStop() method should only be attached to document.
-
+
+ Hide a loading message after all the Ajax requests have stopped.
+
diff --git a/entries/ajaxSuccess-shorthand.xml b/entries/ajaxSuccess-shorthand.xml
new file mode 100644
index 00000000..a9e54335
--- /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.
+
+
+
+
+
+
+
+
+
diff --git a/entries/ajaxSuccess.xml b/entries/ajaxSuccess.xml
index 26583e2e..8824a621 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:
When the user clicks the element with class trigger and the Ajax request completes successfully, the log message is displayed.
-
As of jQuery 1.8, the .ajaxSuccess() method should only be attached to document.
All ajaxSuccess handlers are invoked, regardless of what Ajax request was completed. If you must differentiate between the requests, you can use the parameters passed to the handler. Each time an ajaxSuccess handler is executed, it is passed the event object, the XMLHttpRequest object, and the settings object that was used in the creation of the request. For example, you can restrict the callback to only handling events dealing with a particular URL:
Note: You can get the returned ajax contents by looking at xhr.responseXML or xhr.responseText for xml and html respectively.
+
Note: You can get the returned Ajax contents by looking at xhr.responseXML or xhr.responseText for xml and html respectively.
-
+
+ Show a message when an Ajax request completes successfully.Successful Request!" );
-});
+} );
]]>
+
diff --git a/entries/andSelf.xml b/entries/andSelf.xml
index 6870b479..967c72ef 100644
--- a/entries/andSelf.xml
+++ b/entries/andSelf.xml
@@ -1,78 +1,17 @@
-
+.andSelf()1.2Add 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.
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" );
-]]>
-
-
-
The .animate() method allows us to create animation effects on any numeric CSS property. The only required parameter is a plain object of CSS properties. This object is similar to the one that can be sent to the .css() method, except that the range of properties is more restrictive.
Animation Properties and Values
-
All animated properties should be animated to a single numeric value, except as noted below; most properties that are non-numeric cannot be animated using basic jQuery functionality (For example, width, height, or left can be animated but background-color cannot be, unless the jQuery.Color() plugin is used). Property values are treated as a number of pixels unless otherwise specified. The units em and % can be specified where applicable.
+
All animated properties should be animated to a single numeric value, except as noted below; most properties that are non-numeric cannot be animated using basic jQuery functionality (For example, width, height, or left can be animated but background-color cannot be, unless the jQuery.Color plugin is used). Property values are treated as a number of pixels unless otherwise specified. The units em and % can be specified where applicable.
In addition to style properties, some non-style properties such as scrollTop and scrollLeft, as well as custom properties, can be animated.
Shorthand CSS properties (e.g. font, background, border) are not fully supported. For example, if you want to animate the rendered border width, at least a border style and border width other than "auto" must be set in advance. Or, if you want to animate font size, you would use fontSize or the CSS equivalent 'font-size' rather than simply 'font'.
In addition to numeric values, each property can take the strings 'show', 'hide', and 'toggle'. These shortcuts allow for custom hiding and showing animations that take into account the display type of the element. In order to use jQuery's built-in toggle state tracking, the 'toggle' keyword must be consistently given as the value of the property being animated.
@@ -32,8 +32,8 @@
Duration
Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The default duration is 400 milliseconds. The strings 'fast' and 'slow' can be supplied to indicate durations of 200 and 600 milliseconds, respectively.
-
Complete Function
-
If supplied, the complete callback function is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but this is set to the DOM element being animated. If multiple elements are animated, the callback is executed once per matched element, not once for the animation as a whole.
+
Callback Functions
+
If supplied, the start, step, progress, complete, done, fail, and always callbacks are called on a per-element basis; this is set to the DOM element being animated. If no elements are in the set, no callbacks are called. If multiple elements are animated, the callback is executed once per matched element, not once for the animation as a whole. Use the .promise() method to obtain a promise to which you can attach callbacks that fire once for an animated set of any size, including zero elements.
Basic Usage
To animate any element, such as a simple image:
@@ -45,7 +45,7 @@
To animate the opacity, left offset, and height of the image simultaneously:
-
+
+
+ Figure 1 - Illustration of the specified animation effect
+
Note that the target value of the height property is 'toggle'. Since the image was visible before, the animation shrinks the height to 0 to hide it. A second click then reverses this transition:
-
+
+
+ Figure 2 - Illustration of the specified animation effect
+
The opacity of the image is already at its target value, so this property is not animated by the second click. Since the target value for left is a relative value, the image moves even farther to the right during this second animation.
Directional properties (top, right, bottom, left) have no discernible effect on elements if their position style property is static, which it is by default.
-
Note: The jQuery UI project extends the .animate() method by allowing some non-numeric styles such as colors to be animated. The project also includes mechanisms for specifying animations through CSS classes rather than individual attributes.
+
Note: The jQuery UI project extends the .animate() method by allowing some non-numeric styles such as colors to be animated. The project also includes mechanisms for specifying animations through CSS classes rather than individual attributes.
-
Note: if attempting to animate an element with a height or width of 0px, where contents of the element are visible due to overflow, jQuery may clip this overflow during animation. By fixing the dimensions of the original element being hidden however, it is possible to ensure that the animation runs smoothly. A clearfix can be used to automatically fix the dimensions of your main element without the need to set this manually.
+
Note: if attempting to animate an element with a height or width of 0px, where contents of the element are visible due to overflow, jQuery may clip this overflow during animation. By fixing the dimensions of the original element being hidden however, it is possible to ensure that the animation runs smoothly. A clearfix can be used to automatically fix the dimensions of your main element without the need to set this manually.
Step Function
The second version of .animate() provides a step option — a callback function that is fired at each step of the animation. This function is useful for enabling custom animation types or altering the animation as it is occurring. It accepts two arguments (now and fx), and this is set to the DOM element being animated.
@@ -90,12 +96,12 @@ $( "li" ).animate({
});
Easing
-
The remaining parameter of .animate() is a string naming an easing function to use. An easing function specifies the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called swing, and one that progresses at a constant pace, called linear. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.
+
The remaining parameter of .animate() is a string naming an easing function to use. An easing function specifies the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called swing, and one that progresses at a constant pace, called linear. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.
Per-property Easing
As of jQuery version 1.4, you can set per-property easing functions within a single .animate() call. In the first version of .animate(), each property can take an array as its value: The first member of the array is the CSS property and the second member is an easing function. If a per-property easing function is not defined for a particular property, it uses the value of the .animate() method's optional easing argument. If the easing argument is not defined, the default swing function is used.
For example, to simultaneously animate the width and height with the swing easing function and the opacity with the linear easing function:
In the second version of .animate(), the options object can include the specialEasing property, which is itself an object of CSS properties and their corresponding easing functions. For example, to simultaneously animate the width using the linear easing function and the height using the easeOutBounce easing function:
-$( "#clickme" ).click(function() {
+$( "#clickme" ).on( "click", function() {
$( "#book" ).animate({
width: "toggle",
height: "toggle"
@@ -131,7 +137,7 @@ $( "#clickme" ).click(function() {
Animates a div's left property with a relative value. Click several times on the buttons to see the relative animations queued up.
@@ -185,7 +191,7 @@ $( "#left" ).click(function(){
The second button starts a traditional chained animation, where each animation will start once the previous animation on the element has completed.
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.1.0
- DOM element, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements.
+ DOM element, text node, array of elements and text nodes, HTML string, or jQuery object to insert at the end of each element in the set of matched elements.
+
- One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements.
+ One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements.
+
@@ -21,19 +23,20 @@
1.4
- A function that returns an HTML string, DOM element(s), or jQuery object to insert at the end of 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.
+ A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert at the end of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set.
+ Insert content, specified by the parameter, to the end of each element in the set of matched elements.
-
The .append() method inserts the specified content as the last child of each element in the jQuery collection (To insert it as the first child, use .prepend()).
+
The .append() method inserts the specified content as the last child of each element in the jQuery collection (To insert it as the first child, use .prepend()).
The .append() and .appendTo() methods perform the same task. The major difference is in the syntax-specifically, in the placement of the content and target. With .append(), the selector expression preceding the method is the container into which the content is inserted. With .appendTo(), 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 into the target container.
Similar to other content-adding methods such as .prepend() and .before(), .append() also supports passing in multiple arguments as input. Supported input includes DOM elements, jQuery objects, HTML strings, and arrays of DOM elements.
For example, the following will insert two new <div>s and an existing <div> as the last three child nodes of the body:
Since .append() can accept any number of additional arguments, the same result can be achieved by passing in the three <div>s as three separate arguments, like so: $('body').append( $newdiv1, newdiv2, existingdiv1 ). The type and number of arguments will largely depend on how you collect the elements in your code.
+ Appends some HTML to all paragraphs.
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.
+ Append all spans to the element with the ID "foo" (Check append() documentation for more examples)Note: Attribute values are strings with the exception of a few attributes such as value and tabindex.
As of jQuery 1.6, the .attr() method returns undefined for attributes that have not been set. To retrieve and change DOM properties such as the checked, selected, or disabled state of form elements, use the .prop() method.
+
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:
@@ -43,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
"checked" (String) Will change with checkbox state
+
"checked" (String) Initial state of the checkbox; does not change
@@ -68,7 +69,7 @@
-
According to the W3C forms specification, the checked attribute is a boolean attribute, which means the corresponding property is true if the attribute is present at all—even if, for example, the attribute has no value or is set to empty string value or even "false". This is true of all boolean attributes.
+
According to the W3C forms specification, the checked attribute is a boolean attribute, which means the corresponding property is true if the attribute is present at all—even if, for example, the attribute has no value or is set to empty string value or even "false". This is true of all boolean attributes.
Nevertheless, the most important concept to remember about the checked attribute is that it does not correspond to the checked property. The attribute actually corresponds to the defaultChecked property and should be used only to set the initial value of the checkbox. The checked attribute value does not change with the state of the checkbox, while the checked property does. Therefore, the cross-browser-compatible way to determine if a checkbox is checked is to use the property:
@@ -88,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" );
]]>
+
@@ -147,7 +149,9 @@ The title of the emphasis is:
- A value to set for the attribute.
+
+
+ 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.
@@ -167,7 +171,7 @@ The title of the emphasis is:
-
+
@@ -193,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.
@@ -278,5 +287,6 @@ $( "img" ).attr( "src", function() {
+
diff --git a/entries/attribute-contains-prefix-selector.xml b/entries/attribute-contains-prefix-selector.xml
index 4b706bc6..3465e6c2 100644
--- a/entries/attribute-contains-prefix-selector.xml
+++ b/entries/attribute-contains-prefix-selector.xml
@@ -8,7 +8,7 @@
An attribute name.
- An attribute value. Can be either an unquoted single word or a quoted string.
+ An attribute value. Can be either a valid identifier or a quoted string.Selects elements that have the specified attribute with a value either equal to a given string or starting with that string followed by a hyphen (-).
diff --git a/entries/attribute-contains-selector.xml b/entries/attribute-contains-selector.xml
index 8cb21dfc..15e7778d 100644
--- a/entries/attribute-contains-selector.xml
+++ b/entries/attribute-contains-selector.xml
@@ -8,7 +8,7 @@
An attribute name.
- An attribute value. Can be either an unquoted single word or a quoted string.
+ An attribute value. Can be either a valid identifier or a quoted string.Selects elements that have the specified attribute with a value containing a given substring.
diff --git a/entries/attribute-contains-word-selector.xml b/entries/attribute-contains-word-selector.xml
index 18df4cbc..8a71f37b 100644
--- a/entries/attribute-contains-word-selector.xml
+++ b/entries/attribute-contains-word-selector.xml
@@ -8,7 +8,7 @@
An attribute name.
- An attribute value. Can be either an unquoted single word or a quoted string.
+ An attribute value. Can be either a valid identifier or a quoted string.Selects elements that have the specified attribute with a value containing a given word, delimited by spaces.
diff --git a/entries/attribute-ends-with-selector.xml b/entries/attribute-ends-with-selector.xml
index 0febbde7..cbdfe808 100644
--- a/entries/attribute-ends-with-selector.xml
+++ b/entries/attribute-ends-with-selector.xml
@@ -8,7 +8,7 @@
An attribute name.
- An attribute value. Can be either an unquoted single word or a quoted string.
+ An attribute value. Can be either a valid identifier or a quoted string.Selects elements that have the specified attribute with a value ending exactly with a given string. The comparison is case sensitive.
diff --git a/entries/attribute-equals-selector.xml b/entries/attribute-equals-selector.xml
index 555cf7c9..faa6e513 100644
--- a/entries/attribute-equals-selector.xml
+++ b/entries/attribute-equals-selector.xml
@@ -8,7 +8,7 @@
An attribute name.
- An attribute value. Can be either an unquoted single word or a quoted string.
+ An attribute value. Can be either a valid identifier or a quoted string.Selects elements that have the specified attribute with a value exactly equal to a certain value.
diff --git a/entries/attribute-not-equal-selector.xml b/entries/attribute-not-equal-selector.xml
index fabb6a2e..38531ffc 100644
--- a/entries/attribute-not-equal-selector.xml
+++ b/entries/attribute-not-equal-selector.xml
@@ -8,7 +8,7 @@
An attribute name.
- An attribute value. Can be either an unquoted single word or a quoted string.
+ An attribute value. Can be either a valid identifier or a quoted string.Select elements that either don't have the specified attribute, or do have the specified attribute but not with a certain value.
diff --git a/entries/attribute-starts-with-selector.xml b/entries/attribute-starts-with-selector.xml
index 3c2f6912..54067652 100644
--- a/entries/attribute-starts-with-selector.xml
+++ b/entries/attribute-starts-with-selector.xml
@@ -8,7 +8,7 @@
An attribute name.
- An attribute value. Can be either an unquoted single word or a quoted string.
+ An attribute value. Can be either a valid identifier or a quoted string.Selects elements that have the specified attribute with a value beginning exactly with a given string.
diff --git a/entries/before.xml b/entries/before.xml
index cba817a9..577f588b 100644
--- a/entries/before.xml
+++ b/entries/before.xml
@@ -4,16 +4,18 @@
1.0
- HTML string, DOM element, array of elements, or jQuery object to insert before each element in the set of matched elements.
+ HTML string, DOM element, text node, array of elements and text nodes, or jQuery object to insert before each element in the set of matched elements.
+
- One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements.
+ One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or jQuery objects to insert before each element in the set of matched elements.
+
@@ -25,23 +27,25 @@
+
- A function that returns an HTML string, DOM element(s), or jQuery object to insert before each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.
+ A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert before each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.
- 1.10
-
+ 1.10-and-2.0
+
+
- A function that returns an HTML string, DOM element(s), or jQuery object to insert before each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set.
+ A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert before each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set.
@@ -87,7 +91,7 @@ $( ".container" ).before( $( "h2" ) );
Similar to other content-adding methods such as .prepend() and .after(), .before() also supports passing in multiple arguments as input. Supported input includes DOM elements, jQuery objects, HTML strings, and arrays of DOM elements.
For example, the following will insert two new <div>s and an existing <div> before the first paragraph:
-var newdiv1 = $( "<div id='object1'/>" ),
+var newdiv1 = $( "<div id='object1'></div>" ),
newdiv2 = document.createElement( "div" ),
existingdiv1 = document.getElementById( "foo" );
diff --git a/entries/bind.xml b/entries/bind.xml
index a81e46a8..aa45c455 100644
--- a/entries/bind.xml
+++ b/entries/bind.xml
@@ -1,5 +1,5 @@
-
+.bind()1.0
@@ -34,10 +34,10 @@
Attach a handler to an event for the elements.
-
As of jQuery 1.7, the .on() method is the preferred method for attaching event handlers to a document. 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() or .delegate().
+
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.
diff --git a/entries/blur-shorthand.xml b/entries/blur-shorthand.xml
new file mode 100644
index 00000000..589a1ceb
--- /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
+
+
+
+
+
+
+
+
+
+
diff --git a/entries/blur.xml b/entries/blur.xml
index 747a7d1e..68636a0c 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.3An 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,32 +32,55 @@
<div id="other">
Trigger the handler
</div>
-The event handler can be bound to the first input field:
-$( "#target" ).blur(function() {
- alert( "Handler for .blur() called." );
-});
+
+
The event handler can be bound to the first input field:
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".
+
+
+
+
+
+
+
+
+
+
diff --git a/entries/button-selector.xml b/entries/button-selector.xml
index 858522e5..12c8471c 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();
-});
+} );
]]>The argument or list of arguments to pass back to the callback list.
- Call all of the callbacks with the given arguments
+ Call all of the callbacks with the given arguments.
This method returns the Callbacks object onto which it is attached (this).
diff --git a/entries/callbacks.fireWith.xml b/entries/callbacks.fireWith.xml
index dfb2adb3..7527e182 100644
--- a/entries/callbacks.fireWith.xml
+++ b/entries/callbacks.fireWith.xml
@@ -3,11 +3,11 @@
callbacks.fireWith()1.7
-
+ A reference to the context in which the callbacks in the list should be fired.
-
- An argument, or array of arguments, to pass to the callbacks in the list.
+
+ An array or array-like object of arguments to pass to the callbacks in the list. If omitted or undefined, no arguments will be passed.Call all callbacks in a list with the given context and arguments.
diff --git a/entries/change-shorthand.xml b/entries/change-shorthand.xml
new file mode 100644
index 00000000..98d9509a
--- /dev/null
+++ b/entries/change-shorthand.xml
@@ -0,0 +1,36 @@
+
+
+ .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
+
+
+
+
+
+
+
+
+
diff --git a/entries/change.xml b/entries/change.xml
index 97a9b5e7..e179c506 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.3An 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,34 +38,34 @@
The event handler can be bound to the text input and the select box:
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" ):
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".
+
+
+
+
+
+
+
+
+
diff --git a/entries/checkbox-selector.xml b/entries/checkbox-selector.xml
index 843cdaf7..ba0fd815 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();
-});
+} );
]]>
Matches all elements that are checked or selected.
-
The :checked selector works for checkboxes, radio buttons, and select elements. For select elements only, use the :selected selector.
+
The :checked selector works for checkboxes, radio buttons, and options of select elements.
+
To retrieve only the selected options of select elements, use the :selected selector.
Determine how many input elements are checked.
diff --git a/entries/child-selector.xml b/entries/child-selector.xml
index 5016a1b3..1b1b27c2 100644
--- a/entries/child-selector.xml
+++ b/entries/child-selector.xml
@@ -13,7 +13,6 @@
Selects all direct child elements specified by "child" of elements specified by "parent".
-
As a CSS selector, the child combinator is supported by all modern web browsers including Safari, Firefox, Opera, Chrome, and Internet Explorer 7 and above, but notably not by Internet Explorer versions 6 and below. However, in jQuery, this selector (along with all others) works across all supported browsers, including IE6.
The child combinator (E > F) can be thought of as a more specific form of the descendant combinator (E F) in that it selects only first-level descendants.
diff --git a/entries/children.xml b/entries/children.xml
index 8437acc5..5880351b 100644
--- a/entries/children.xml
+++ b/entries/children.xml
@@ -38,16 +38,16 @@
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
+
+
+
+
+
+
+
+
+
diff --git a/entries/click.xml b/entries/click.xml
index 9be0e863..c5f9deb2 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.3An 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">
@@ -34,24 +32,25 @@
Trigger the handler
</div>