]> source.dussan.org Git - jquery.git/commitdiff
Fix #11738. Remove deprecated .closest(Array) => Array.
authorDave Methvin <dave.methvin@gmail.com>
Fri, 11 May 2012 19:11:13 +0000 (15:11 -0400)
committerDave Methvin <dave.methvin@gmail.com>
Fri, 11 May 2012 19:11:13 +0000 (15:11 -0400)
src/traversing.js
test/unit/traversing.js

index aa8c10cc04ebc690201f831d7cadeb6e7fe80e38..0627ab4f094553dfe436e2173043778596179dd0 100644 (file)
@@ -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;
index 80d30aa19bd38acd8f02fc87cf76bfb10a9d8b49..39319e4d749a03bf4315f9cd2fc40154fc0f15f9 100644 (file)
@@ -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"),