Mercurial > nebulaweb3
diff default/node_modules/shoestring/src/dom/prop.js @ 0:1d038bc9b3d2 default tip
Up:default
author | Liny <dev@neowd.com> |
---|---|
date | Sat, 31 May 2025 09:21:51 +0800 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/default/node_modules/shoestring/src/dom/prop.js Sat May 31 09:21:51 2025 +0800 @@ -0,0 +1,31 @@ +//>>excludeStart("exclude", pragmas.exclude); +define([ "shoestring", "dom/propFix.js" ], function(){ +//>>excludeEnd("exclude"); + + /** + * Gets the property value from the first element or sets the property value on all elements of the currrent set. + * + * @param {string} name The property name. + * @param {any} value The property value. + * @return {any|shoestring} + * @this shoestring + */ + shoestring.fn.prop = function( name, value ){ + if( !this[0] ){ + return; + } + + name = shoestring.propFix[ name ] || name; + + if( value !== undefined ){ + return this.each(function(){ + this[ name ] = value; + }); + } else { + return this[ 0 ][ name ]; + } + }; + +//>>excludeStart("exclude", pragmas.exclude); +}); +//>>excludeEnd("exclude");