Sha256: ea17185abdf20aa74ebcd94c1cd23cd4a0896ee4492a98e7872093d06c5b6ed8

Contents?: true

Size: 1.19 KB

Versions: 24

Compression:

Stored size: 1.19 KB

Contents

//>>excludeStart("exclude", pragmas.exclude);
define([
	"shoestring",
	"dom/is" // note this dependency is only used for a dev error
], function(){
//>>excludeEnd("exclude");

	/**
	 * Get data attached to the first element or set data values on all elements in the current set.
	 *
	 * @param {string} name The data attribute name.
	 * @param {any} value The value assigned to the data attribute.
	 * @return {any|shoestring}
	 * @this shoestring
	 */
	shoestring.fn.data = function( name, value ){
		if( name !== undefined ){
			if( value !== undefined ){
				return this.each(function(){
					if( !this.shoestringData ){
						this.shoestringData = {};
					}

					this.shoestringData[ name ] = value;
				});
			}
			else {
				if( this[ 0 ] ) {
					if( this[ 0 ].shoestringData ) {
						return this[ 0 ].shoestringData[ name ];
					}
//>>includeStart("development", pragmas.development);
					if( shoestring( this[ 0 ] ).is( "[data-" + name + "]" ) ){
						shoestring.error( 'data-attr-alias' );
					}
//>>includeEnd("development");
				}
			}
		}
		else {
			return this[ 0 ] ? this[ 0 ].shoestringData || {} : undefined;
		}
	};
//>>excludeStart("exclude", pragmas.exclude);
});
//>>excludeEnd("exclude");

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
trusty-cms-6.3.1 node_modules/shoestring/src/data/data.js
trusty-cms-5.0.7 node_modules/shoestring/src/data/data.js
trusty-cms-5.0.6 node_modules/shoestring/src/data/data.js
trusty-cms-5.0.5 node_modules/shoestring/src/data/data.js
trusty-cms-5.0.4 node_modules/shoestring/src/data/data.js
trusty-cms-5.0.3 node_modules/shoestring/src/data/data.js
trusty-cms-5.0.2 node_modules/shoestring/src/data/data.js
trusty-cms-5.0.1 node_modules/shoestring/src/data/data.js
trusty-cms-4.3.5 node_modules/shoestring/src/data/data.js
trusty-cms-5.0.0 node_modules/shoestring/src/data/data.js
trusty-cms-4.3.4 node_modules/shoestring/src/data/data.js
trusty-cms-4.3.3 node_modules/shoestring/src/data/data.js
trusty-cms-4.3.2 node_modules/shoestring/src/data/data.js
trusty-cms-4.3.1 node_modules/shoestring/src/data/data.js
trusty-cms-4.3 node_modules/shoestring/src/data/data.js
trusty-cms-4.2.3 node_modules/shoestring/src/data/data.js
trusty-cms-4.2.2 node_modules/shoestring/src/data/data.js
trusty-cms-4.2.1 node_modules/shoestring/src/data/data.js
trusty-cms-4.2 node_modules/shoestring/src/data/data.js
trusty-cms-4.1.9 node_modules/shoestring/src/data/data.js