Skip to content
Permalink
Browse files

Tweaking some formatting of the closest changes.

  • Loading branch information...
jeresig committed Oct 10, 2010
1 parent ba149e7 commit fac7e61f16130b29d5444fab12628a5eeea885cf
Showing with 5 additions and 8 deletions.
  1. +5 −8 src/traversing.js
@@ -62,14 +62,13 @@ jQuery.fn.extend({
},

closest: function( selectors, context ) {
var ret;
var ret = [], i, l, cur = this[0];

if ( jQuery.isArray( selectors ) ) {
var cur = this[0], match, matches = {}, selector, level = 1;
ret = [];
var match, matches = {}, selector, level = 1;

This comment has been minimized.

Copy link
@damienholzapfel

damienholzapfel Oct 11, 2010

These declarations could be consolidated onto line 65.

This comment has been minimized.

Copy link
@jeresig

jeresig Oct 11, 2010

Author Member

I didn't want to do that as those declarations are only relevant within that if block. No reason to move all the declarations up - just the ones that are universally useful within the function.


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];

if ( !matches[selector] ) {
@@ -99,10 +98,8 @@ jQuery.fn.extend({
var pos = POS.test( selectors ) ?
jQuery( selectors, context || this.context ) : null;

ret = [];

for ( var i = 0, j = this.length; i < j; i++ ) {
var cur = this[i];
for ( i = 0, l = this.length; i < l; i++ ) {
cur = this[i];

while ( cur ) {
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {

0 comments on commit fac7e61

Please sign in to comment.
You can’t perform that action at this time.