diff options
Diffstat (limited to 'libs/bower_components/jquery/src/traversing')
4 files changed, 52 insertions, 17 deletions
diff --git a/libs/bower_components/jquery/src/traversing/findFilter.js b/libs/bower_components/jquery/src/traversing/findFilter.js index e295045a50..7d4b2cab9e 100644 --- a/libs/bower_components/jquery/src/traversing/findFilter.js +++ b/libs/bower_components/jquery/src/traversing/findFilter.js @@ -1,4 +1,4 @@ -define([ +define( [ "../core", "../var/indexOf", "./var/rneedsContext", @@ -13,14 +13,14 @@ function winnow( elements, qualifier, not ) { return jQuery.grep( elements, function( elem, i ) { /* jshint -W018 */ return !!qualifier.call( elem, i, elem ) !== not; - }); + } ); } if ( qualifier.nodeType ) { return jQuery.grep( elements, function( elem ) { return ( elem === qualifier ) !== not; - }); + } ); } @@ -33,8 +33,8 @@ function winnow( elements, qualifier, not ) { } return jQuery.grep( elements, function( elem ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; - }); + return ( indexOf.call( qualifier, elem ) > -1 ) !== not; + } ); } jQuery.filter = function( expr, elems, not ) { @@ -48,24 +48,24 @@ jQuery.filter = function( expr, elems, not ) { jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { return elem.nodeType === 1; - })); + } ) ); }; -jQuery.fn.extend({ +jQuery.fn.extend( { find: function( selector ) { var i, + len = this.length, ret = [], - self = this, - len = self.length; + self = this; if ( typeof selector !== "string" ) { - return this.pushStack( jQuery( selector ).filter(function() { + return this.pushStack( jQuery( selector ).filter( function() { for ( i = 0; i < len; i++ ) { if ( jQuery.contains( self[ i ], this ) ) { return true; } } - }) ); + } ) ); } for ( i = 0; i < len; i++ ) { @@ -78,10 +78,10 @@ jQuery.fn.extend({ return ret; }, filter: function( selector ) { - return this.pushStack( winnow(this, selector || [], false) ); + return this.pushStack( winnow( this, selector || [], false ) ); }, not: function( selector ) { - return this.pushStack( winnow(this, selector || [], true) ); + return this.pushStack( winnow( this, selector || [], true ) ); }, is: function( selector ) { return !!winnow( @@ -95,6 +95,6 @@ jQuery.fn.extend({ false ).length; } -}); +} ); -}); +} ); diff --git a/libs/bower_components/jquery/src/traversing/var/dir.js b/libs/bower_components/jquery/src/traversing/var/dir.js new file mode 100644 index 0000000000..b98fdca0e9 --- /dev/null +++ b/libs/bower_components/jquery/src/traversing/var/dir.js @@ -0,0 +1,20 @@ +define( [ + "../../core" +], function( jQuery ) { + +return function( elem, dir, until ) { + var matched = [], + truncate = until !== undefined; + + while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { + if ( elem.nodeType === 1 ) { + if ( truncate && jQuery( elem ).is( until ) ) { + break; + } + matched.push( elem ); + } + } + return matched; +}; + +} ); diff --git a/libs/bower_components/jquery/src/traversing/var/rneedsContext.js b/libs/bower_components/jquery/src/traversing/var/rneedsContext.js index 3d6ae40380..f57fd9de2f 100644 --- a/libs/bower_components/jquery/src/traversing/var/rneedsContext.js +++ b/libs/bower_components/jquery/src/traversing/var/rneedsContext.js @@ -1,6 +1,6 @@ -define([ +define( [ "../../core", "../../selector" ], function( jQuery ) { return jQuery.expr.match.needsContext; -}); +} ); diff --git a/libs/bower_components/jquery/src/traversing/var/siblings.js b/libs/bower_components/jquery/src/traversing/var/siblings.js new file mode 100644 index 0000000000..8a8880bf74 --- /dev/null +++ b/libs/bower_components/jquery/src/traversing/var/siblings.js @@ -0,0 +1,15 @@ +define( function() { + +return function( n, elem ) { + var matched = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + matched.push( n ); + } + } + + return matched; +}; + +} ); |