Tweaking some formatting of the closest changes.

This commit is contained in:
jeresig 2010-10-10 15:42:56 -04:00
parent ba149e78a9
commit fac7e61f16

View file

@ -62,14 +62,13 @@ jQuery.fn.extend({
}, },
closest: function( selectors, context ) { closest: function( selectors, context ) {
var ret; var ret = [], i, l, cur = this[0];
if ( jQuery.isArray( selectors ) ) { if ( jQuery.isArray( selectors ) ) {
var cur = this[0], match, matches = {}, selector, level = 1; var match, matches = {}, selector, level = 1;
ret = [];
if ( cur && selectors.length ) { if ( cur && selectors.length ) {
for ( var i = 0, l = selectors.length; i < l; i++ ) { for ( i = 0, l = selectors.length; i < l; i++ ) {
selector = selectors[i]; selector = selectors[i];
if ( !matches[selector] ) { if ( !matches[selector] ) {
@ -99,10 +98,8 @@ jQuery.fn.extend({
var pos = POS.test( selectors ) ? var pos = POS.test( selectors ) ?
jQuery( selectors, context || this.context ) : null; jQuery( selectors, context || this.context ) : null;
ret = []; for ( i = 0, l = this.length; i < l; i++ ) {
cur = this[i];
for ( var i = 0, j = this.length; i < j; i++ ) {
var cur = this[i];
while ( cur ) { while ( cur ) {
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {