|
0
|
1 |
/* |
|
|
2 |
Copyright (c) 2009, Yahoo! Inc. All rights reserved. |
|
|
3 |
Code licensed under the BSD License: |
|
|
4 |
http://developer.yahoo.net/yui/license.txt |
|
|
5 |
version: 3.0.0b1 |
|
|
6 |
build: 1163 |
|
|
7 |
*/ |
|
|
8 |
YUI.add('node-style', function(Y) { |
|
|
9 |
|
|
|
10 |
(function(Y) { |
|
|
11 |
/** |
|
|
12 |
* Extended Node interface for managing node styles. |
|
|
13 |
* @module node |
|
|
14 |
* @submodule node-style |
|
|
15 |
*/ |
|
|
16 |
|
|
|
17 |
var methods = [ |
|
|
18 |
/** |
|
|
19 |
* Returns the style's current value. |
|
|
20 |
* @method getStyle |
|
|
21 |
* @for Node |
|
|
22 |
* @param {String} attr The style attribute to retrieve. |
|
|
23 |
* @return {String} The current value of the style property for the element. |
|
|
24 |
*/ |
|
|
25 |
'getStyle', |
|
|
26 |
|
|
|
27 |
/** |
|
|
28 |
* Returns the computed value for the given style property. |
|
|
29 |
* @method getComputedStyle |
|
|
30 |
* @param {String} attr The style attribute to retrieve. |
|
|
31 |
* @return {String} The computed value of the style property for the element. |
|
|
32 |
*/ |
|
|
33 |
'getComputedStyle', |
|
|
34 |
|
|
|
35 |
/** |
|
|
36 |
* Sets a style property of the node. |
|
|
37 |
* @method setStyle |
|
|
38 |
* @param {String} attr The style attribute to set. |
|
|
39 |
* @param {String|Number} val The value. |
|
|
40 |
* @chainable |
|
|
41 |
*/ |
|
|
42 |
'setStyle', |
|
|
43 |
|
|
|
44 |
/** |
|
|
45 |
* Sets multiple style properties on the node. |
|
|
46 |
* @method setStyles |
|
|
47 |
* @param {Object} hash An object literal of property:value pairs. |
|
|
48 |
* @chainable |
|
|
49 |
*/ |
|
|
50 |
'setStyles' |
|
|
51 |
]; |
|
|
52 |
Y.Node.importMethod(Y.DOM, methods); |
|
|
53 |
/** |
|
|
54 |
* Returns an array of values for each node. |
|
|
55 |
* @method getStyle |
|
|
56 |
* @for NodeList |
|
|
57 |
* @see Node.getStyle |
|
|
58 |
* @param {String} attr The style attribute to retrieve. |
|
|
59 |
* @return {Array} The current values of the style property for the element. |
|
|
60 |
*/ |
|
|
61 |
|
|
|
62 |
/** |
|
|
63 |
* Returns an array of the computed value for each node. |
|
|
64 |
* @method getComputedStyle |
|
|
65 |
* @see Node.getComputedStyle |
|
|
66 |
* @param {String} attr The style attribute to retrieve. |
|
|
67 |
* @return {Array} The computed values for each node. |
|
|
68 |
*/ |
|
|
69 |
'getComputedStyle', |
|
|
70 |
|
|
|
71 |
/** |
|
|
72 |
* Sets a style property on each node. |
|
|
73 |
* @method setStyle |
|
|
74 |
* @see Node.setStyle |
|
|
75 |
* @param {String} attr The style attribute to set. |
|
|
76 |
* @param {String|Number} val The value. |
|
|
77 |
* @chainable |
|
|
78 |
*/ |
|
|
79 |
'setStyle', |
|
|
80 |
|
|
|
81 |
/** |
|
|
82 |
* Sets multiple style properties on each node. |
|
|
83 |
* @method setStyles |
|
|
84 |
* @see Node.setStyles |
|
|
85 |
* @param {Object} hash An object literal of property:value pairs. |
|
|
86 |
* @chainable |
|
|
87 |
*/ |
|
|
88 |
'setStyles' |
|
|
89 |
Y.NodeList.importMethod(Y.Node.prototype, methods); |
|
|
90 |
})(Y); |
|
|
91 |
|
|
|
92 |
|
|
|
93 |
}, '3.0.0b1' ,{requires:['dom-style', 'node-base']}); |