diff options
author | Lars Henrik Mai <lars.mai@kontinui.de> | 2014-09-23 08:44:31 +0200 |
---|---|---|
committer | Lars Henrik Mai <lars.mai@kontinui.de> | 2014-09-23 08:44:31 +0200 |
commit | 7fc6575a7a38daa21a26e2b179a92ca809b61eea (patch) | |
tree | 679498b3fd59aa375c6c6ce7ba48ed3d6a6e11d7 /source/bower_components/jquery/src/traversing | |
parent | 35239fc1f4641db1e602383b43cc29b151cde9b9 (diff) | |
parent | 1c177d628ffdb693483b1c39b94b5f19adcd8095 (diff) |
Merge branch 'replace-bootstrap-with-foundation'
Diffstat (limited to 'source/bower_components/jquery/src/traversing')
-rw-r--r-- | source/bower_components/jquery/src/traversing/findFilter.js | 100 | ||||
-rw-r--r-- | source/bower_components/jquery/src/traversing/var/rneedsContext.js | 6 |
2 files changed, 106 insertions, 0 deletions
diff --git a/source/bower_components/jquery/src/traversing/findFilter.js b/source/bower_components/jquery/src/traversing/findFilter.js new file mode 100644 index 0000000..dd70a73 --- /dev/null +++ b/source/bower_components/jquery/src/traversing/findFilter.js @@ -0,0 +1,100 @@ +define([ + "../core", + "../var/indexOf", + "./var/rneedsContext", + "../selector" +], function( jQuery, indexOf, rneedsContext ) { + +var risSimple = /^.[^:#\[\.,]*$/; + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, not ) { + if ( jQuery.isFunction( qualifier ) ) { + 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; + }); + + } + + if ( typeof qualifier === "string" ) { + if ( risSimple.test( qualifier ) ) { + return jQuery.filter( qualifier, elements, not ); + } + + qualifier = jQuery.filter( qualifier, elements ); + } + + return jQuery.grep( elements, function( elem ) { + return ( indexOf.call( qualifier, elem ) >= 0 ) !== not; + }); +} + +jQuery.filter = function( expr, elems, not ) { + var elem = elems[ 0 ]; + + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 && elem.nodeType === 1 ? + jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : + jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { + return elem.nodeType === 1; + })); +}; + +jQuery.fn.extend({ + find: function( selector ) { + var i, + len = this.length, + ret = [], + self = this; + + if ( typeof selector !== "string" ) { + 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++ ) { + jQuery.find( selector, self[ i ], ret ); + } + + // Needed because $( selector, context ) becomes $( context ).find( selector ) + ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); + ret.selector = this.selector ? this.selector + " " + selector : selector; + return ret; + }, + filter: function( selector ) { + return this.pushStack( winnow(this, selector || [], false) ); + }, + not: function( selector ) { + return this.pushStack( winnow(this, selector || [], true) ); + }, + is: function( selector ) { + return !!winnow( + this, + + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + typeof selector === "string" && rneedsContext.test( selector ) ? + jQuery( selector ) : + selector || [], + false + ).length; + } +}); + +}); diff --git a/source/bower_components/jquery/src/traversing/var/rneedsContext.js b/source/bower_components/jquery/src/traversing/var/rneedsContext.js new file mode 100644 index 0000000..3d6ae40 --- /dev/null +++ b/source/bower_components/jquery/src/traversing/var/rneedsContext.js @@ -0,0 +1,6 @@ +define([ + "../../core", + "../../selector" +], function( jQuery ) { + return jQuery.expr.match.needsContext; +}); |