Simple status box for the sidebar.
[elgg_plugins.git] / yui / docs / Element.js.html
blob37f92bc7683e28520d7e279038123cb3b4c0b2f3
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <title>API: element Element.js (YUI Library)</title>
5 <link rel="stylesheet" type="text/css" href="assets/api.css">
6 </head>
8 <body id="yahoo-com">
9 <div id="doc3" class="yui-t2">
11 <div id="hd">
12 <h1>Yahoo! UI Library</h1>
13 <h3>element&nbsp; <span class="subtitle">2.2.0</span></h3>
14 <p>
15 <a href="./index.html">Yahoo! UI Library</a>
16 &gt; <a href="./module_element.html">element</a>
18 &gt; Element.js (source view)
19 </p>
20 </div>
22 <div id="bd">
23 <div id="yui-main">
24 <div class="yui-b">
26 <div id="srcout">
27 <div class="highlight" ><pre><span class="o">(</span><span class="k">function</span><span class="o">()</span> <span class="o">{</span>
28 <span class="c">// internal shorthand</span>
29 <span class="c"></span><span class="k">var</span> <span class="nx">Dom</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Dom</span><span class="o">,</span>
30 <span class="nx">EventPublisher</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">EventPublisher</span><span class="o">,</span>
31 <span class="nx">AttributeProvider</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">AttributeProvider</span><span class="o">;</span>
33 <span class="c">/**</span>
34 <span class="c"> * Element provides an wrapper object to simplify adding</span>
35 <span class="c"> * event listeners, using dom methods, and managing attributes. </span>
36 <span class="c"> * @module element</span>
37 <span class="c"> * @namespace YAHOO.util</span>
38 <span class="c"> * @requires yahoo, dom, event</span>
39 <span class="c"> * @beta</span>
40 <span class="c"> */</span>
42 <span class="c">/**</span>
43 <span class="c"> * Element provides an wrapper object to simplify adding</span>
44 <span class="c"> * event listeners, using dom methods, and managing attributes. </span>
45 <span class="c"> * @class Element</span>
46 <span class="c"> * @uses YAHOO.util.AttributeProvider</span>
47 <span class="c"> * @constructor</span>
48 <span class="c"> * @param el {HTMLElement | String} The html element that </span>
49 <span class="c"> * represents the Element.</span>
50 <span class="c"> * @param {Object} map A key-value map of initial config names and values</span>
51 <span class="c"> */</span>
52 <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Element</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">map</span><span class="o">)</span> <span class="o">{</span>
53 <span class="k">if</span> <span class="o">(</span><span class="nx">arguments</span><span class="o">.</span><span class="nx">length</span><span class="o">)</span> <span class="o">{</span>
54 <span class="k">this</span><span class="o">.</span><span class="nx">init</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">map</span><span class="o">);</span>
55 <span class="o">}</span>
56 <span class="o">};</span>
58 <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Element</span><span class="o">.</span><span class="nx">prototype</span> <span class="o">=</span> <span class="o">{</span>
59 <span class="c">/**</span>
60 <span class="c"> * Dom events supported by the Element instance.</span>
61 <span class="c"> * @property DOM_EVENTS</span>
62 <span class="c"> * @type Object</span>
63 <span class="c"> */</span>
64 <span class="nx">DOM_EVENTS</span><span class="o">:</span> <span class="kc">null</span><span class="o">,</span>
66 <span class="c">/**</span>
67 <span class="c"> * Wrapper for HTMLElement method.</span>
68 <span class="c"> * @method appendChild</span>
69 <span class="c"> * @param {Boolean} deep Whether or not to do a deep clone</span>
70 <span class="c"> */</span>
71 <span class="nx">appendChild</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">child</span><span class="o">)</span> <span class="o">{</span>
72 <span class="nx">child</span> <span class="o">=</span> <span class="nx">child</span><span class="o">.</span><span class="nx">get</span> <span class="o">?</span> <span class="nx">child</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">)</span> <span class="o">:</span> <span class="nx">child</span><span class="o">;</span>
73 <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">).</span><span class="nx">appendChild</span><span class="o">(</span><span class="nx">child</span><span class="o">);</span>
74 <span class="o">},</span>
76 <span class="c">/**</span>
77 <span class="c"> * Wrapper for HTMLElement method.</span>
78 <span class="c"> * @method getElementsByTagName</span>
79 <span class="c"> * @param {String} tag The tagName to collect</span>
80 <span class="c"> */</span>
81 <span class="nx">getElementsByTagName</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">tag</span><span class="o">)</span> <span class="o">{</span>
82 <span class="k">return</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">).</span><span class="nx">getElementsByTagName</span><span class="o">(</span><span class="nx">tag</span><span class="o">);</span>
83 <span class="o">},</span>
85 <span class="c">/**</span>
86 <span class="c"> * Wrapper for HTMLElement method.</span>
87 <span class="c"> * @method hasChildNodes</span>
88 <span class="c"> * @return {Boolean} Whether or not the element has childNodes</span>
89 <span class="c"> */</span>
90 <span class="nx">hasChildNodes</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
91 <span class="k">return</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">).</span><span class="nx">hasChildNodes</span><span class="o">();</span>
92 <span class="o">},</span>
94 <span class="c">/**</span>
95 <span class="c"> * Wrapper for HTMLElement method.</span>
96 <span class="c"> * @method insertBefore</span>
97 <span class="c"> * @param {HTMLElement} element The HTMLElement to insert</span>
98 <span class="c"> * @param {HTMLElement} before The HTMLElement to insert</span>
99 <span class="c"> * the element before.</span>
100 <span class="c"> */</span>
101 <span class="nx">insertBefore</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">element</span><span class="o">,</span> <span class="nx">before</span><span class="o">)</span> <span class="o">{</span>
102 <span class="nx">element</span> <span class="o">=</span> <span class="nx">element</span><span class="o">.</span><span class="nx">get</span> <span class="o">?</span> <span class="nx">element</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">)</span> <span class="o">:</span> <span class="nx">element</span><span class="o">;</span>
103 <span class="nx">before</span> <span class="o">=</span> <span class="o">(</span><span class="nx">before</span> <span class="o">&amp;&amp;</span> <span class="nx">before</span><span class="o">.</span><span class="nx">get</span><span class="o">)</span> <span class="o">?</span> <span class="nx">before</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">)</span> <span class="o">:</span> <span class="nx">before</span><span class="o">;</span>
105 <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">).</span><span class="nx">insertBefore</span><span class="o">(</span><span class="nx">element</span><span class="o">,</span> <span class="nx">before</span><span class="o">);</span>
106 <span class="o">},</span>
108 <span class="c">/**</span>
109 <span class="c"> * Wrapper for HTMLElement method.</span>
110 <span class="c"> * @method removeChild</span>
111 <span class="c"> * @param {HTMLElement} child The HTMLElement to remove</span>
112 <span class="c"> */</span>
113 <span class="nx">removeChild</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">child</span><span class="o">)</span> <span class="o">{</span>
114 <span class="nx">child</span> <span class="o">=</span> <span class="nx">child</span><span class="o">.</span><span class="nx">get</span> <span class="o">?</span> <span class="nx">child</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">)</span> <span class="o">:</span> <span class="nx">child</span><span class="o">;</span>
115 <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">).</span><span class="nx">removeChild</span><span class="o">(</span><span class="nx">child</span><span class="o">);</span>
116 <span class="k">return</span> <span class="kc">true</span><span class="o">;</span>
117 <span class="o">},</span>
119 <span class="c">/**</span>
120 <span class="c"> * Wrapper for HTMLElement method.</span>
121 <span class="c"> * @method replaceChild</span>
122 <span class="c"> * @param {HTMLElement} newNode The HTMLElement to insert</span>
123 <span class="c"> * @param {HTMLElement} oldNode The HTMLElement to replace</span>
124 <span class="c"> */</span>
125 <span class="nx">replaceChild</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">newNode</span><span class="o">,</span> <span class="nx">oldNode</span><span class="o">)</span> <span class="o">{</span>
126 <span class="nx">newNode</span> <span class="o">=</span> <span class="nx">newNode</span><span class="o">.</span><span class="nx">get</span> <span class="o">?</span> <span class="nx">newNode</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">)</span> <span class="o">:</span> <span class="nx">newNode</span><span class="o">;</span>
127 <span class="nx">oldNode</span> <span class="o">=</span> <span class="nx">oldNode</span><span class="o">.</span><span class="nx">get</span> <span class="o">?</span> <span class="nx">oldNode</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">)</span> <span class="o">:</span> <span class="nx">oldNode</span><span class="o">;</span>
128 <span class="k">return</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">).</span><span class="nx">replaceChild</span><span class="o">(</span><span class="nx">newNode</span><span class="o">,</span> <span class="nx">oldNode</span><span class="o">);</span>
129 <span class="o">},</span>
132 <span class="c">/**</span>
133 <span class="c"> * Registers Element specific attributes.</span>
134 <span class="c"> * @method initAttributes</span>
135 <span class="c"> * @param {Object} map A key-value map of initial attribute configs</span>
136 <span class="c"> */</span>
137 <span class="nx">initAttributes</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">map</span><span class="o">)</span> <span class="o">{</span>
138 <span class="nx">map</span> <span class="o">=</span> <span class="nx">map</span> <span class="o">||</span> <span class="o">{};</span>
139 <span class="k">var</span> <span class="nx">element</span> <span class="o">=</span> <span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">map</span><span class="o">.</span><span class="nx">element</span><span class="o">)</span> <span class="o">||</span> <span class="kc">null</span><span class="o">;</span>
141 <span class="c">/**</span>
142 <span class="c"> * The HTMLElement the Element instance refers to.</span>
143 <span class="c"> * @config element</span>
144 <span class="c"> * @type HTMLElement</span>
145 <span class="c"> */</span>
146 <span class="k">this</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">,</span> <span class="o">{</span>
147 <span class="nx">value</span><span class="o">:</span> <span class="nx">element</span><span class="o">,</span>
148 <span class="nx">readOnly</span><span class="o">:</span> <span class="kc">true</span>
149 <span class="o">});</span>
150 <span class="o">},</span>
152 <span class="c">/**</span>
153 <span class="c"> * Adds a listener for the given event. These may be DOM or </span>
154 <span class="c"> * customEvent listeners. Any event that is fired via fireEvent</span>
155 <span class="c"> * can be listened for. All handlers receive an event object. </span>
156 <span class="c"> * @method addListener</span>
157 <span class="c"> * @param {String} type The name of the event to listen for</span>
158 <span class="c"> * @param {Function} fn The handler to call when the event fires</span>
159 <span class="c"> * @param {Any} obj A variable to pass to the handler</span>
160 <span class="c"> * @param {Object} scope The object to use for the scope of the handler </span>
161 <span class="c"> */</span>
162 <span class="nx">addListener</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">type</span><span class="o">,</span> <span class="nx">fn</span><span class="o">,</span> <span class="nx">obj</span><span class="o">,</span> <span class="nx">scope</span><span class="o">)</span> <span class="o">{</span>
163 <span class="k">var</span> <span class="nx">el</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">);</span>
164 <span class="k">var</span> <span class="nx">scope</span> <span class="o">=</span> <span class="nx">scope</span> <span class="o">||</span> <span class="k">this</span><span class="o">;</span>
166 <span class="nx">el</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;id&#39;</span><span class="o">)</span> <span class="o">||</span> <span class="nx">el</span><span class="o">;</span>
168 <span class="k">if</span> <span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">_events</span><span class="o">[</span><span class="nx">type</span><span class="o">])</span> <span class="o">{</span> <span class="c">// create on the fly</span>
169 <span class="c"></span> <span class="k">if</span> <span class="o">(</span> <span class="k">this</span><span class="o">.</span><span class="nx">DOM_EVENTS</span><span class="o">[</span><span class="nx">type</span><span class="o">]</span> <span class="o">)</span> <span class="o">{</span>
170 <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Event</span><span class="o">.</span><span class="nx">addListener</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">type</span><span class="o">,</span> <span class="k">function</span><span class="o">(</span><span class="nx">e</span><span class="o">)</span> <span class="o">{</span>
171 <span class="k">if</span> <span class="o">(</span><span class="nx">e</span><span class="o">.</span><span class="nx">srcElement</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">e</span><span class="o">.</span><span class="nx">target</span><span class="o">)</span> <span class="o">{</span> <span class="c">// supplement IE with target</span>
172 <span class="c"></span> <span class="nx">e</span><span class="o">.</span><span class="nx">target</span> <span class="o">=</span> <span class="nx">e</span><span class="o">.</span><span class="nx">srcElement</span><span class="o">;</span>
173 <span class="o">}</span>
174 <span class="k">this</span><span class="o">.</span><span class="nx">fireEvent</span><span class="o">(</span><span class="nx">type</span><span class="o">,</span> <span class="nx">e</span><span class="o">);</span>
175 <span class="o">},</span> <span class="nx">obj</span><span class="o">,</span> <span class="nx">scope</span><span class="o">);</span>
176 <span class="o">}</span>
178 <span class="k">this</span><span class="o">.</span><span class="nx">createEvent</span><span class="o">(</span><span class="nx">type</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
179 <span class="k">this</span><span class="o">.</span><span class="nx">_events</span><span class="o">[</span><span class="nx">type</span><span class="o">]</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
180 <span class="o">}</span>
182 <span class="k">this</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">.</span><span class="nx">apply</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">arguments</span><span class="o">);</span> <span class="c">// notify via customEvent</span>
183 <span class="c"></span> <span class="o">},</span>
186 <span class="c">/**</span>
187 <span class="c"> * Alias for addListener</span>
188 <span class="c"> * @method on</span>
189 <span class="c"> * @param {String} type The name of the event to listen for</span>
190 <span class="c"> * @param {Function} fn The function call when the event fires</span>
191 <span class="c"> * @param {Any} obj A variable to pass to the handler</span>
192 <span class="c"> * @param {Object} scope The object to use for the scope of the handler </span>
193 <span class="c"> */</span>
194 <span class="nx">on</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span> <span class="k">this</span><span class="o">.</span><span class="nx">addListener</span><span class="o">.</span><span class="nx">apply</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">arguments</span><span class="o">);</span> <span class="o">},</span>
197 <span class="c">/**</span>
198 <span class="c"> * Remove an event listener</span>
199 <span class="c"> * @method removeListener</span>
200 <span class="c"> * @param {String} type The name of the event to listen for</span>
201 <span class="c"> * @param {Function} fn The function call when the event fires</span>
202 <span class="c"> */</span>
203 <span class="nx">removeListener</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">type</span><span class="o">,</span> <span class="nx">fn</span><span class="o">)</span> <span class="o">{</span>
204 <span class="k">this</span><span class="o">.</span><span class="nx">unsubscribe</span><span class="o">.</span><span class="nx">apply</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">arguments</span><span class="o">);</span>
205 <span class="o">},</span>
207 <span class="c">/**</span>
208 <span class="c"> * Wrapper for Dom method.</span>
209 <span class="c"> * @method addClass</span>
210 <span class="c"> * @param {String} className The className to add</span>
211 <span class="c"> */</span>
212 <span class="nx">addClass</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">className</span><span class="o">)</span> <span class="o">{</span>
213 <span class="nx">Dom</span><span class="o">.</span><span class="nx">addClass</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">),</span> <span class="nx">className</span><span class="o">);</span>
214 <span class="o">},</span>
216 <span class="c">/**</span>
217 <span class="c"> * Wrapper for Dom method.</span>
218 <span class="c"> * @method getElementsByClassName</span>
219 <span class="c"> * @param {String} className The className to collect</span>
220 <span class="c"> * @param {String} tag (optional) The tag to use in</span>
221 <span class="c"> * conjunction with class name</span>
222 <span class="c"> * @return {Array} Array of HTMLElements</span>
223 <span class="c"> */</span>
224 <span class="nx">getElementsByClassName</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">className</span><span class="o">,</span> <span class="nx">tag</span><span class="o">)</span> <span class="o">{</span>
225 <span class="k">return</span> <span class="nx">Dom</span><span class="o">.</span><span class="nx">getElementsByClassName</span><span class="o">(</span><span class="nx">className</span><span class="o">,</span> <span class="nx">tag</span><span class="o">,</span>
226 <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">)</span> <span class="o">);</span>
227 <span class="o">},</span>
229 <span class="c">/**</span>
230 <span class="c"> * Wrapper for Dom method.</span>
231 <span class="c"> * @method hasClass</span>
232 <span class="c"> * @param {String} className The className to add</span>
233 <span class="c"> * @return {Boolean} Whether or not the element has the class name</span>
234 <span class="c"> */</span>
235 <span class="nx">hasClass</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">className</span><span class="o">)</span> <span class="o">{</span>
236 <span class="k">return</span> <span class="nx">Dom</span><span class="o">.</span><span class="nx">hasClass</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">),</span> <span class="nx">className</span><span class="o">);</span>
237 <span class="o">},</span>
239 <span class="c">/**</span>
240 <span class="c"> * Wrapper for Dom method.</span>
241 <span class="c"> * @method removeClass</span>
242 <span class="c"> * @param {String} className The className to remove</span>
243 <span class="c"> */</span>
244 <span class="nx">removeClass</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">className</span><span class="o">)</span> <span class="o">{</span>
245 <span class="k">return</span> <span class="nx">Dom</span><span class="o">.</span><span class="nx">removeClass</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">),</span> <span class="nx">className</span><span class="o">);</span>
246 <span class="o">},</span>
248 <span class="c">/**</span>
249 <span class="c"> * Wrapper for Dom method.</span>
250 <span class="c"> * @method replaceClass</span>
251 <span class="c"> * @param {String} oldClassName The className to replace</span>
252 <span class="c"> * @param {String} newClassName The className to add</span>
253 <span class="c"> */</span>
254 <span class="nx">replaceClass</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">oldClassName</span><span class="o">,</span> <span class="nx">newClassName</span><span class="o">)</span> <span class="o">{</span>
255 <span class="k">return</span> <span class="nx">Dom</span><span class="o">.</span><span class="nx">replaceClass</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">),</span>
256 <span class="nx">oldClassName</span><span class="o">,</span> <span class="nx">newClassName</span><span class="o">);</span>
257 <span class="o">},</span>
259 <span class="c">/**</span>
260 <span class="c"> * Wrapper for Dom method.</span>
261 <span class="c"> * @method setStyle</span>
262 <span class="c"> * @param {String} property The style property to set</span>
263 <span class="c"> * @param {String} value The value to apply to the style property</span>
264 <span class="c"> */</span>
265 <span class="nx">setStyle</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">property</span><span class="o">,</span> <span class="nx">value</span><span class="o">)</span> <span class="o">{</span>
266 <span class="k">var</span> <span class="nx">el</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">);</span>
267 <span class="k">if</span> <span class="o">(!</span><span class="nx">el</span><span class="o">)</span> <span class="o">{</span>
268 <span class="k">this</span><span class="o">.</span><span class="nx">_queue</span><span class="o">[</span><span class="k">this</span><span class="o">.</span><span class="nx">_queue</span><span class="o">.</span><span class="nx">length</span><span class="o">]</span> <span class="o">=</span> <span class="o">[</span><span class="s1">&#39;setStyle&#39;</span><span class="o">,</span> <span class="nx">arguments</span><span class="o">];</span>
269 <span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
270 <span class="o">}</span>
271 <span class="k">return</span> <span class="nx">Dom</span><span class="o">.</span><span class="nx">setStyle</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">),</span> <span class="nx">property</span><span class="o">,</span> <span class="nx">value</span><span class="o">);</span>
272 <span class="o">},</span>
274 <span class="c">/**</span>
275 <span class="c"> * Wrapper for Dom method.</span>
276 <span class="c"> * @method getStyle</span>
277 <span class="c"> * @param {String} property The style property to retrieve</span>
278 <span class="c"> * @return {String} The current value of the property</span>
279 <span class="c"> */</span>
280 <span class="nx">getStyle</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">property</span><span class="o">)</span> <span class="o">{</span>
281 <span class="k">return</span> <span class="nx">Dom</span><span class="o">.</span><span class="nx">getStyle</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">),</span> <span class="nx">property</span><span class="o">);</span>
282 <span class="o">},</span>
284 <span class="c">/**</span>
285 <span class="c"> * Apply any queued set calls.</span>
286 <span class="c"> * @method fireQueue</span>
287 <span class="c"> */</span>
288 <span class="nx">fireQueue</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
289 <span class="k">var</span> <span class="nx">queue</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_queue</span><span class="o">;</span>
290 <span class="k">for</span> <span class="o">(</span><span class="k">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="m">0</span><span class="o">,</span> <span class="nx">len</span> <span class="o">=</span> <span class="nx">queue</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">len</span><span class="o">;</span> <span class="o">++</span><span class="nx">i</span><span class="o">)</span> <span class="o">{</span>
291 <span class="k">this</span><span class="o">[</span><span class="nx">queue</span><span class="o">[</span><span class="nx">i</span><span class="o">][</span><span class="m">0</span><span class="o">]].</span><span class="nx">apply</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">queue</span><span class="o">[</span><span class="nx">i</span><span class="o">][</span><span class="m">1</span><span class="o">]);</span>
292 <span class="o">}</span>
293 <span class="o">},</span>
295 <span class="c">/**</span>
296 <span class="c"> * Appends the HTMLElement into either the supplied parentNode.</span>
297 <span class="c"> * @method appendTo</span>
298 <span class="c"> * @param {HTMLElement | Element} parentNode The node to append to</span>
299 <span class="c"> * @param {HTMLElement | Element} before An optional node to insert before</span>
300 <span class="c"> */</span>
301 <span class="nx">appendTo</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">parent</span><span class="o">,</span> <span class="nx">before</span><span class="o">)</span> <span class="o">{</span>
302 <span class="nx">parent</span> <span class="o">=</span> <span class="o">(</span><span class="nx">parent</span><span class="o">.</span><span class="nx">get</span><span class="o">)</span> <span class="o">?</span> <span class="nx">parent</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">)</span> <span class="o">:</span> <span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">parent</span><span class="o">);</span>
304 <span class="k">this</span><span class="o">.</span><span class="nx">fireEvent</span><span class="o">(</span><span class="s1">&#39;beforeAppendTo&#39;</span><span class="o">,</span> <span class="o">{</span>
305 <span class="nx">type</span><span class="o">:</span> <span class="s1">&#39;beforeAppendTo&#39;</span><span class="o">,</span>
306 <span class="nx">target</span><span class="o">:</span> <span class="nx">parent</span>
307 <span class="o">});</span>
310 <span class="nx">before</span> <span class="o">=</span> <span class="o">(</span><span class="nx">before</span> <span class="o">&amp;&amp;</span> <span class="nx">before</span><span class="o">.</span><span class="nx">get</span><span class="o">)</span> <span class="o">?</span>
311 <span class="nx">before</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">)</span> <span class="o">:</span> <span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">before</span><span class="o">);</span>
312 <span class="k">var</span> <span class="nx">element</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">);</span>
314 <span class="k">if</span> <span class="o">(!</span><span class="nx">element</span><span class="o">)</span> <span class="o">{</span>
315 <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;appendTo failed: element not available&#39;</span><span class="o">,</span>
316 <span class="s1">&#39;error&#39;</span><span class="o">,</span> <span class="s1">&#39;Element&#39;</span><span class="o">);</span>
317 <span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
318 <span class="o">}</span>
320 <span class="k">if</span> <span class="o">(!</span><span class="nx">parent</span><span class="o">)</span> <span class="o">{</span>
321 <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;appendTo failed: parent not available&#39;</span><span class="o">,</span>
322 <span class="s1">&#39;error&#39;</span><span class="o">,</span> <span class="s1">&#39;Element&#39;</span><span class="o">);</span>
323 <span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
324 <span class="o">}</span>
326 <span class="k">if</span> <span class="o">(</span><span class="nx">element</span><span class="o">.</span><span class="nx">parent</span> <span class="o">!=</span> <span class="nx">parent</span><span class="o">)</span> <span class="o">{</span>
327 <span class="k">if</span> <span class="o">(</span><span class="nx">before</span><span class="o">)</span> <span class="o">{</span>
328 <span class="nx">parent</span><span class="o">.</span><span class="nx">insertBefore</span><span class="o">(</span><span class="nx">element</span><span class="o">,</span> <span class="nx">before</span><span class="o">);</span>
329 <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
330 <span class="nx">parent</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nx">element</span><span class="o">);</span>
331 <span class="o">}</span>
332 <span class="o">}</span>
334 <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="nx">element</span> <span class="o">+</span> <span class="s1">&#39;appended to &#39;</span> <span class="o">+</span> <span class="nx">parent</span><span class="o">);</span>
336 <span class="k">this</span><span class="o">.</span><span class="nx">fireEvent</span><span class="o">(</span><span class="s1">&#39;appendTo&#39;</span><span class="o">,</span> <span class="o">{</span>
337 <span class="nx">type</span><span class="o">:</span> <span class="s1">&#39;appendTo&#39;</span><span class="o">,</span>
338 <span class="nx">target</span><span class="o">:</span> <span class="nx">parent</span>
339 <span class="o">});</span>
340 <span class="o">},</span>
342 <span class="nx">get</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">key</span><span class="o">)</span> <span class="o">{</span>
343 <span class="k">var</span> <span class="nx">configs</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_configs</span> <span class="o">||</span> <span class="o">{};</span>
344 <span class="k">var</span> <span class="nx">el</span> <span class="o">=</span> <span class="nx">configs</span><span class="o">.</span><span class="nx">element</span><span class="o">;</span> <span class="c">// avoid loop due to &#39;element&#39;</span>
345 <span class="c"></span> <span class="k">if</span> <span class="o">(</span><span class="nx">el</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">configs</span><span class="o">[</span><span class="nx">key</span><span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">lang</span><span class="o">.</span><span class="nx">isUndefined</span><span class="o">(</span><span class="nx">el</span><span class="o">.</span><span class="nx">value</span><span class="o">[</span><span class="nx">key</span><span class="o">])</span> <span class="o">)</span> <span class="o">{</span>
346 <span class="k">return</span> <span class="nx">el</span><span class="o">.</span><span class="nx">value</span><span class="o">[</span><span class="nx">key</span><span class="o">];</span>
347 <span class="o">}</span>
349 <span class="k">return</span> <span class="nx">AttributeProvider</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">get</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">key</span><span class="o">);</span>
350 <span class="o">},</span>
352 <span class="nx">set</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">key</span><span class="o">,</span> <span class="nx">value</span><span class="o">,</span> <span class="nx">silent</span><span class="o">)</span> <span class="o">{</span>
353 <span class="k">var</span> <span class="nx">el</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">);</span>
354 <span class="k">if</span> <span class="o">(!</span><span class="nx">el</span><span class="o">)</span> <span class="o">{</span>
355 <span class="k">this</span><span class="o">.</span><span class="nx">_queue</span><span class="o">[</span><span class="k">this</span><span class="o">.</span><span class="nx">_queue</span><span class="o">.</span><span class="nx">length</span><span class="o">]</span> <span class="o">=</span> <span class="o">[</span><span class="s1">&#39;set&#39;</span><span class="o">,</span> <span class="nx">arguments</span><span class="o">];</span>
356 <span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_configs</span><span class="o">[</span><span class="nx">key</span><span class="o">])</span> <span class="o">{</span>
357 <span class="k">this</span><span class="o">.</span><span class="nx">_configs</span><span class="o">[</span><span class="nx">key</span><span class="o">].</span><span class="nx">value</span> <span class="o">=</span> <span class="nx">value</span><span class="o">;</span> <span class="c">// so &quot;get&quot; works while queueing</span>
358 <span class="c"></span>
359 <span class="o">}</span>
360 <span class="k">return</span><span class="o">;</span>
361 <span class="o">}</span>
363 <span class="c">// set it on the element if not configured and is an HTML attribute</span>
364 <span class="c"></span> <span class="k">if</span> <span class="o">(</span> <span class="o">!</span><span class="k">this</span><span class="o">.</span><span class="nx">_configs</span><span class="o">[</span><span class="nx">key</span><span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">lang</span><span class="o">.</span><span class="nx">isUndefined</span><span class="o">(</span><span class="nx">el</span><span class="o">[</span><span class="nx">key</span><span class="o">])</span> <span class="o">)</span> <span class="o">{</span>
365 <span class="nx">_registerHTMLAttr</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">key</span><span class="o">);</span>
366 <span class="o">}</span>
368 <span class="k">return</span> <span class="nx">AttributeProvider</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">set</span><span class="o">.</span><span class="nx">apply</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">arguments</span><span class="o">);</span>
369 <span class="o">},</span>
371 <span class="nx">setAttributeConfig</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">key</span><span class="o">,</span> <span class="nx">map</span><span class="o">,</span> <span class="nx">init</span><span class="o">)</span> <span class="o">{</span>
372 <span class="k">var</span> <span class="nx">el</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">);</span>
374 <span class="k">if</span> <span class="o">(</span><span class="nx">el</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="k">this</span><span class="o">.</span><span class="nx">_configs</span><span class="o">[</span><span class="nx">key</span><span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">lang</span><span class="o">.</span><span class="nx">isUndefined</span><span class="o">(</span><span class="nx">el</span><span class="o">[</span><span class="nx">key</span><span class="o">])</span> <span class="o">)</span> <span class="o">{</span>
375 <span class="nx">_registerHTMLAttr</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">key</span><span class="o">,</span> <span class="nx">map</span><span class="o">);</span>
376 <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
377 <span class="nx">AttributeProvider</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">setAttributeConfig</span><span class="o">.</span><span class="nx">apply</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">arguments</span><span class="o">);</span>
378 <span class="o">}</span>
379 <span class="o">},</span>
381 <span class="nx">getAttributeKeys</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
382 <span class="k">var</span> <span class="nx">el</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">);</span>
383 <span class="k">var</span> <span class="nx">keys</span> <span class="o">=</span> <span class="nx">AttributeProvider</span><span class="o">.</span><span class="nx">prototype</span><span class="o">.</span><span class="nx">getAttributeKeys</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">);</span>
385 <span class="c">//add any unconfigured element keys</span>
386 <span class="c"></span> <span class="k">for</span> <span class="o">(</span><span class="k">var</span> <span class="nx">key</span> <span class="k">in</span> <span class="nx">el</span><span class="o">)</span> <span class="o">{</span>
387 <span class="k">if</span> <span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">_configs</span><span class="o">[</span><span class="nx">key</span><span class="o">])</span> <span class="o">{</span>
388 <span class="nx">keys</span><span class="o">[</span><span class="nx">key</span><span class="o">]</span> <span class="o">=</span> <span class="nx">keys</span><span class="o">[</span><span class="nx">key</span><span class="o">]</span> <span class="o">||</span> <span class="nx">el</span><span class="o">[</span><span class="nx">key</span><span class="o">];</span>
389 <span class="o">}</span>
390 <span class="o">}</span>
392 <span class="k">return</span> <span class="nx">keys</span><span class="o">;</span>
393 <span class="o">},</span>
395 <span class="nx">init</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="nx">attr</span><span class="o">)</span> <span class="o">{</span>
396 <span class="k">this</span><span class="o">.</span><span class="nx">_queue</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_queue</span> <span class="o">||</span> <span class="o">[];</span>
397 <span class="k">this</span><span class="o">.</span><span class="nx">_events</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_events</span> <span class="o">||</span> <span class="o">{};</span>
398 <span class="k">this</span><span class="o">.</span><span class="nx">_configs</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_configs</span> <span class="o">||</span> <span class="o">{};</span>
399 <span class="nx">attr</span> <span class="o">=</span> <span class="nx">attr</span> <span class="o">||</span> <span class="o">{};</span>
400 <span class="nx">attr</span><span class="o">.</span><span class="nx">element</span> <span class="o">=</span> <span class="nx">attr</span><span class="o">.</span><span class="nx">element</span> <span class="o">||</span> <span class="nx">el</span> <span class="o">||</span> <span class="kc">null</span><span class="o">;</span>
402 <span class="k">this</span><span class="o">.</span><span class="nx">DOM_EVENTS</span> <span class="o">=</span> <span class="o">{</span>
403 <span class="s1">&#39;click&#39;</span><span class="o">:</span> <span class="kc">true</span><span class="o">,</span>
404 <span class="s1">&#39;keydown&#39;</span><span class="o">:</span> <span class="kc">true</span><span class="o">,</span>
405 <span class="s1">&#39;keypress&#39;</span><span class="o">:</span> <span class="kc">true</span><span class="o">,</span>
406 <span class="s1">&#39;keyup&#39;</span><span class="o">:</span> <span class="kc">true</span><span class="o">,</span>
407 <span class="s1">&#39;mousedown&#39;</span><span class="o">:</span> <span class="kc">true</span><span class="o">,</span>
408 <span class="s1">&#39;mousemove&#39;</span><span class="o">:</span> <span class="kc">true</span><span class="o">,</span>
409 <span class="s1">&#39;mouseout&#39;</span><span class="o">:</span> <span class="kc">true</span><span class="o">,</span>
410 <span class="s1">&#39;mouseover&#39;</span><span class="o">:</span> <span class="kc">true</span><span class="o">,</span>
411 <span class="s1">&#39;mouseup&#39;</span><span class="o">:</span> <span class="kc">true</span>
412 <span class="o">};</span>
414 <span class="k">var</span> <span class="nx">readyHandler</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
415 <span class="k">this</span><span class="o">.</span><span class="nx">initAttributes</span><span class="o">(</span><span class="nx">attr</span><span class="o">);</span>
416 <span class="k">this</span><span class="o">.</span><span class="nx">setAttributes</span><span class="o">(</span><span class="nx">attr</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
417 <span class="k">this</span><span class="o">.</span><span class="nx">fireQueue</span><span class="o">();</span>
418 <span class="k">this</span><span class="o">.</span><span class="nx">fireEvent</span><span class="o">(</span><span class="s1">&#39;contentReady&#39;</span><span class="o">,</span> <span class="o">{</span>
419 <span class="nx">type</span><span class="o">:</span> <span class="s1">&#39;contentReady&#39;</span><span class="o">,</span>
420 <span class="nx">target</span><span class="o">:</span> <span class="nx">attr</span><span class="o">.</span><span class="nx">element</span>
421 <span class="o">});</span>
422 <span class="o">};</span>
424 <span class="k">if</span> <span class="o">(</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">lang</span><span class="o">.</span><span class="nx">isString</span><span class="o">(</span><span class="nx">el</span><span class="o">)</span> <span class="o">)</span> <span class="o">{</span>
425 <span class="nx">_registerHTMLAttr</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">,</span> <span class="s1">&#39;id&#39;</span><span class="o">,</span> <span class="o">{</span> <span class="nx">value</span><span class="o">:</span> <span class="nx">el</span> <span class="o">});</span>
426 <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Event</span><span class="o">.</span><span class="nx">onAvailable</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
427 <span class="nx">attr</span><span class="o">.</span><span class="nx">element</span> <span class="o">=</span> <span class="nx">Dom</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="nx">el</span><span class="o">);</span>
428 <span class="k">this</span><span class="o">.</span><span class="nx">fireEvent</span><span class="o">(</span><span class="s1">&#39;available&#39;</span><span class="o">,</span> <span class="o">{</span>
429 <span class="nx">type</span><span class="o">:</span> <span class="s1">&#39;available&#39;</span><span class="o">,</span>
430 <span class="nx">target</span><span class="o">:</span> <span class="nx">attr</span><span class="o">.</span><span class="nx">element</span>
431 <span class="o">});</span>
432 <span class="o">},</span> <span class="k">this</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
434 <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Event</span><span class="o">.</span><span class="nx">onContentReady</span><span class="o">(</span><span class="nx">el</span><span class="o">,</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
435 <span class="nx">readyHandler</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">);</span>
436 <span class="o">},</span> <span class="k">this</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
437 <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
438 <span class="nx">readyHandler</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">);</span>
439 <span class="o">}</span>
440 <span class="o">}</span>
441 <span class="o">};</span>
443 <span class="c">/**</span>
444 <span class="c"> * Sets the value of the property and fires beforeChange and change events.</span>
445 <span class="c"> * @private</span>
446 <span class="c"> * @method _registerHTMLAttr</span>
447 <span class="c"> * @param {YAHOO.util.Element} element The Element instance to</span>
448 <span class="c"> * register the config to.</span>
449 <span class="c"> * @param {String} key The name of the config to register</span>
450 <span class="c"> * @param {Object} map A key-value map of the config&#39;s params</span>
451 <span class="c"> */</span>
452 <span class="k">var</span> <span class="nx">_registerHTMLAttr</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">key</span><span class="o">,</span> <span class="nx">map</span><span class="o">)</span> <span class="o">{</span>
453 <span class="k">var</span> <span class="nx">el</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s1">&#39;element&#39;</span><span class="o">);</span>
454 <span class="nx">map</span> <span class="o">=</span> <span class="nx">map</span> <span class="o">||</span> <span class="o">{};</span>
455 <span class="nx">map</span><span class="o">.</span><span class="nx">name</span> <span class="o">=</span> <span class="nx">key</span><span class="o">;</span>
456 <span class="nx">map</span><span class="o">.</span><span class="nx">method</span> <span class="o">=</span> <span class="nx">map</span><span class="o">.</span><span class="nx">method</span> <span class="o">||</span> <span class="k">function</span><span class="o">(</span><span class="nx">value</span><span class="o">)</span> <span class="o">{</span>
457 <span class="nx">el</span><span class="o">[</span><span class="nx">key</span><span class="o">]</span> <span class="o">=</span> <span class="nx">value</span><span class="o">;</span>
458 <span class="o">};</span>
459 <span class="nx">map</span><span class="o">.</span><span class="nx">value</span> <span class="o">=</span> <span class="nx">map</span><span class="o">.</span><span class="nx">value</span> <span class="o">||</span> <span class="nx">el</span><span class="o">[</span><span class="nx">key</span><span class="o">];</span>
460 <span class="k">this</span><span class="o">.</span><span class="nx">_configs</span><span class="o">[</span><span class="nx">key</span><span class="o">]</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Attribute</span><span class="o">(</span><span class="nx">map</span><span class="o">,</span> <span class="k">this</span><span class="o">);</span>
461 <span class="o">};</span>
463 <span class="c">/**</span>
464 <span class="c"> * Fires when the Element&#39;s HTMLElement can be retrieved by Id.</span>
465 <span class="c"> * &lt;p&gt;See: &lt;a href=&quot;#addListener&quot;&gt;Element.addListener&lt;/a&gt;&lt;/p&gt;</span>
466 <span class="c"> * &lt;p&gt;&lt;strong&gt;Event fields:&lt;/strong&gt;&lt;br&gt;</span>
467 <span class="c"> * &lt;code&gt;&amp;lt;String&amp;gt; type&lt;/code&gt; available&lt;br&gt;</span>
468 <span class="c"> * &lt;code&gt;&amp;lt;HTMLElement&amp;gt;</span>
469 <span class="c"> * target&lt;/code&gt; the HTMLElement bound to this Element instance&lt;br&gt;</span>
470 <span class="c"> * &lt;p&gt;&lt;strong&gt;Usage:&lt;/strong&gt;&lt;br&gt;</span>
471 <span class="c"> * &lt;code&gt;var handler = function(e) {var target = e.target};&lt;br&gt;</span>
472 <span class="c"> * myTabs.addListener(&#39;available&#39;, handler);&lt;/code&gt;&lt;/p&gt;</span>
473 <span class="c"> * @event available</span>
474 <span class="c"> */</span>
476 <span class="c">/**</span>
477 <span class="c"> * Fires when the Element&#39;s HTMLElement subtree is rendered.</span>
478 <span class="c"> * &lt;p&gt;See: &lt;a href=&quot;#addListener&quot;&gt;Element.addListener&lt;/a&gt;&lt;/p&gt;</span>
479 <span class="c"> * &lt;p&gt;&lt;strong&gt;Event fields:&lt;/strong&gt;&lt;br&gt;</span>
480 <span class="c"> * &lt;code&gt;&amp;lt;String&amp;gt; type&lt;/code&gt; contentReady&lt;br&gt;</span>
481 <span class="c"> * &lt;code&gt;&amp;lt;HTMLElement&amp;gt;</span>
482 <span class="c"> * target&lt;/code&gt; the HTMLElement bound to this Element instance&lt;br&gt;</span>
483 <span class="c"> * &lt;p&gt;&lt;strong&gt;Usage:&lt;/strong&gt;&lt;br&gt;</span>
484 <span class="c"> * &lt;code&gt;var handler = function(e) {var target = e.target};&lt;br&gt;</span>
485 <span class="c"> * myTabs.addListener(&#39;contentReady&#39;, handler);&lt;/code&gt;&lt;/p&gt;</span>
486 <span class="c"> * @event contentReady</span>
487 <span class="c"> */</span>
490 <span class="nx">YAHOO</span><span class="o">.</span><span class="nx">augment</span><span class="o">(</span><span class="nx">YAHOO</span><span class="o">.</span><span class="nx">util</span><span class="o">.</span><span class="nx">Element</span><span class="o">,</span> <span class="nx">AttributeProvider</span><span class="o">);</span>
491 <span class="o">})();</span>
492 </pre></div>
493 </div>
494 </div>
495 </div>
496 <div class="yui-b">
497 <div class="nav">
499 <div class="module">
500 <h4>Modules</h4>
501 <ul class="content">
503 <li class=""><a href="module_animation.html">animation</a></li>
505 <li class=""><a href="module_autocomplete.html">autocomplete</a></li>
507 <li class=""><a href="module_button.html">button</a></li>
509 <li class=""><a href="module_calendar.html">calendar</a></li>
511 <li class=""><a href="module_connection.html">connection</a></li>
513 <li class=""><a href="module_container.html">container</a></li>
515 <li class=""><a href="module_datasource.html">datasource</a></li>
517 <li class=""><a href="module_datatable.html">datatable</a></li>
519 <li class=""><a href="module_dom.html">dom</a></li>
521 <li class=""><a href="module_dragdrop.html">dragdrop</a></li>
523 <li class="selected"><a href="module_element.html">element</a></li>
525 <li class=""><a href="module_event.html">event</a></li>
527 <li class=""><a href="module_history.html">history</a></li>
529 <li class=""><a href="module_logger.html">logger</a></li>
531 <li class=""><a href="module_menu.html">menu</a></li>
533 <li class=""><a href="module_slider.html">slider</a></li>
535 <li class=""><a href="module_tabview.html">tabview</a></li>
537 <li class=""><a href="module_treeview.html">treeview</a></li>
539 <li class=""><a href="module_yahoo.html">yahoo</a></li>
540 </ul>
541 </div>
543 <div class="module">
544 <h4>Classes</h4>
545 <ul class="content">
546 <li class=""><a href="YAHOO.util.Attribute.html">YAHOO.util.Attribute</a></li>
547 <li class=""><a href="YAHOO.util.AttributeProvider.html">YAHOO.util.AttributeProvider</a></li>
548 <li class=""><a href="YAHOO.util.Element.html">YAHOO.util.Element</a></li>
549 </ul>
550 </div>
552 <div class="module">
553 <h4>Files</h4>
554 <ul class="content">
555 <li class=""><a href="Attribute.js.html">Attribute.js</a></li>
556 <li class=""><a href="AttributeProvider.js.html">AttributeProvider.js</a></li>
557 <li class="selected"><a href="Element.js.html">Element.js</a></li>
558 </ul>
559 </div>
565 </div>
566 </div>
567 </div>
568 <div id="ft">
569 <hr />
570 Copyright &copy; 2007 Yahoo! Inc. All rights reserved.
571 </div>
572 </div>
573 </body>
574 </html>