|
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.0 |
|
6 build: 1549 |
|
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 |
|
70 /** |
|
71 * Sets a style property on each node. |
|
72 * @method setStyle |
|
73 * @see Node.setStyle |
|
74 * @param {String} attr The style attribute to set. |
|
75 * @param {String|Number} val The value. |
|
76 * @chainable |
|
77 */ |
|
78 |
|
79 /** |
|
80 * Sets multiple style properties on each node. |
|
81 * @method setStyles |
|
82 * @see Node.setStyles |
|
83 * @param {Object} hash An object literal of property:value pairs. |
|
84 * @chainable |
|
85 */ |
|
86 Y.NodeList.importMethod(Y.Node.prototype, methods); |
|
87 })(Y); |
|
88 |
|
89 |
|
90 }, '3.0.0' ,{requires:['dom-style', 'node-base']}); |