aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/traversing.js22
-rw-r--r--test/unit/traversing.js12
2 files changed, 1 insertions, 33 deletions
diff --git a/src/traversing.js b/src/traversing.js
index aa8c10cc0..0627ab4f0 100644
--- a/src/traversing.js
+++ b/src/traversing.js
@@ -84,28 +84,8 @@ jQuery.fn.extend({
},
closest: function( selectors, context ) {
- var ret = [], i, l, cur = this[0];
+ var ret = [], i, l, cur;
- // Array (deprecated as of jQuery 1.7)
- if ( jQuery.isArray( selectors ) ) {
- var level = 1;
-
- while ( cur && cur.ownerDocument && cur !== context ) {
- for ( i = 0; i < selectors.length; i++ ) {
-
- if ( jQuery( cur ).is( selectors[ i ] ) ) {
- ret.push({ selector: selectors[ i ], elem: cur, level: level });
- }
- }
-
- cur = cur.parentNode;
- level++;
- }
-
- return ret;
- }
-
- // String
var pos = POS.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) :
0;
diff --git a/test/unit/traversing.js b/test/unit/traversing.js
index 80d30aa19..39319e4d7 100644
--- a/test/unit/traversing.js
+++ b/test/unit/traversing.js
@@ -299,18 +299,6 @@ test("closest()", function() {
equal( jQuery("<div>text</div>").closest("[lang]").length, 0, "Disconnected nodes with text and non-existent attribute selector" );
});
-test("closest(Array)", function() {
- expect(7);
- deepEqual( jQuery("body").closest(["body"]), [{selector:"body", elem:document.body, level:1}], "closest([body])" );
- deepEqual( jQuery("body").closest(["html"]), [{selector:"html", elem:document.documentElement, level:2}], "closest([html])" );
- deepEqual( jQuery("body").closest(["div"]), [], "closest([div])" );
- deepEqual( jQuery("#yahoo").closest(["div"]), [{"selector":"div", "elem": document.getElementById("foo"), "level": 3}, { "selector": "div", "elem": document.getElementById("qunit-fixture"), "level": 4 }], "closest([div])" );
- deepEqual( jQuery("#qunit-fixture").closest(["span,#html"]), [{selector:"span,#html", elem:document.documentElement, level:4}], "closest([span,#html])" );
-
- deepEqual( jQuery("body").closest(["body","html"]), [{selector:"body", elem:document.body, level:1}, {selector:"html", elem:document.documentElement, level:2}], "closest([body, html])" );
- deepEqual( jQuery("body").closest(["span","html"]), [{selector:"html", elem:document.documentElement, level:2}], "closest([body, html])" );
-});
-
test("closest(jQuery)", function() {
expect(8);
var $child = jQuery("#nothiddendivchild"),