0
|
1 //>>excludeStart("exclude", pragmas.exclude);
|
|
2 define([ "shoestring" ], function(){
|
|
3 //>>excludeEnd("exclude");
|
|
4
|
|
5 /**
|
|
6 * Get the value of the first element of the set or set the value of all the elements in the set.
|
|
7 *
|
|
8 * @param {string} name The attribute name.
|
|
9 * @param {string} value The new value for the attribute.
|
|
10 * @return {shoestring|string|undefined}
|
|
11 * @this {shoestring}
|
|
12 */
|
|
13 shoestring.fn.attr = function( name, value ){
|
|
14 var nameStr = typeof( name ) === "string";
|
|
15
|
|
16 if( value !== undefined || !nameStr ){
|
|
17 return this.each(function(){
|
|
18 if( nameStr ){
|
|
19 this.setAttribute( name, value );
|
|
20 } else {
|
|
21 for( var i in name ){
|
|
22 if( name.hasOwnProperty( i ) ){
|
|
23 this.setAttribute( i, name[ i ] );
|
|
24 }
|
|
25 }
|
|
26 }
|
|
27 });
|
|
28 } else {
|
|
29 return this[ 0 ] ? this[ 0 ].getAttribute( name ) : undefined;
|
|
30 }
|
|
31 };
|
|
32
|
|
33 //>>excludeStart("exclude", pragmas.exclude);
|
|
34 });
|
|
35 //>>excludeEnd("exclude");
|