From 0cf6b232ac9cf128ee9183a27c08f4f74ab2e2e6 Mon Sep 17 00:00:00 2001 From: grakiss Date: Thu, 28 Sep 2017 03:47:54 -0400 Subject: add api&web services for cvp JIRA: DOVETAIL-512 add api&web services for cvp Change-Id: I9ef9525e980fe61dc3108035ef9a3ff8783b2697 Signed-off-by: grakiss --- .../assets/lib/jquery/src/traversing/findFilter.js | 106 +++++++++++++++++++++ .../assets/lib/jquery/src/traversing/var/dir.js | 22 +++++ .../lib/jquery/src/traversing/var/rneedsContext.js | 8 ++ .../lib/jquery/src/traversing/var/siblings.js | 17 ++++ 4 files changed, 153 insertions(+) create mode 100644 cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/traversing/findFilter.js create mode 100644 cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/traversing/var/dir.js create mode 100644 cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/traversing/var/rneedsContext.js create mode 100644 cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/traversing/var/siblings.js (limited to 'cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/traversing') 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; +}; + +} ); -- cgit 1.2.3-korg