aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorTimmy Willison <timmywillisn@gmail.com>2012-07-25 16:05:48 -0400
committerTimmy Willison <timmywillisn@gmail.com>2012-07-25 16:05:59 -0400
commit17a26f5bd9b14225248942b876e96545b4c21fb6 (patch)
tree6cf008ad461160c9a07d58fc652fd28b493548b1 /test/unit
parent3478cbb4d4f59473512891a6ba83158d47f26bf1 (diff)
downloadjquery-17a26f5bd9b14225248942b876e96545b4c21fb6.tar.gz
jquery-17a26f5bd9b14225248942b876e96545b4c21fb6.zip
Fail silently if closest is somehow called on a document. Fixes #10726.
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/traversing.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/unit/traversing.js b/test/unit/traversing.js
index 2712e7f2f..7f9678307 100644
--- a/test/unit/traversing.js
+++ b/test/unit/traversing.js
@@ -275,7 +275,8 @@ test("filter() with positional selectors", function() {
});
test("closest()", function() {
- expect(13);
+ expect( 14 );
+
deepEqual( jQuery("body").closest("body").get(), q("body"), "closest(body)" );
deepEqual( jQuery("body").closest("html").get(), q("html"), "closest(html)" );
deepEqual( jQuery("body").closest("div").get(), [], "closest(div)" );
@@ -299,6 +300,8 @@ test("closest()", function() {
// Bug #7369
equal( jQuery("<div foo='bar'></div>").closest("[foo]").length, 1, "Disconnected nodes with attribute selector" );
equal( jQuery("<div>text</div>").closest("[lang]").length, 0, "Disconnected nodes with text and non-existent attribute selector" );
+
+ ok( !jQuery(document).closest("#foo").length, "Calling closest on a document fails silently" );
});
test("closest(jQuery)", function() {