0
|
1 //>>excludeStart("exclude", pragmas.exclude);
|
|
2 define([
|
|
3 "shoestring",
|
|
4 "dom/css/getStyle",
|
|
5 "dom/css/setStyle"
|
|
6 ], function(){
|
|
7 //>>excludeEnd("exclude");// TODO: This code should be consistent with attr().
|
|
8
|
|
9 /**
|
|
10 * Get the compute style property of the first element or set the value of a style property
|
|
11 * on all elements in the set.
|
|
12 *
|
|
13 * @method _setStyle
|
|
14 * @param {string} property The property being used to style the element.
|
|
15 * @param {string|undefined} value The css value for the style property.
|
|
16 * @return {string|shoestring}
|
|
17 * @this shoestring
|
|
18 */
|
|
19 shoestring.fn.css = function( property, value ){
|
|
20 if( !this[0] ){
|
|
21 return;
|
|
22 }
|
|
23
|
|
24 if( typeof property === "object" ) {
|
|
25 return this.each(function() {
|
|
26 for( var key in property ) {
|
|
27 if( property.hasOwnProperty( key ) ) {
|
|
28 shoestring._setStyle( this, key, property[key] );
|
|
29 }
|
|
30 }
|
|
31 });
|
|
32 } else {
|
|
33 // assignment else retrieve first
|
|
34 if( value !== undefined ){
|
|
35 return this.each(function(){
|
|
36 shoestring._setStyle( this, property, value );
|
|
37 });
|
|
38 }
|
|
39
|
|
40 return shoestring._getStyle( this[0], property );
|
|
41 }
|
|
42 };
|
|
43
|
|
44 //>>excludeStart("exclude", pragmas.exclude);
|
|
45 });
|
|
46 //>>excludeEnd("exclude");
|