MDL-35616 import YUI 3.7.2
[moodle.git] / lib / yuilib / 3.7.2 / build / node-style / node-style-debug.js
blobd3f91297d37110b2b5f24842325bd0ff1260ded4
1 /*
2 YUI 3.7.2 (build 5639)
3 Copyright 2012 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
6 */
7 YUI.add('node-style', function (Y, NAME) {
9 (function(Y) {
10 /**
11  * Extended Node interface for managing node styles.
12  * @module node
13  * @submodule node-style
14  */
16 Y.mix(Y.Node.prototype, {
17     /**
18      * Sets a style property of the node.
19      * Use camelCase (e.g. 'backgroundColor') for multi-word properties.
20      * @method setStyle
21      * @param {String} attr The style attribute to set. 
22      * @param {String|Number} val The value. 
23      * @chainable
24      */
25     setStyle: function(attr, val) {
26         Y.DOM.setStyle(this._node, attr, val);
27         return this;
28     },
30     /**
31      * Sets multiple style properties on the node.
32      * Use camelCase (e.g. 'backgroundColor') for multi-word properties.
33      * @method setStyles
34      * @param {Object} hash An object literal of property:value pairs. 
35      * @chainable
36      */
37     setStyles: function(hash) {
38         Y.DOM.setStyles(this._node, hash);
39         return this;
40     },
42     /**
43      * Returns the style's current value.
44      * Use camelCase (e.g. 'backgroundColor') for multi-word properties.
45      * @method getStyle
46      * @for Node
47      * @param {String} attr The style attribute to retrieve. 
48      * @return {String} The current value of the style property for the element.
49      */
51      getStyle: function(attr) {
52         return Y.DOM.getStyle(this._node, attr);
53      },
55     /**
56      * Returns the computed value for the given style property.
57      * Use camelCase (e.g. 'backgroundColor') for multi-word properties.
58      * @method getComputedStyle
59      * @param {String} attr The style attribute to retrieve. 
60      * @return {String} The computed value of the style property for the element.
61      */
62      getComputedStyle: function(attr) {
63         return Y.DOM.getComputedStyle(this._node, attr);
64      }
65 });
67 /**
68  * Returns an array of values for each node.
69  * Use camelCase (e.g. 'backgroundColor') for multi-word properties.
70  * @method getStyle
71  * @for NodeList
72  * @see Node.getStyle
73  * @param {String} attr The style attribute to retrieve. 
74  * @return {Array} The current values of the style property for the element.
75  */
77 /**
78  * Returns an array of the computed value for each node.
79  * Use camelCase (e.g. 'backgroundColor') for multi-word properties.
80  * @method getComputedStyle
81  * @see Node.getComputedStyle
82  * @param {String} attr The style attribute to retrieve. 
83  * @return {Array} The computed values for each node.
84  */
86 /**
87  * Sets a style property on each node.
88  * Use camelCase (e.g. 'backgroundColor') for multi-word properties.
89  * @method setStyle
90  * @see Node.setStyle
91  * @param {String} attr The style attribute to set. 
92  * @param {String|Number} val The value. 
93  * @chainable
94  */
96 /**
97  * Sets multiple style properties on each node.
98  * Use camelCase (e.g. 'backgroundColor') for multi-word properties.
99  * @method setStyles
100  * @see Node.setStyles
101  * @param {Object} hash An object literal of property:value pairs. 
102  * @chainable
103  */
105 // These are broken out to handle undefined return (avoid false positive for
106 // chainable)
108 Y.NodeList.importMethod(Y.Node.prototype, ['getStyle', 'getComputedStyle', 'setStyle', 'setStyles']);
109 })(Y);
112 }, '3.7.2', {"requires": ["dom-style", "node-base"]});