diff options
Diffstat (limited to 'cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/traversing')
4 files changed, 153 insertions, 0 deletions
diff --git a/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/traversing/findFilter.js b/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/traversing/findFilter.js new file mode 100644 index 00000000..3bd036a1 --- /dev/null +++ b/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/traversing/findFilter.js @@ -0,0 +1,106 @@ +define( [ + "../core", + "../var/indexOf", + "./var/rneedsContext", + "../selector" +], function( jQuery, indexOf, rneedsContext ) { + +"use strict"; + +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 ) { + return !!qualifier.call( elem, i, elem ) !== not; + } ); + } + + // Single element + if ( qualifier.nodeType ) { + return jQuery.grep( elements, function( elem ) { + return ( elem === qualifier ) !== not; + } ); + } + + // Arraylike of elements (jQuery, arguments, Array) + if ( typeof qualifier !== "string" ) { + return jQuery.grep( elements, function( elem ) { + return ( indexOf.call( qualifier, elem ) > -1 ) !== not; + } ); + } + + // Simple selector that can be filtered directly, removing non-Elements + if ( risSimple.test( qualifier ) ) { + return jQuery.filter( qualifier, elements, not ); + } + + // Complex selector, compare the two sets, removing non-Elements + qualifier = jQuery.filter( qualifier, elements ); + return jQuery.grep( elements, function( elem ) { + return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1; + } ); +} + +jQuery.filter = function( expr, elems, not ) { + var elem = elems[ 0 ]; + + if ( not ) { + expr = ":not(" + expr + ")"; + } + + if ( elems.length === 1 && elem.nodeType === 1 ) { + return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; + } + + return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { + return elem.nodeType === 1; + } ) ); +}; + +jQuery.fn.extend( { + find: function( selector ) { + var i, ret, + len = this.length, + 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; + } + } + } ) ); + } + + ret = this.pushStack( [] ); + + for ( i = 0; i < len; i++ ) { + jQuery.find( selector, self[ i ], ret ); + } + + return len > 1 ? jQuery.uniqueSort( ret ) : 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/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/traversing/var/dir.js b/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/traversing/var/dir.js new file mode 100644 index 00000000..366a823d --- /dev/null +++ b/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/traversing/var/dir.js @@ -0,0 +1,22 @@ +define( [ + "../../core" +], function( jQuery ) { + +"use strict"; + +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/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/traversing/var/rneedsContext.js b/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/traversing/var/rneedsContext.js new file mode 100644 index 00000000..d0663cee --- /dev/null +++ b/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/traversing/var/rneedsContext.js @@ -0,0 +1,8 @@ +define( [ + "../../core", + "../../selector" +], function( jQuery ) { + "use strict"; + + return jQuery.expr.match.needsContext; +} ); diff --git a/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/traversing/var/siblings.js b/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/traversing/var/siblings.js new file mode 100644 index 00000000..952629d0 --- /dev/null +++ b/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/traversing/var/siblings.js @@ -0,0 +1,17 @@ +define( function() { + +"use strict"; + +return function( n, elem ) { + var matched = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + matched.push( n ); + } + } + + return matched; +}; + +} ); |