From ae855972e765f433d9d17e559eba7db6b7adeab7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Go=C5=82=C4=99biowski-Owczarek?=
Date: Thu, 18 Nov 2021 13:47:51 +0100
Subject: [PATCH 001/101] jQuery.getScript: Update the jQuery Color link to a
versioned one
---
entries/jQuery.getScript.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/entries/jQuery.getScript.xml b/entries/jQuery.getScript.xml
index 357b9e1a..906f03e4 100644
--- a/entries/jQuery.getScript.xml
+++ b/entries/jQuery.getScript.xml
@@ -92,7 +92,7 @@ $.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.
Date: Wed, 27 Apr 2022 01:46:34 +0200
Subject: [PATCH 003/101] Ajax Events: Promote on() instead of bind() (#1202)
Closes gh-1202
---
pages/Ajax_Events.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pages/Ajax_Events.html b/pages/Ajax_Events.html
index 26a59f0f..6b1249be 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();
});
From 1940bb86d41d89386b7952319cc4d23339790734 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 27 Apr 2022 14:49:35 +0200
Subject: [PATCH 004/101] Build: Bump grunt from 1.4.0 to 1.5.2
Bumps [grunt](https://github.com/gruntjs/grunt) from 1.4.0 to 1.5.2.
- [Release notes](https://github.com/gruntjs/grunt/releases)
- [Changelog](https://github.com/gruntjs/grunt/blob/main/CHANGELOG)
- [Commits](https://github.com/gruntjs/grunt/compare/v1.4.0...v1.5.2)
Closes gh-1203
---
updated-dependencies:
- dependency-name: grunt
dependency-type: direct:production
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
package-lock.json | 60 +++++++++++++++++++++++++++++++++++------------
package.json | 2 +-
2 files changed, 46 insertions(+), 16 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 876ec538..895cfa1e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -75,9 +75,9 @@
}
},
"chalk": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz",
- "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==",
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
@@ -290,9 +290,9 @@
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
},
"getobject": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/getobject/-/getobject-1.0.0.tgz",
- "integrity": "sha512-tbUz6AKKKr2YiMB+fLWIgq5ZeBOobop9YMMAU9dC54/ot2ksMXt3DOFyBuhZw6ptcVszEykgByK20j7W9jHFag=="
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/getobject/-/getobject-1.0.2.tgz",
+ "integrity": "sha512-2zblDBaFcb3rB4rF77XVnuINOE2h2k/OnqXAiy0IrTxUfV1iFp3la33oAQVY9pCpWU268WFYVt2t71hlMuLsOg=="
},
"gilded-wordpress": {
"version": "1.0.5",
@@ -366,17 +366,17 @@
}
},
"grunt": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.4.0.tgz",
- "integrity": "sha512-yRFc0GVCDu9yxqOFzpuXQ2pEdgtLDnFv5Qz54jfIcNnpJ8Z7B7P7kPkT4VMuRvm+N+QOsI8C4v/Q0DSaoj3LgQ==",
+ "version": "1.5.2",
+ "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.5.2.tgz",
+ "integrity": "sha512-XCtfaIu72OyDqK24MjWiGC9SwlkuhkS1mrULr1xzuJ2XqAFhP3ZAchZGHJeSCY6mkaOXU4F7SbmmCF7xIVoC9w==",
"requires": {
"dateformat": "~3.0.3",
"eventemitter2": "~0.4.13",
"exit": "~0.1.2",
"findup-sync": "~0.3.0",
"glob": "~7.1.6",
- "grunt-cli": "~1.4.2",
- "grunt-known-options": "~1.1.1",
+ "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.4.13",
@@ -385,6 +385,36 @@
"mkdirp": "~1.0.4",
"nopt": "~3.0.6",
"rimraf": "~3.0.2"
+ },
+ "dependencies": {
+ "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==",
+ "requires": {
+ "grunt-known-options": "~2.0.0",
+ "interpret": "~1.1.0",
+ "liftup": "~3.0.1",
+ "nopt": "~4.0.1",
+ "v8flags": "~3.2.0"
+ },
+ "dependencies": {
+ "nopt": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz",
+ "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==",
+ "requires": {
+ "abbrev": "1",
+ "osenv": "^0.1.4"
+ }
+ }
+ }
+ },
+ "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=="
+ }
}
},
"grunt-check-modules": {
@@ -1015,11 +1045,11 @@
"integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo="
},
"underscore.string": {
- "version": "3.3.5",
- "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.5.tgz",
- "integrity": "sha512-g+dpmgn+XBneLmXXo+sGlW5xQEt4ErkS3mgeN2GFbremYeMBSJKr9Wf2KJplQVaiPY/f7FN6atosWYNm9ovrYg==",
+ "version": "3.3.6",
+ "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.6.tgz",
+ "integrity": "sha512-VoC83HWXmCrF6rgkyxS9GHv8W9Q5nhMKho+OadDJGzL2oDYbYEppBaCMH6pFlwLeqj2QS+hhkw2kpXkSdD1JxQ==",
"requires": {
- "sprintf-js": "^1.0.3",
+ "sprintf-js": "^1.1.1",
"util-deprecate": "^1.0.2"
}
},
diff --git a/package.json b/package.json
index 720284ce..485bfa55 100644
--- a/package.json
+++ b/package.json
@@ -24,7 +24,7 @@
"test": "grunt lint"
},
"dependencies": {
- "grunt": "1.4.0",
+ "grunt": "1.5.2",
"grunt-cli": "1.4.2",
"grunt-jquery-content": "3.1.0"
}
From bf40aa39ca5f9d8a429b18d9fae78c50b22a4d09 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 27 Jun 2022 17:36:28 +0200
Subject: [PATCH 005/101] Build: Bump grunt from 1.5.2 to 1.5.3
Bumps [grunt](https://github.com/gruntjs/grunt) from 1.5.2 to 1.5.3.
- [Release notes](https://github.com/gruntjs/grunt/releases)
- [Changelog](https://github.com/gruntjs/grunt/blob/main/CHANGELOG)
- [Commits](https://github.com/gruntjs/grunt/compare/v1.5.2...v1.5.3)
Closes gh-1204
---
updated-dependencies:
- dependency-name: grunt
dependency-type: direct:production
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
package-lock.json | 6 +++---
package.json | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 895cfa1e..e02106bf 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -366,9 +366,9 @@
}
},
"grunt": {
- "version": "1.5.2",
- "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.5.2.tgz",
- "integrity": "sha512-XCtfaIu72OyDqK24MjWiGC9SwlkuhkS1mrULr1xzuJ2XqAFhP3ZAchZGHJeSCY6mkaOXU4F7SbmmCF7xIVoC9w==",
+ "version": "1.5.3",
+ "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.5.3.tgz",
+ "integrity": "sha512-mKwmo4X2d8/4c/BmcOETHek675uOqw0RuA/zy12jaspWqvTp4+ZeQF1W+OTpcbncnaBsfbQJ6l0l4j+Sn/GmaQ==",
"requires": {
"dateformat": "~3.0.3",
"eventemitter2": "~0.4.13",
diff --git a/package.json b/package.json
index 485bfa55..0c97e7d3 100644
--- a/package.json
+++ b/package.json
@@ -24,7 +24,7 @@
"test": "grunt lint"
},
"dependencies": {
- "grunt": "1.5.2",
+ "grunt": "1.5.3",
"grunt-cli": "1.4.2",
"grunt-jquery-content": "3.1.0"
}
From 5274a1135ff2afad208783de25cc1c96298a6201 Mon Sep 17 00:00:00 2001
From: vlakoff
Date: Fri, 18 Nov 2022 13:24:40 +0100
Subject: [PATCH 006/101] jQuery.getScript: Script has been executed before the
`success` callback
When executing a callback provided to the optional `success` parameter of
`$.getScript()`, we can assume the script has been executed already.
Just like when using `.done()` on the returned jqXHR object.
Fixes gh-1207
Closes gh-1209
---
entries/jQuery.getScript.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/entries/jQuery.getScript.xml b/entries/jQuery.getScript.xml
index 906f03e4..a234e9d1 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 ) {
From b15e83e412351d9271a7ee4c7b16bb20958f7b66 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?=
Date: Fri, 18 Nov 2022 13:26:03 +0100
Subject: [PATCH 007/101] 3.1.2
---
package-lock.json | 2 +-
package.json | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index e02106bf..19b7b10d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "api.jquery.com",
- "version": "3.1.1",
+ "version": "3.1.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/package.json b/package.json
index 0c97e7d3..4e291494 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "api.jquery.com",
"title": "jQuery API Docs",
"description": "API reference documentation for the jQuery JavaScript Library.",
- "version": "3.1.1",
+ "version": "3.1.2",
"homepage": "https://github.com/jquery/api.jquery.com",
"author": {
"name": "jQuery Foundation and other contributors"
From de6fdcb76b3b0cf064aa5b27e715706fa4c53eaa Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 18 Nov 2022 13:28:31 +0100
Subject: [PATCH 008/101] Build: Bump async from 3.2.0 to 3.2.4
Bumps [async](https://github.com/caolan/async) from 3.2.0 to 3.2.4.
- [Release notes](https://github.com/caolan/async/releases)
- [Changelog](https://github.com/caolan/async/blob/master/CHANGELOG.md)
- [Commits](https://github.com/caolan/async/compare/v3.2.0...v3.2.4)
Closes gh-1213
---
updated-dependencies:
- dependency-name: async
dependency-type: indirect
...
Signed-off-by: dependabot[bot]
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
package-lock.json | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 19b7b10d..aa4f92df 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -43,9 +43,9 @@
"integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w=="
},
"async": {
- "version": "3.2.0",
- "resolved": "https://registry.npmjs.org/async/-/async-3.2.0.tgz",
- "integrity": "sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw=="
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz",
+ "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ=="
},
"balanced-match": {
"version": "1.0.2",
@@ -307,7 +307,7 @@
"async": {
"version": "0.9.2",
"resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz",
- "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0="
+ "integrity": "sha512-l6ToIJIotphWahxxHyzK9bnLR6kM4jJIIgLShZeqLY7iboHoGkdgFl7W2/Ivi4SkMJYGKqW8vSuk0uKUj6qsSw=="
},
"glob": {
"version": "4.5.3",
From 6d46d38962fde24bd8d4d913736149d12eb5541f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?=
Date: Fri, 18 Nov 2022 13:28:40 +0100
Subject: [PATCH 009/101] 3.1.3
---
package-lock.json | 2 +-
package.json | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index aa4f92df..ea007635 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "api.jquery.com",
- "version": "3.1.2",
+ "version": "3.1.3",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/package.json b/package.json
index 4e291494..5a227e51 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "api.jquery.com",
"title": "jQuery API Docs",
"description": "API reference documentation for the jQuery JavaScript Library.",
- "version": "3.1.2",
+ "version": "3.1.3",
"homepage": "https://github.com/jquery/api.jquery.com",
"author": {
"name": "jQuery Foundation and other contributors"
From 3706b06bd7bb3f9f70a57c4d23abab70c9c0423f Mon Sep 17 00:00:00 2001
From: Andrew Dawes
Date: Fri, 18 Nov 2022 13:29:51 +0100
Subject: [PATCH 010/101] mousemove: Fix a typo
Closes gh-1210
---
entries/mousemove.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/entries/mousemove.xml b/entries/mousemove.xml
index d2341e65..f6e33860 100644
--- a/entries/mousemove.xml
+++ b/entries/mousemove.xml
@@ -66,7 +66,7 @@ $( "#other" ).click(function() {
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>
.
From ce90864c03b0a1aae4ab7fe8f616f250efab3f34 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?=
Date: Fri, 18 Nov 2022 13:31:29 +0100
Subject: [PATCH 011/101] Build: Update package-lock.json
---
package-lock.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package-lock.json b/package-lock.json
index ea007635..7dd81f2e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -307,7 +307,7 @@
"async": {
"version": "0.9.2",
"resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz",
- "integrity": "sha512-l6ToIJIotphWahxxHyzK9bnLR6kM4jJIIgLShZeqLY7iboHoGkdgFl7W2/Ivi4SkMJYGKqW8vSuk0uKUj6qsSw=="
+ "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0="
},
"glob": {
"version": "4.5.3",
From 57a7ff7e539dd463fee7e0a1a62f47c0e8694af8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?=
Date: Fri, 18 Nov 2022 13:31:34 +0100
Subject: [PATCH 012/101] 3.1.4
---
package-lock.json | 2 +-
package.json | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 7dd81f2e..96119daa 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "api.jquery.com",
- "version": "3.1.3",
+ "version": "3.1.4",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/package.json b/package.json
index 5a227e51..45cdbada 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "api.jquery.com",
"title": "jQuery API Docs",
"description": "API reference documentation for the jQuery JavaScript Library.",
- "version": "3.1.3",
+ "version": "3.1.4",
"homepage": "https://github.com/jquery/api.jquery.com",
"author": {
"name": "jQuery Foundation and other contributors"
From 9f6bbf1c186557e253120544b7bf8904a053be6d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Go=C5=82=C4=99biowski-Owczarek?=
Date: Mon, 19 Dec 2022 22:20:06 +0100
Subject: [PATCH 013/101] prevAll: Document issues with reverse doc order
`.prevAll()` returns elements in the reverse document order. This
can pose issues when used with APIs like `.append()` or `.wrapAll()`.
Document how to deal with the issue with help from `jQuery.uniqueSort()`.
Ref jquery/jquery#5149
Closes gh-1215
---
entries/prevAll.xml | 95 ++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 94 insertions(+), 1 deletion(-)
diff --git a/entries/prevAll.xml b/entries/prevAll.xml
index 73f3f3f5..4b5f6062 100644
--- a/entries/prevAll.xml
+++ b/entries/prevAll.xml
@@ -7,7 +7,7 @@
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,6 +26,36 @@
$( "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:
+
+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.
@@ -50,6 +80,69 @@ $( "div" ).last().prevAll().addClass( "before" );
+]]>