comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:1d038bc9b3d2
1 //>>excludeStart("exclude", pragmas.exclude);
2 define([ "shoestring", "dom/propFix.js" ], function(){
3 //>>excludeEnd("exclude");
4
5 /**
6 * Gets the property value from the first element or sets the property value on all elements of the currrent set.
7 *
8 * @param {string} name The property name.
9 * @param {any} value The property value.
10 * @return {any|shoestring}
11 * @this shoestring
12 */
13 shoestring.fn.prop = function( name, value ){
14 if( !this[0] ){
15 return;
16 }
17
18 name = shoestring.propFix[ name ] || name;
19
20 if( value !== undefined ){
21 return this.each(function(){
22 this[ name ] = value;
23 });
24 } else {
25 return this[ 0 ][ name ];
26 }
27 };
28
29 //>>excludeStart("exclude", pragmas.exclude);
30 });
31 //>>excludeEnd("exclude");