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 --- .../testapi-ui/assets/lib/jquery/src/data/Data.js | 161 +++++++++++++++++++++ .../assets/lib/jquery/src/data/var/acceptData.js | 19 +++ .../assets/lib/jquery/src/data/var/dataPriv.js | 7 + .../assets/lib/jquery/src/data/var/dataUser.js | 7 + 4 files changed, 194 insertions(+) create mode 100644 cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/data/Data.js create mode 100644 cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/data/var/acceptData.js create mode 100644 cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/data/var/dataPriv.js create mode 100644 cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/data/var/dataUser.js (limited to 'cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/data') diff --git a/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/data/Data.js b/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/data/Data.js new file mode 100644 index 00000000..8c856c03 --- /dev/null +++ b/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/data/Data.js @@ -0,0 +1,161 @@ +define( [ + "../core", + "../var/rnothtmlwhite", + "./var/acceptData" +], function( jQuery, rnothtmlwhite, acceptData ) { + +"use strict"; + +function Data() { + this.expando = jQuery.expando + Data.uid++; +} + +Data.uid = 1; + +Data.prototype = { + + cache: function( owner ) { + + // Check if the owner object already has a cache + var value = owner[ this.expando ]; + + // If not, create one + if ( !value ) { + value = {}; + + // We can accept data for non-element nodes in modern browsers, + // but we should not, see #8335. + // Always return an empty object. + if ( acceptData( owner ) ) { + + // If it is a node unlikely to be stringify-ed or looped over + // use plain assignment + if ( owner.nodeType ) { + owner[ this.expando ] = value; + + // Otherwise secure it in a non-enumerable property + // configurable must be true to allow the property to be + // deleted when data is removed + } else { + Object.defineProperty( owner, this.expando, { + value: value, + configurable: true + } ); + } + } + } + + return value; + }, + set: function( owner, data, value ) { + var prop, + cache = this.cache( owner ); + + // Handle: [ owner, key, value ] args + // Always use camelCase key (gh-2257) + if ( typeof data === "string" ) { + cache[ jQuery.camelCase( data ) ] = value; + + // Handle: [ owner, { properties } ] args + } else { + + // Copy the properties one-by-one to the cache object + for ( prop in data ) { + cache[ jQuery.camelCase( prop ) ] = data[ prop ]; + } + } + return cache; + }, + get: function( owner, key ) { + return key === undefined ? + this.cache( owner ) : + + // Always use camelCase key (gh-2257) + owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ]; + }, + access: function( owner, key, value ) { + + // In cases where either: + // + // 1. No key was specified + // 2. A string key was specified, but no value provided + // + // Take the "read" path and allow the get method to determine + // which value to return, respectively either: + // + // 1. The entire cache object + // 2. The data stored at the key + // + if ( key === undefined || + ( ( key && typeof key === "string" ) && value === undefined ) ) { + + return this.get( owner, key ); + } + + // When the key is not a string, or both a key and value + // are specified, set or extend (existing objects) with either: + // + // 1. An object of properties + // 2. A key and value + // + this.set( owner, key, value ); + + // Since the "set" path can have two possible entry points + // return the expected data based on which path was taken[*] + return value !== undefined ? value : key; + }, + remove: function( owner, key ) { + var i, + cache = owner[ this.expando ]; + + if ( cache === undefined ) { + return; + } + + if ( key !== undefined ) { + + // Support array or space separated string of keys + if ( Array.isArray( key ) ) { + + // If key is an array of keys... + // We always set camelCase keys, so remove that. + key = key.map( jQuery.camelCase ); + } else { + key = jQuery.camelCase( key ); + + // If a key with the spaces exists, use it. + // Otherwise, create an array by matching non-whitespace + key = key in cache ? + [ key ] : + ( key.match( rnothtmlwhite ) || [] ); + } + + i = key.length; + + while ( i-- ) { + delete cache[ key[ i ] ]; + } + } + + // Remove the expando if there's no more data + if ( key === undefined || jQuery.isEmptyObject( cache ) ) { + + // Support: Chrome <=35 - 45 + // Webkit & Blink performance suffers when deleting properties + // from DOM nodes, so set to undefined instead + // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) + if ( owner.nodeType ) { + owner[ this.expando ] = undefined; + } else { + delete owner[ this.expando ]; + } + } + }, + hasData: function( owner ) { + var cache = owner[ this.expando ]; + return cache !== undefined && !jQuery.isEmptyObject( cache ); + } +}; + +return Data; +} ); diff --git a/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/data/var/acceptData.js b/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/data/var/acceptData.js new file mode 100644 index 00000000..e00f7538 --- /dev/null +++ b/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/data/var/acceptData.js @@ -0,0 +1,19 @@ +define( function() { + +"use strict"; + +/** + * Determines whether an object can have data + */ +return function( owner ) { + + // Accepts only: + // - Node + // - Node.ELEMENT_NODE + // - Node.DOCUMENT_NODE + // - Object + // - Any + return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); +}; + +} ); diff --git a/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/data/var/dataPriv.js b/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/data/var/dataPriv.js new file mode 100644 index 00000000..72713c88 --- /dev/null +++ b/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/data/var/dataPriv.js @@ -0,0 +1,7 @@ +define( [ + "../Data" +], function( Data ) { + "use strict"; + + return new Data(); +} ); diff --git a/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/data/var/dataUser.js b/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/data/var/dataUser.js new file mode 100644 index 00000000..72713c88 --- /dev/null +++ b/cvp/3rd_party/static/testapi-ui/assets/lib/jquery/src/data/var/dataUser.js @@ -0,0 +1,7 @@ +define( [ + "../Data" +], function( Data ) { + "use strict"; + + return new Data(); +} ); -- cgit 1.2.3-korg