aboutsummaryrefslogtreecommitdiffstats
path: root/src/traversing.js
diff options
context:
space:
mode:
authorOleg Gaidarenko <markelog@gmail.com>2015-08-16 09:59:58 +0300
committerOleg Gaidarenko <markelog@gmail.com>2015-09-07 20:03:50 +0300
commit10fdad742a2a6aa9f0e00b3e04fc5264797c53c7 (patch)
tree6b6d7b1375ff88f4bebbfa0703f7b595eb485df9 /src/traversing.js
parent7aa46e0df8a673e6b00550bbbbed21eed50108b7 (diff)
downloadjquery-10fdad742a2a6aa9f0e00b3e04fc5264797c53c7.tar.gz
jquery-10fdad742a2a6aa9f0e00b3e04fc5264797c53c7.zip
Build: Update jscs and lint files
Fixes gh-2056
Diffstat (limited to 'src/traversing.js')
-rw-r--r--src/traversing.js39
1 files changed, 21 insertions, 18 deletions
diff --git a/src/traversing.js b/src/traversing.js
index 19f8d24e7..a47b048ba 100644
--- a/src/traversing.js
+++ b/src/traversing.js
@@ -1,4 +1,4 @@
-define([
+define( [
"./core",
"./var/indexOf",
"./traversing/var/rneedsContext",
@@ -8,6 +8,7 @@ define([
], function( jQuery, indexOf, rneedsContext ) {
var rparentsprev = /^(?:parents|prev(?:Until|All))/,
+
// Methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = {
children: true,
@@ -16,12 +17,12 @@ var rparentsprev = /^(?:parents|prev(?:Until|All))/,
prev: true
};
-jQuery.extend({
+jQuery.extend( {
dir: function( elem, dir, until ) {
var matched = [],
truncate = until !== undefined;
- while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) {
+ while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
if ( elem.nodeType === 1 ) {
if ( truncate && jQuery( elem ).is( until ) ) {
break;
@@ -43,21 +44,21 @@ jQuery.extend({
return matched;
}
-});
+} );
-jQuery.fn.extend({
+jQuery.fn.extend( {
has: function( target ) {
var targets = jQuery( target, this ),
l = targets.length;
- return this.filter(function() {
+ return this.filter( function() {
var i = 0;
for ( ; i < l; i++ ) {
- if ( jQuery.contains( this, targets[i] ) ) {
+ if ( jQuery.contains( this, targets[ i ] ) ) {
return true;
}
}
- });
+ } );
},
closest: function( selectors, context ) {
@@ -70,14 +71,15 @@ jQuery.fn.extend({
0;
for ( ; i < l; i++ ) {
- for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
+ for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
+
// Always skip document fragments
- if ( cur.nodeType < 11 && (pos ?
- pos.index(cur) > -1 :
+ if ( cur.nodeType < 11 && ( pos ?
+ pos.index( cur ) > -1 :
// Don't pass non-elements to Sizzle
cur.nodeType === 1 &&
- jQuery.find.matchesSelector(cur, selectors)) ) {
+ jQuery.find.matchesSelector( cur, selectors ) ) ) {
matched.push( cur );
break;
@@ -119,17 +121,17 @@ jQuery.fn.extend({
addBack: function( selector ) {
return this.add( selector == null ?
- this.prevObject : this.prevObject.filter(selector)
+ this.prevObject : this.prevObject.filter( selector )
);
}
-});
+} );
function sibling( cur, dir ) {
- while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {}
+ while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
return cur;
}
-jQuery.each({
+jQuery.each( {
parent: function( elem ) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
@@ -180,6 +182,7 @@ jQuery.each({
}
if ( this.length > 1 ) {
+
// Remove duplicates
if ( !guaranteedUnique[ name ] ) {
jQuery.uniqueSort( matched );
@@ -193,7 +196,7 @@ jQuery.each({
return this.pushStack( matched );
};
-});
+} );
return jQuery;
-});
+} );