source: cows/branches/cows-vis/cows/pylons/project_templates/cows_server/+package+/public/js/yui/api/loader.js.html @ 5259

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cows/branches/cows-vis/cows/pylons/project_templates/cows_server/+package+/public/js/yui/api/loader.js.html@5259
Revision 5259, 166.3 KB checked in by domlowe, 11 years ago (diff)

adding yui javascript

Line 
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: yui   loader.js  (YUI Library)</title>
5        <link rel="stylesheet" type="text/css" href="assets/api.css">
6    <script type="text/javascript" src="assets/api-js"></script>
7    <script type="text/javascript" src="assets/ac-js"></script>
8</head>
9
10<body id="yahoo-com">
11
12<div id="doc3" class="yui-t2">
13
14        <div id="hd">
15        <a href="http://developer.yahoo.com/yui/"><h1>Yahoo! UI Library</h1></a>
16        <h3>yui&nbsp; <span class="subtitle">3.0.0pr1</span></h3>
17        <p>
18        <a href="./index.html">Yahoo! UI Library</a> 
19            &gt; <a href="./module_yui.html">yui</a>
20               
21                 &gt; loader.js (source view)
22            </p>
23
24
25        </div>
26
27        <div id="bd">
28                <div id="yui-main">
29                        <div class="yui-b">
30            <form name="yui-classopts-form">
31    <span id="classopts"><input type="checkbox" name="showprivate" id="showprivate" /> <label for="showprivate">Show Private</label></span>
32    <span id="classopts"><input type="checkbox" name="showprotected" id="showprotected" /> <label for="showprotected">Show Protected</label></span>
33    <span id="classopts"><input type="checkbox" name="showdeprecated" id="showdeprecated" /> <label for="showdeprecated">Show Deprecated</label></span>
34            </form>
35
36                    <div id="srcout">
37                        <style>
38                            #doc3 #classopts { display:none; }
39                        </style>
40<div class="highlight" ><pre><span class="c">/**</span>
41<span class="c"> * Loader dynamically loads script and css files.  It includes the dependency</span>
42<span class="c"> * info for the version of the library in use, and will automatically pull in</span>
43<span class="c"> * dependencies for the modules requested.  It supports rollup files and will</span>
44<span class="c"> * automatically use these when appropriate in order to minimize the number of</span>
45<span class="c"> * http connections required to load all of the dependencies.  It can load the</span>
46<span class="c"> * files from the Yahoo! CDN, and it can utilize the combo service provided on</span>
47<span class="c"> * this network to reduce the number of http connections required to download </span>
48<span class="c"> * YUI files.</span>
49<span class="c"> *</span>
50<span class="c"> * @module yui</span>
51<span class="c"> * @submodule loader</span>
52<span class="c"> */</span>
53
54<span class="c">/**</span>
55<span class="c"> * Loader dynamically loads script and css files.  It includes the dependency</span>
56<span class="c"> * info for the version of the library in use, and will automatically pull in</span>
57<span class="c"> * dependencies for the modules requested.  It supports rollup files and will</span>
58<span class="c"> * automatically use these when appropriate in order to minimize the number of</span>
59<span class="c"> * http connections required to load all of the dependencies.  It can load the</span>
60<span class="c"> * files from the Yahoo! CDN, and it can utilize the combo service provided on</span>
61<span class="c"> * this network to reduce the number of http connections required to download </span>
62<span class="c"> * YUI files.</span>
63<span class="c"> * @class Loader</span>
64<span class="c"> * @constructor</span>
65<span class="c"> * @param o an optional set of configuration options.  Valid options:</span>
66<span class="c"> * &lt;ul&gt;</span>
67<span class="c"> *  &lt;li&gt;base:</span>
68<span class="c"> *  The base dir&lt;/li&gt;</span>
69<span class="c"> *  &lt;li&gt;secureBase:</span>
70<span class="c"> *  The secure base dir (not implemented)&lt;/li&gt;</span>
71<span class="c"> *  &lt;li&gt;comboBase:</span>
72<span class="c"> *  The YUI combo service base dir. Ex: http://yui.yahooapis.com/combo?&lt;/li&gt;</span>
73<span class="c"> *  &lt;li&gt;root:</span>
74<span class="c"> *  The root path to prepend to module names for the combo service. Ex: 2.5.2/build/&lt;/li&gt;</span>
75<span class="c"> *  &lt;li&gt;filter:</span>
76<span class="c"> *  </span>
77<span class="c"> * A filter to apply to result urls.  This filter will modify the default</span>
78<span class="c"> * path for all modules.  The default path for the YUI library is the</span>
79<span class="c"> * minified version of the files (e.g., event-min.js).  The filter property</span>
80<span class="c"> * can be a predefined filter or a custom filter.  The valid predefined </span>
81<span class="c"> * filters are:</span>
82<span class="c"> * &lt;dl&gt;</span>
83<span class="c"> *  &lt;dt&gt;DEBUG&lt;/dt&gt;</span>
84<span class="c"> *  &lt;dd&gt;Selects the debug versions of the library (e.g., event-debug.js).</span>
85<span class="c"> *      This option will automatically include the logger widget&lt;/dd&gt;</span>
86<span class="c"> *  &lt;dt&gt;RAW&lt;/dt&gt;</span>
87<span class="c"> *  &lt;dd&gt;Selects the non-minified version of the library (e.g., event.js).&lt;/dd&gt;</span>
88<span class="c"> * &lt;/dl&gt;</span>
89<span class="c"> * You can also define a custom filter, which must be an object literal </span>
90<span class="c"> * containing a search expression and a replace string:</span>
91<span class="c"> * &lt;pre&gt;</span>
92<span class="c"> *  myFilter: &amp;#123; </span>
93<span class="c"> *      &#39;searchExp&#39;: &quot;-min\\.js&quot;, </span>
94<span class="c"> *      &#39;replaceStr&#39;: &quot;-debug.js&quot;</span>
95<span class="c"> *  &amp;#125;</span>
96<span class="c"> * &lt;/pre&gt;</span>
97<span class="c"> *</span>
98<span class="c"> *  &lt;/li&gt;</span>
99<span class="c"> *  &lt;li&gt;combine:</span>
100<span class="c"> *  Use the YUI combo service to reduce the number of http connections required to load your dependencies&lt;/li&gt;</span>
101<span class="c"> *  &lt;li&gt;ignore:</span>
102<span class="c"> *  A list of modules that should never be dynamically loaded&lt;/li&gt;</span>
103<span class="c"> *  &lt;li&gt;force:</span>
104<span class="c"> *  A list of modules that should always be loaded when required, even if already present on the page&lt;/li&gt;</span>
105<span class="c"> *  &lt;li&gt;insertBefore:</span>
106<span class="c"> *  Node or id for a node that should be used as the insertion point for new nodes&lt;/li&gt;</span>
107<span class="c"> *  &lt;li&gt;charset:</span>
108<span class="c"> *  charset for dynamic nodes&lt;/li&gt;</span>
109<span class="c"> *  &lt;li&gt;timeout:</span>
110<span class="c"> *  number of milliseconds before a timeout occurs when dynamically loading nodes.  in not set, there is no timeout&lt;/li&gt;</span>
111<span class="c"> *  &lt;li&gt;context:</span>
112<span class="c"> *  execution context for all callbacks&lt;/li&gt;</span>
113<span class="c"> *  &lt;li&gt;onSuccess:</span>
114<span class="c"> *  callback for the &#39;success&#39; event&lt;/li&gt;</span>
115<span class="c"> *  &lt;li&gt;onFailure:</span>
116<span class="c"> *  callback for the &#39;failure&#39; event&lt;/li&gt;</span>
117<span class="c"> *  &lt;li&gt;onTimeout:</span>
118<span class="c"> *  callback for the &#39;timeout&#39; event&lt;/li&gt;</span>
119<span class="c"> *  &lt;li&gt;onProgress:</span>
120<span class="c"> *  callback executed each time a script or css file is loaded&lt;/li&gt;</span>
121<span class="c"> *  &lt;li&gt;modules:</span>
122<span class="c"> *  A list of module definitions.  See Loader.addModule for the supported module metadata&lt;/li&gt;</span>
123<span class="c"> * &lt;/ul&gt;</span>
124<span class="c"> */</span>
125
126<span class="c">// @TODO backed out the custom event changes so that the event system</span>
127<span class="c">// isn&#39;t required in the seed build.  If needed, we may want to </span>
128<span class="c">// add them back if the event system is detected.</span>
129<span class="c"></span>
130<span class="c">/*</span>
131<span class="c"> * Executed when the loader successfully completes an insert operation</span>
132<span class="c"> * This can be subscribed to normally, or a listener can be passed</span>
133<span class="c"> * as an onSuccess config option.</span>
134<span class="c"> * @event success</span>
135<span class="c"> */</span>
136
137<span class="c">/*</span>
138<span class="c"> * Executed when the loader fails to complete an insert operation.</span>
139<span class="c"> * This can be subscribed to normally, or a listener can be passed</span>
140<span class="c"> * as an onFailure config option.</span>
141<span class="c"> *</span>
142<span class="c"> * @event failure</span>
143<span class="c"> */</span>
144
145<span class="c">/*</span>
146<span class="c"> * Executed when a Get operation times out.</span>
147<span class="c"> * This can be subscribed to normally, or a listener can be passed</span>
148<span class="c"> * as an onTimeout config option.</span>
149<span class="c"> *</span>
150<span class="c"> * @event timeout</span>
151<span class="c"> */</span>
152
153<span class="c">// http://yui.yahooapis.com/combo?2.5.2/build/yahoo/yahoo-min.js&amp;2.5.2/build/dom/dom-min.js&amp;2.5.2/build/event/event-min.js&amp;2.5.2/build/autocomplete/autocomplete-min.js&quot;</span>
154<span class="c"></span>
155<span class="nx">YUI</span><span class="o">.</span><span class="nx">add</span><span class="o">(</span><span class="s2">&quot;loader&quot;</span><span class="o">,</span> <span class="k">function</span><span class="o">(</span><span class="nx">Y</span><span class="o">)</span> <span class="o">{</span>
156
157<span class="k">var</span> <span class="nx">BASE</span> <span class="o">=</span> <span class="s1">&#39;base&#39;</span><span class="o">,</span> 
158    <span class="nx">CSS</span> <span class="o">=</span> <span class="s1">&#39;css&#39;</span><span class="o">,</span>
159    <span class="nx">JS</span> <span class="o">=</span> <span class="s1">&#39;js&#39;</span><span class="o">,</span>
160    <span class="nx">CSSRESET</span> <span class="o">=</span> <span class="s1">&#39;cssreset&#39;</span><span class="o">,</span>
161    <span class="nx">CSSFONTS</span> <span class="o">=</span> <span class="s1">&#39;cssfonts&#39;</span><span class="o">,</span>
162    <span class="nx">CSSGRIDS</span> <span class="o">=</span> <span class="s1">&#39;cssgrids&#39;</span><span class="o">,</span>
163    <span class="nx">CSSBASE</span> <span class="o">=</span> <span class="s1">&#39;cssbase&#39;</span><span class="o">,</span>
164    <span class="nx">CSS_AFTER</span> <span class="o">=</span> <span class="o">[</span><span class="nx">CSSRESET</span><span class="o">,</span> <span class="nx">CSSFONTS</span><span class="o">,</span> <span class="nx">CSSGRIDS</span><span class="o">,</span> <span class="s1">&#39;cssreset-context&#39;</span><span class="o">,</span> <span class="s1">&#39;cssfonts-context&#39;</span><span class="o">,</span> <span class="s1">&#39;cssgrids-context&#39;</span><span class="o">],</span>
165    <span class="nx">YUI_CSS</span> <span class="o">=</span> <span class="o">[</span><span class="s1">&#39;reset&#39;</span><span class="o">,</span> <span class="s1">&#39;fonts&#39;</span><span class="o">,</span> <span class="s1">&#39;grids&#39;</span><span class="o">,</span> <span class="s1">&#39;base&#39;</span><span class="o">],</span>
166    <span class="nx">VERSION</span> <span class="o">=</span> <span class="s1">&#39;@VERSION@&#39;</span><span class="o">,</span>
167    <span class="nx">ROOT</span> <span class="o">=</span> <span class="nx">VERSION</span> <span class="o">+</span> <span class="s1">&#39;/build/&#39;</span><span class="o">,</span>
168    <span class="nx">CONTEXT</span> <span class="o">=</span> <span class="s1">&#39;-context&#39;</span><span class="o">,</span>
169    <span class="nx">META</span> <span class="o">=</span> <span class="o">{</span>
170
171    <span class="nx">version</span><span class="o">:</span> <span class="nx">VERSION</span><span class="o">,</span>
172
173    <span class="nx">root</span><span class="o">:</span> <span class="nx">ROOT</span><span class="o">,</span>
174
175    <span class="nx">base</span><span class="o">:</span> <span class="s1">&#39;http://yui.yahooapis.com/&#39;</span> <span class="o">+</span> <span class="nx">ROOT</span><span class="o">,</span>
176
177    <span class="nx">comboBase</span><span class="o">:</span> <span class="s1">&#39;http://yui.yahooapis.com/combo?&#39;</span><span class="o">,</span>
178
179    <span class="nx">modules</span><span class="o">:</span> <span class="o">{</span>
180
181       <span class="nx">dom</span><span class="o">:</span> <span class="o">{</span>
182            <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;event&#39;</span><span class="o">],</span>
183            <span class="nx">submodules</span><span class="o">:</span> <span class="o">{</span>
184                <span class="s1">&#39;dom-base&#39;</span><span class="o">:</span> <span class="o">{</span>
185                    <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;event&#39;</span><span class="o">]</span>
186                <span class="o">},</span>
187                <span class="s1">&#39;dom-style&#39;</span><span class="o">:</span> <span class="o">{</span>
188                    <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;dom-base&#39;</span><span class="o">]</span>
189
190                <span class="o">},</span>
191                <span class="s1">&#39;dom-screen&#39;</span><span class="o">:</span> <span class="o">{</span>
192                    <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;dom-base&#39;</span><span class="o">,</span> <span class="s1">&#39;dom-style&#39;</span><span class="o">]</span>
193                <span class="o">},</span>
194                <span class="nx">selector</span><span class="o">:</span> <span class="o">{</span>
195                    <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;dom-base&#39;</span><span class="o">]</span>
196                <span class="o">}</span>
197            <span class="o">}</span>
198        <span class="o">},</span>
199
200        <span class="nx">node</span><span class="o">:</span> <span class="o">{</span>
201            <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;dom&#39;</span><span class="o">],</span>
202            <span class="nx">submodules</span><span class="o">:</span> <span class="o">{</span>
203                <span class="s1">&#39;node-base&#39;</span><span class="o">:</span> <span class="o">{</span>
204                    <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;dom-base&#39;</span><span class="o">,</span> <span class="s1">&#39;selector&#39;</span><span class="o">]</span>
205                <span class="o">},</span>
206                <span class="s1">&#39;node-style&#39;</span><span class="o">:</span> <span class="o">{</span>
207                    <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;dom-style&#39;</span><span class="o">,</span> <span class="s1">&#39;node-base&#39;</span><span class="o">]</span>
208                <span class="o">},</span>
209                <span class="s1">&#39;node-screen&#39;</span><span class="o">:</span> <span class="o">{</span>
210                    <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;dom-screen&#39;</span><span class="o">,</span> <span class="s1">&#39;node-base&#39;</span><span class="o">]</span>
211                <span class="o">}</span>
212            <span class="o">}</span>
213        <span class="o">},</span>
214
215        <span class="nx">anim</span><span class="o">:</span> <span class="o">{</span>
216            <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="nx">BASE</span><span class="o">,</span> <span class="s1">&#39;node&#39;</span><span class="o">],</span>
217            <span class="nx">submodules</span><span class="o">:</span> <span class="o">{</span>
218                <span class="s1">&#39;anim-base&#39;</span><span class="o">:</span> <span class="o">{</span>
219                    <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;base&#39;</span><span class="o">,</span> <span class="s1">&#39;node-style&#39;</span><span class="o">]</span>
220                <span class="o">},</span>
221                <span class="s1">&#39;anim-color&#39;</span><span class="o">:</span> <span class="o">{</span>
222                    <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;anim-base&#39;</span><span class="o">]</span>
223                <span class="o">},</span>
224                <span class="s1">&#39;anim-curve&#39;</span><span class="o">:</span> <span class="o">{</span>
225                    <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;anim-xy&#39;</span><span class="o">]</span>
226                <span class="o">},</span>
227                <span class="s1">&#39;anim-easing&#39;</span><span class="o">:</span> <span class="o">{</span>
228                <span class="o">},</span>
229                <span class="s1">&#39;anim-scroll&#39;</span><span class="o">:</span> <span class="o">{</span>
230                    <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;anim-base&#39;</span><span class="o">]</span>
231                <span class="o">},</span>
232                <span class="s1">&#39;anim-xy&#39;</span><span class="o">:</span> <span class="o">{</span>
233                    <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;anim-base&#39;</span><span class="o">,</span> <span class="s1">&#39;node-screen&#39;</span><span class="o">]</span>
234                <span class="o">},</span>
235                <span class="s1">&#39;anim-node-plugin&#39;</span><span class="o">:</span> <span class="o">{</span>
236                     <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;node&#39;</span><span class="o">,</span> <span class="s1">&#39;anim-base&#39;</span><span class="o">]</span>
237                <span class="o">}</span>
238            <span class="o">}</span>
239        <span class="o">},</span>
240
241        <span class="nx">attribute</span><span class="o">:</span> <span class="o">{</span> 
242            <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;event&#39;</span><span class="o">]</span>
243        <span class="o">},</span>
244
245        <span class="nx">base</span><span class="o">:</span> <span class="o">{</span>
246            <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;attribute&#39;</span><span class="o">]</span>
247        <span class="o">},</span>
248       
249        <span class="nx">compat</span><span class="o">:</span> <span class="o">{</span> 
250            <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;node&#39;</span><span class="o">]</span>
251        <span class="o">},</span>
252       
253        <span class="nx">cookie</span><span class="o">:</span> <span class="o">{</span> <span class="o">},</span>
254
255        <span class="c">// Note: CSS attributes are modified programmatically to reduce metadata size</span>
256<span class="c"></span>        <span class="c">// cssbase: {</span>
257<span class="c"></span>        <span class="c">//     after: CSS_AFTER</span>
258<span class="c"></span>        <span class="c">// },</span>
259<span class="c"></span>
260        <span class="c">// cssgrids: {</span>
261<span class="c"></span>        <span class="c">//     requires: [CSSFONTS],</span>
262<span class="c"></span>        <span class="c">//     optional: [CSSRESET]</span>
263<span class="c"></span>        <span class="c">// },</span>
264<span class="c"></span>
265        <span class="s1">&#39;dd&#39;</span><span class="o">:{</span>
266            <span class="nx">submodules</span><span class="o">:</span> <span class="o">{</span>
267                <span class="s1">&#39;dd-ddm-base&#39;</span><span class="o">:</span> <span class="o">{</span>
268                    <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;node&#39;</span><span class="o">,</span> <span class="nx">BASE</span><span class="o">]</span>
269                <span class="o">},</span> 
270                <span class="s1">&#39;dd-ddm&#39;</span><span class="o">:{</span>
271                    <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;dd-ddm-base&#39;</span><span class="o">]</span>
272                <span class="o">},</span> 
273                <span class="s1">&#39;dd-ddm-drop&#39;</span><span class="o">:{</span>
274                    <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;dd-ddm&#39;</span><span class="o">]</span>
275                <span class="o">},</span> 
276                <span class="s1">&#39;dd-drag&#39;</span><span class="o">:{</span>
277                    <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;dd-ddm-base&#39;</span><span class="o">]</span>
278                <span class="o">},</span> 
279                <span class="s1">&#39;dd-drop&#39;</span><span class="o">:{</span>
280                    <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;dd-ddm-drop&#39;</span><span class="o">]</span>
281                <span class="o">},</span> 
282                <span class="s1">&#39;dd-proxy&#39;</span><span class="o">:{</span>
283                    <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;dd-drag&#39;</span><span class="o">]</span>
284                <span class="o">},</span> 
285                <span class="s1">&#39;dd-constrain&#39;</span><span class="o">:{</span>
286                    <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;dd-drag&#39;</span><span class="o">,</span> <span class="s1">&#39;dd-proxy&#39;</span><span class="o">]</span>
287                <span class="o">},</span> 
288                <span class="s1">&#39;dd-plugin&#39;</span><span class="o">:{</span>
289                    <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;dd-drag&#39;</span><span class="o">],</span>
290                    <span class="nx">optional</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;dd-constrain&#39;</span><span class="o">,</span> <span class="s1">&#39;dd-proxy&#39;</span><span class="o">]</span>
291                <span class="o">},</span>
292                <span class="s1">&#39;dd-drop-plugin&#39;</span><span class="o">:{</span>
293                    <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;dd-drop&#39;</span><span class="o">]</span>
294                <span class="o">}</span>
295            <span class="o">}</span>
296        <span class="o">},</span>
297
298        <span class="nx">dump</span><span class="o">:</span> <span class="o">{</span> <span class="o">},</span>
299
300        <span class="nx">event</span><span class="o">:</span> <span class="o">{</span> 
301            <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;oop&#39;</span><span class="o">]</span>
302        <span class="o">},</span>
303       
304        <span class="nx">io</span><span class="o">:</span> <span class="o">{</span> 
305            <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;node&#39;</span><span class="o">]</span>
306        <span class="o">},</span>
307
308        <span class="nx">json</span><span class="o">:</span> <span class="o">{</span>
309            <span class="nx">submodules</span><span class="o">:</span> <span class="o">{</span>
310                <span class="s1">&#39;json-parse&#39;</span><span class="o">:</span> <span class="o">{</span>
311                <span class="o">},</span>
312
313                <span class="s1">&#39;json-stringify&#39;</span><span class="o">:</span> <span class="o">{</span>
314                <span class="o">}</span>
315            <span class="o">}</span>
316        <span class="o">},</span>
317       
318        <span class="nx">oop</span><span class="o">:</span> <span class="o">{</span> 
319            <span class="nx">requires</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;yui-base&#39;</span><span class="o">]</span>
320        <span class="o">},</span>
321
322        <span class="nx">queue</span><span class="o">:</span> <span class="o">{</span> <span class="o">},</span>
323
324        <span class="nx">substitute</span><span class="o">:</span> <span class="o">{</span>
325            <span class="nx">optional</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;dump&#39;</span><span class="o">]</span>
326        <span class="o">},</span>
327
328        <span class="c">// Since YUI is required for everything else, it should not be specified as</span>
329<span class="c"></span>        <span class="c">// a dependency.</span>
330<span class="c"></span>        <span class="nx">yui</span><span class="o">:</span> <span class="o">{</span>
331            <span class="nx">supersedes</span><span class="o">:</span> <span class="o">[</span><span class="s1">&#39;yui-base&#39;</span><span class="o">,</span> <span class="s1">&#39;get&#39;</span><span class="o">,</span> <span class="s1">&#39;loader&#39;</span><span class="o">]</span>
332        <span class="o">},</span>
333
334        <span class="s1">&#39;yui-base&#39;</span><span class="o">:</span> <span class="o">{</span> <span class="o">}</span>
335    <span class="o">}</span>
336<span class="o">};</span>
337
338<span class="k">var</span> <span class="nx">_path</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">dir</span><span class="o">,</span> <span class="nx">file</span><span class="o">,</span> <span class="nx">type</span><span class="o">)</span> <span class="o">{</span>
339    <span class="k">return</span> <span class="nx">dir</span> <span class="o">+</span> <span class="s1">&#39;/&#39;</span> <span class="o">+</span> <span class="nx">file</span> <span class="o">+</span> <span class="s1">&#39;-min.&#39;</span> <span class="o">+</span> <span class="o">(</span><span class="nx">type</span> <span class="o">||</span> <span class="nx">CSS</span><span class="o">);</span>
340<span class="o">};</span>
341
342<span class="k">var</span> <span class="nx">_cssmeta</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
343    <span class="k">var</span> <span class="nx">mods</span> <span class="o">=</span> <span class="nx">META</span><span class="o">.</span><span class="nx">modules</span><span class="o">;</span>
344    <span class="c">// modify the meta info for YUI CSS</span>
345<span class="c"></span>    <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">i</span><span class="o">&lt;</span><span class="nx">YUI_CSS</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">i</span><span class="o">=</span><span class="nx">i</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
346        <span class="k">var</span> <span class="nx">bname</span> <span class="o">=</span> <span class="nx">YUI_CSS</span><span class="o">[</span><span class="nx">i</span><span class="o">],</span>
347            <span class="nx">mname</span> <span class="o">=</span> <span class="nx">CSS</span> <span class="o">+</span> <span class="nx">bname</span><span class="o">;</span>
348
349        <span class="nx">mods</span><span class="o">[</span><span class="nx">mname</span><span class="o">]</span> <span class="o">=</span> <span class="o">{</span>
350            <span class="nx">type</span><span class="o">:</span> <span class="nx">CSS</span><span class="o">,</span>
351            <span class="nx">path</span><span class="o">:</span> <span class="nx">_path</span><span class="o">(</span><span class="nx">mname</span><span class="o">,</span> <span class="nx">bname</span><span class="o">)</span>
352        <span class="o">};</span>
353
354        <span class="c">// define -context module</span>
355<span class="c"></span>        <span class="k">var</span> <span class="nx">contextname</span> <span class="o">=</span> <span class="nx">mname</span> <span class="o">+</span> <span class="nx">CONTEXT</span><span class="o">;</span>
356        <span class="nx">bname</span> <span class="o">=</span> <span class="nx">bname</span> <span class="o">+</span> <span class="nx">CONTEXT</span><span class="o">;</span>
357
358        <span class="nx">mods</span><span class="o">[</span><span class="nx">contextname</span><span class="o">]</span> <span class="o">=</span> <span class="o">{</span>
359            <span class="nx">type</span><span class="o">:</span> <span class="nx">CSS</span><span class="o">,</span>
360            <span class="nx">path</span><span class="o">:</span> <span class="nx">_path</span><span class="o">(</span><span class="nx">mname</span><span class="o">,</span> <span class="nx">bname</span><span class="o">)</span>
361        <span class="o">};</span>
362
363        <span class="k">if</span> <span class="o">(</span><span class="nx">mname</span> <span class="o">==</span> <span class="nx">CSSGRIDS</span><span class="o">)</span> <span class="o">{</span>
364            <span class="nx">mods</span><span class="o">[</span><span class="nx">mname</span><span class="o">].</span><span class="nx">requires</span> <span class="o">=</span> <span class="o">[</span><span class="nx">CSSFONTS</span><span class="o">];</span>
365            <span class="nx">mods</span><span class="o">[</span><span class="nx">mname</span><span class="o">].</span><span class="nx">optional</span> <span class="o">=</span> <span class="o">[</span><span class="nx">CSSRESET</span><span class="o">];</span>
366            <span class="nx">mods</span><span class="o">[</span><span class="nx">contextname</span><span class="o">].</span><span class="nx">requires</span> <span class="o">=</span> <span class="o">[</span><span class="nx">CSSFONTS</span> <span class="o">+</span> <span class="nx">CONTEXT</span><span class="o">];</span>
367            <span class="nx">mods</span><span class="o">[</span><span class="nx">contextname</span><span class="o">].</span><span class="nx">optional</span> <span class="o">=</span> <span class="o">[</span><span class="nx">CSSRESET</span> <span class="o">+</span> <span class="nx">CONTEXT</span><span class="o">];</span>
368        <span class="o">}</span> <span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">mname</span> <span class="o">==</span> <span class="nx">CSSBASE</span><span class="o">)</span> <span class="o">{</span>
369            <span class="nx">mods</span><span class="o">[</span><span class="nx">mname</span><span class="o">].</span><span class="nx">after</span> <span class="o">=</span> <span class="nx">CSS_AFTER</span><span class="o">;</span>
370            <span class="nx">mods</span><span class="o">[</span><span class="nx">contextname</span><span class="o">].</span><span class="nx">after</span> <span class="o">=</span> <span class="nx">CSS_AFTER</span><span class="o">;</span>
371        <span class="o">}</span>
372    <span class="o">}</span>
373<span class="o">}();</span>
374
375<span class="nx">Y</span><span class="o">.</span><span class="nx">Env</span><span class="o">.</span><span class="nx">meta</span> <span class="o">=</span> <span class="nx">META</span><span class="o">;</span>
376
377
378    <span class="k">var</span> <span class="nx">L</span><span class="o">=</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Lang</span><span class="o">,</span> <span class="nx">env</span><span class="o">=</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Env</span><span class="o">,</span>
379        <span class="nx">PROV</span> <span class="o">=</span> <span class="s2">&quot;_provides&quot;</span><span class="o">,</span> <span class="nx">SUPER</span> <span class="o">=</span> <span class="s2">&quot;_supersedes&quot;</span><span class="o">,</span>
380        <span class="nx">REQ</span> <span class="o">=</span> <span class="s2">&quot;expanded&quot;</span><span class="o">;</span>
381
382    <span class="nx">Y</span><span class="o">.</span><span class="nx">Loader</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">o</span><span class="o">)</span> <span class="o">{</span>
383
384        <span class="c">/**</span>
385<span class="c">         * Internal callback to handle multiple internal insert() calls</span>
386<span class="c">         * so that css is inserted prior to js</span>
387<span class="c">         * @property _internalCallback</span>
388<span class="c">         * @private</span>
389<span class="c">         */</span>
390        <span class="k">this</span><span class="o">.</span><span class="nx">_internalCallback</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
391
392        <span class="c">/**</span>
393<span class="c">         * Use the YUI environment listener to detect script load.  This</span>
394<span class="c">         * is only switched on for Safari 2.x and below.</span>
395<span class="c">         * @property _useYahooListener</span>
396<span class="c">         * @private</span>
397<span class="c">         */</span>
398        <span class="k">this</span><span class="o">.</span><span class="nx">_useYahooListener</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
399
400        <span class="c">/**</span>
401<span class="c">         * Callback that will be executed when the loader is finished</span>
402<span class="c">         * with an insert</span>
403<span class="c">         * @method onSuccess</span>
404<span class="c">         * @type function</span>
405<span class="c">         */</span>
406        <span class="k">this</span><span class="o">.</span><span class="nx">onSuccess</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
407
408        <span class="c">/**</span>
409<span class="c">         * Callback that will be executed if there is a failure</span>
410<span class="c">         * @method onFailure</span>
411<span class="c">         * @type function</span>
412<span class="c">         */</span>
413        <span class="k">this</span><span class="o">.</span><span class="nx">onFailure</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
414
415        <span class="c">/**</span>
416<span class="c">         * Callback executed each time a script or css file is loaded</span>
417<span class="c">         * @method onProgress</span>
418<span class="c">         * @type function</span>
419<span class="c">         */</span>
420        <span class="k">this</span><span class="o">.</span><span class="nx">onProgress</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
421
422        <span class="c">/**</span>
423<span class="c">         * Callback that will be executed if a timeout occurs</span>
424<span class="c">         * @method onTimeout</span>
425<span class="c">         * @type function</span>
426<span class="c">         */</span>
427        <span class="k">this</span><span class="o">.</span><span class="nx">onTimeout</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
428
429        <span class="c">/**</span>
430<span class="c">         * The execution context for all callbacks</span>
431<span class="c">         * @property context</span>
432<span class="c">         * @default {YUI} the YUI instance</span>
433<span class="c">         */</span>
434        <span class="k">this</span><span class="o">.</span><span class="nx">context</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">;</span>
435
436        <span class="c">/**</span>
437<span class="c">         * Data that is passed to all callbacks</span>
438<span class="c">         * @property data</span>
439<span class="c">         */</span>
440        <span class="k">this</span><span class="o">.</span><span class="nx">data</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
441
442        <span class="c">/**</span>
443<span class="c">         * Node reference or id where new nodes should be inserted before</span>
444<span class="c">         * @property insertBefore</span>
445<span class="c">         * @type string|HTMLElement</span>
446<span class="c">         */</span>
447        <span class="k">this</span><span class="o">.</span><span class="nx">insertBefore</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
448
449        <span class="c">/**</span>
450<span class="c">         * The charset attribute for inserted nodes</span>
451<span class="c">         * @property charset</span>
452<span class="c">         * @type string</span>
453<span class="c">         * @default utf-8</span>
454<span class="c">         */</span>
455        <span class="k">this</span><span class="o">.</span><span class="nx">charset</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
456
457        <span class="c">/**</span>
458<span class="c">         * The base directory.</span>
459<span class="c">         * @property base</span>
460<span class="c">         * @type string</span>
461<span class="c">         * @default http://yui.yahooapis.com/[YUI VERSION]/build/</span>
462<span class="c">         */</span>
463        <span class="k">this</span><span class="o">.</span><span class="nx">base</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Env</span><span class="o">.</span><span class="nx">meta</span><span class="o">.</span><span class="nx">base</span><span class="o">;</span>
464
465        <span class="c">/**</span>
466<span class="c">         * Base path for the combo service</span>
467<span class="c">         * @property comboBase</span>
468<span class="c">         * @type string</span>
469<span class="c">         * @default http://yui.yahooapis.com/combo?</span>
470<span class="c">         */</span>
471        <span class="k">this</span><span class="o">.</span><span class="nx">comboBase</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Env</span><span class="o">.</span><span class="nx">meta</span><span class="o">.</span><span class="nx">comboBase</span><span class="o">;</span>
472
473        <span class="c">/**</span>
474<span class="c">         * If configured, YUI JS resources will use the combo</span>
475<span class="c">         * handler</span>
476<span class="c">         * @property combine</span>
477<span class="c">         * @type boolean</span>
478<span class="c">         * @default true if a base dir isn&#39;t in the config</span>
479<span class="c">         */</span>
480        <span class="k">this</span><span class="o">.</span><span class="nx">combine</span> <span class="o">=</span> <span class="o">(!(</span><span class="nx">BASE</span> <span class="k">in</span> <span class="nx">o</span><span class="o">));</span>
481
482        <span class="c">/**</span>
483<span class="c">         * Ignore modules registered on the YUI global</span>
484<span class="c">         * @property ignoreRegistered</span>
485<span class="c">         * @default false</span>
486<span class="c">         */</span>
487        <span class="k">this</span><span class="o">.</span><span class="nx">ignoreRegistered</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
488
489        <span class="c">/**</span>
490<span class="c">         * Root path to prepend to module path for the combo</span>
491<span class="c">         * service</span>
492<span class="c">         * @property root</span>
493<span class="c">         * @type string</span>
494<span class="c">         * @default [YUI VERSION]/build/</span>
495<span class="c">         */</span>
496        <span class="k">this</span><span class="o">.</span><span class="nx">root</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Env</span><span class="o">.</span><span class="nx">meta</span><span class="o">.</span><span class="nx">root</span><span class="o">;</span>
497
498        <span class="c">/**</span>
499<span class="c">         * Timeout value in milliseconds.  If set, this value will be used by</span>
500<span class="c">         * the get utility.  the timeout event will fire if</span>
501<span class="c">         * a timeout occurs.</span>
502<span class="c">         * @property timeout</span>
503<span class="c">         * @type int</span>
504<span class="c">         */</span>
505        <span class="k">this</span><span class="o">.</span><span class="nx">timeout</span> <span class="o">=</span> <span class="m">0</span><span class="o">;</span>
506
507        <span class="c">/**</span>
508<span class="c">         * A list of modules that should not be loaded, even if</span>
509<span class="c">         * they turn up in the dependency tree</span>
510<span class="c">         * @property ignore</span>
511<span class="c">         * @type string[]</span>
512<span class="c">         */</span>
513        <span class="k">this</span><span class="o">.</span><span class="nx">ignore</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
514
515        <span class="c">/**</span>
516<span class="c">         * A list of modules that should always be loaded, even</span>
517<span class="c">         * if they have already been inserted into the page.</span>
518<span class="c">         * @property force</span>
519<span class="c">         * @type string[]</span>
520<span class="c">         */</span>
521        <span class="k">this</span><span class="o">.</span><span class="nx">force</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
522
523        <span class="c">/**</span>
524<span class="c">         * Should we allow rollups</span>
525<span class="c">         * @property allowRollup</span>
526<span class="c">         * @type boolean</span>
527<span class="c">         * @default true</span>
528<span class="c">         */</span>
529        <span class="k">this</span><span class="o">.</span><span class="nx">allowRollup</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
530
531        <span class="c">/**</span>
532<span class="c">         * A filter to apply to result urls.  This filter will modify the default</span>
533<span class="c">         * path for all modules.  The default path for the YUI library is the</span>
534<span class="c">         * minified version of the files (e.g., event-min.js).  The filter property</span>
535<span class="c">         * can be a predefined filter or a custom filter.  The valid predefined </span>
536<span class="c">         * filters are:</span>
537<span class="c">         * &lt;dl&gt;</span>
538<span class="c">         *  &lt;dt&gt;DEBUG&lt;/dt&gt;</span>
539<span class="c">         *  &lt;dd&gt;Selects the debug versions of the library (e.g., event-debug.js).</span>
540<span class="c">         *      This option will automatically include the logger widget&lt;/dd&gt;</span>
541<span class="c">         *  &lt;dt&gt;RAW&lt;/dt&gt;</span>
542<span class="c">         *  &lt;dd&gt;Selects the non-minified version of the library (e.g., event.js).&lt;/dd&gt;</span>
543<span class="c">         * &lt;/dl&gt;</span>
544<span class="c">         * You can also define a custom filter, which must be an object literal </span>
545<span class="c">         * containing a search expression and a replace string:</span>
546<span class="c">         * &lt;pre&gt;</span>
547<span class="c">         *  myFilter: &amp;#123; </span>
548<span class="c">         *      &#39;searchExp&#39;: &quot;-min\\.js&quot;, </span>
549<span class="c">         *      &#39;replaceStr&#39;: &quot;-debug.js&quot;</span>
550<span class="c">         *  &amp;#125;</span>
551<span class="c">         * &lt;/pre&gt;</span>
552<span class="c">         * @property filter</span>
553<span class="c">         * @type string|{searchExp: string, replaceStr: string}</span>
554<span class="c">         */</span>
555        <span class="k">this</span><span class="o">.</span><span class="nx">filter</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
556
557        <span class="c">/**</span>
558<span class="c">         * The list of requested modules</span>
559<span class="c">         * @property required</span>
560<span class="c">         * @type {string: boolean}</span>
561<span class="c">         */</span>
562        <span class="k">this</span><span class="o">.</span><span class="nx">required</span> <span class="o">=</span> <span class="o">{};</span>
563
564        <span class="c">/**</span>
565<span class="c">         * The library metadata</span>
566<span class="c">         * @property moduleInfo</span>
567<span class="c">         */</span>
568        <span class="c">// this.moduleInfo = Y.merge(Y.Env.meta.moduleInfo);</span>
569<span class="c"></span>        <span class="k">this</span><span class="o">.</span><span class="nx">moduleInfo</span> <span class="o">=</span> <span class="o">{};</span>
570       
571        <span class="k">var</span> <span class="nx">defaults</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Env</span><span class="o">.</span><span class="nx">meta</span><span class="o">.</span><span class="nx">modules</span><span class="o">;</span>
572
573        <span class="k">for</span> <span class="o">(</span><span class="k">var</span> <span class="nx">i</span> <span class="k">in</span> <span class="nx">defaults</span><span class="o">)</span> <span class="o">{</span>
574            <span class="k">if</span> <span class="o">(</span><span class="nx">defaults</span><span class="o">.</span><span class="nx">hasOwnProperty</span><span class="o">(</span><span class="nx">i</span><span class="o">))</span> <span class="o">{</span>
575                <span class="k">this</span><span class="o">.</span><span class="nx">_internal</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
576                <span class="k">this</span><span class="o">.</span><span class="nx">addModule</span><span class="o">(</span><span class="nx">defaults</span><span class="o">[</span><span class="nx">i</span><span class="o">],</span> <span class="nx">i</span><span class="o">);</span>
577                <span class="k">this</span><span class="o">.</span><span class="nx">_internal</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
578            <span class="o">}</span>
579        <span class="o">}</span>
580
581        <span class="c">/**</span>
582<span class="c">         * List of rollup files found in the library metadata</span>
583<span class="c">         * @property rollups</span>
584<span class="c">         */</span>
585        <span class="k">this</span><span class="o">.</span><span class="nx">rollups</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
586
587        <span class="c">/**</span>
588<span class="c">         * Whether or not to load optional dependencies for </span>
589<span class="c">         * the requested modules</span>
590<span class="c">         * @property loadOptional</span>
591<span class="c">         * @type boolean</span>
592<span class="c">         * @default false</span>
593<span class="c">         */</span>
594        <span class="k">this</span><span class="o">.</span><span class="nx">loadOptional</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
595
596        <span class="c">/**</span>
597<span class="c">         * All of the derived dependencies in sorted order, which</span>
598<span class="c">         * will be populated when either calculate() or insert()</span>
599<span class="c">         * is called</span>
600<span class="c">         * @property sorted</span>
601<span class="c">         * @type string[]</span>
602<span class="c">         */</span>
603        <span class="k">this</span><span class="o">.</span><span class="nx">sorted</span> <span class="o">=</span> <span class="o">[];</span>
604
605        <span class="c">/**</span>
606<span class="c">         * Set when beginning to compute the dependency tree. </span>
607<span class="c">         * Composed of what YUI reports to be loaded combined</span>
608<span class="c">         * with what has been loaded by the tool</span>
609<span class="c">         * @propery loaded</span>
610<span class="c">         * @type {string: boolean}</span>
611<span class="c">         */</span>
612        <span class="k">this</span><span class="o">.</span><span class="nx">loaded</span> <span class="o">=</span> <span class="o">{};</span>
613
614        <span class="c">/**</span>
615<span class="c">         * A list of modules to attach to the YUI instance when complete.</span>
616<span class="c">         * If not supplied, the sorted list of dependencies are applied.</span>
617<span class="c">         * @property attaching</span>
618<span class="c">         */</span>
619        <span class="k">this</span><span class="o">.</span><span class="nx">attaching</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
620
621        <span class="c">/**</span>
622<span class="c">         * Flag to indicate the dependency tree needs to be recomputed</span>
623<span class="c">         * if insert is called again.</span>
624<span class="c">         * @property dirty</span>
625<span class="c">         * @type boolean</span>
626<span class="c">         * @default true</span>
627<span class="c">         */</span>
628        <span class="k">this</span><span class="o">.</span><span class="nx">dirty</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
629
630        <span class="c">/**</span>
631<span class="c">         * List of modules inserted by the utility</span>
632<span class="c">         * @property inserted</span>
633<span class="c">         * @type {string: boolean}</span>
634<span class="c">         */</span>
635        <span class="k">this</span><span class="o">.</span><span class="nx">inserted</span> <span class="o">=</span> <span class="o">{};</span>
636
637        <span class="k">this</span><span class="o">.</span><span class="nx">skipped</span> <span class="o">=</span> <span class="o">{};</span>
638
639        <span class="c">// Y.on(&#39;yui:load&#39;, this.loadNext, this);</span>
640<span class="c"></span>
641        <span class="k">this</span><span class="o">.</span><span class="nx">_config</span><span class="o">(</span><span class="nx">o</span><span class="o">);</span>
642
643    <span class="o">};</span>
644
645    <span class="nx">Y</span><span class="o">.</span><span class="nx">Loader</span><span class="o">.</span><span class="nx">prototype</span> <span class="o">=</span> <span class="o">{</span>
646
647        <span class="nx">FILTERS</span><span class="o">:</span> <span class="o">{</span>
648            <span class="nx">RAW</span><span class="o">:</span> <span class="o">{</span> 
649                <span class="s1">&#39;searchExp&#39;</span><span class="o">:</span> <span class="s2">&quot;-min\\.js&quot;</span><span class="o">,</span> 
650                <span class="s1">&#39;replaceStr&#39;</span><span class="o">:</span> <span class="s2">&quot;.js&quot;</span>
651            <span class="o">},</span>
652            <span class="nx">DEBUG</span><span class="o">:</span> <span class="o">{</span> 
653                <span class="s1">&#39;searchExp&#39;</span><span class="o">:</span> <span class="s2">&quot;-min\\.js&quot;</span><span class="o">,</span> 
654                <span class="s1">&#39;replaceStr&#39;</span><span class="o">:</span> <span class="s2">&quot;-debug.js&quot;</span>
655            <span class="o">}</span>
656        <span class="o">},</span>
657
658        <span class="nx">_config</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">o</span><span class="o">)</span> <span class="o">{</span>
659
660            <span class="c">// apply config values</span>
661<span class="c"></span>            <span class="k">if</span> <span class="o">(</span><span class="nx">o</span><span class="o">)</span> <span class="o">{</span>
662                <span class="k">for</span> <span class="o">(</span><span class="k">var</span> <span class="nx">i</span> <span class="k">in</span> <span class="nx">o</span><span class="o">)</span> <span class="o">{</span>
663                    <span class="k">var</span> <span class="nx">val</span> <span class="o">=</span> <span class="nx">o</span><span class="o">[</span><span class="nx">i</span><span class="o">];</span>
664                    <span class="k">if</span> <span class="o">(</span><span class="nx">o</span><span class="o">.</span><span class="nx">hasOwnProperty</span><span class="o">(</span><span class="nx">i</span><span class="o">))</span> <span class="o">{</span>
665                        <span class="k">if</span> <span class="o">(</span><span class="nx">i</span> <span class="o">==</span> <span class="s1">&#39;require&#39;</span><span class="o">)</span> <span class="o">{</span>
666                            <span class="k">this</span><span class="o">.</span><span class="nx">require</span><span class="o">(</span><span class="nx">val</span><span class="o">);</span>
667                        <span class="c">// support the old callback syntax</span>
668<span class="c"></span>                        <span class="c">// } else if (i.indexOf(&#39;on&#39;) === 0) {</span>
669<span class="c"></span>                            <span class="c">// this.subscribe(i.substr(2).toLowerCase(), o[i], o.context || this);</span>
670<span class="c"></span>                        <span class="o">}</span> <span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">i</span> <span class="o">==</span> <span class="s1">&#39;modules&#39;</span><span class="o">)</span> <span class="o">{</span>
671                            <span class="c">// add a hash of module definitions</span>
672<span class="c"></span>                            <span class="k">for</span> <span class="o">(</span><span class="k">var</span> <span class="nx">j</span> <span class="k">in</span> <span class="nx">val</span><span class="o">)</span> <span class="o">{</span>
673                                <span class="k">this</span><span class="o">.</span><span class="nx">addModule</span><span class="o">(</span><span class="nx">val</span><span class="o">[</span><span class="nx">j</span><span class="o">],</span> <span class="nx">j</span><span class="o">);</span>
674                            <span class="o">}</span>
675                        <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
676                            <span class="k">this</span><span class="o">[</span><span class="nx">i</span><span class="o">]</span> <span class="o">=</span> <span class="nx">val</span><span class="o">;</span>
677                        <span class="o">}</span>
678                    <span class="o">}</span>
679                <span class="o">}</span>
680            <span class="o">}</span>
681
682            <span class="c">// fix filter</span>
683<span class="c"></span>            <span class="k">var</span> <span class="nx">f</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">filter</span><span class="o">;</span>
684
685            <span class="k">if</span> <span class="o">(</span><span class="nx">L</span><span class="o">.</span><span class="nx">isString</span><span class="o">(</span><span class="nx">f</span><span class="o">))</span> <span class="o">{</span>
686
687                <span class="nx">f</span> <span class="o">=</span> <span class="nx">f</span><span class="o">.</span><span class="nx">toUpperCase</span><span class="o">();</span>
688
689                <span class="k">this</span><span class="o">.</span><span class="nx">filterName</span> <span class="o">=</span> <span class="nx">f</span><span class="o">;</span>
690
691                <span class="c">// the logger must be available in order to use the debug</span>
692<span class="c"></span>                <span class="c">// versions of the library</span>
693<span class="c"></span>                <span class="c">// @TODO review when logreader is available</span>
694<span class="c"></span>                <span class="c">// if (f === &quot;DEBUG&quot;) {</span>
695<span class="c"></span>                <span class="c">//     this.require(&quot;log&quot;);</span>
696<span class="c"></span>                <span class="c">// }</span>
697<span class="c"></span>
698                <span class="k">this</span><span class="o">.</span><span class="nx">filter</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">FILTERS</span><span class="o">[</span><span class="nx">f</span><span class="o">];</span>
699            <span class="o">}</span>
700
701        <span class="o">},</span>
702
703        <span class="c">/** Add a new module to the component metadata.         </span>
704<span class="c">         * &lt;dl&gt;</span>
705<span class="c">         *     &lt;dt&gt;name:&lt;/dt&gt;       &lt;dd&gt;required, the component name&lt;/dd&gt;</span>
706<span class="c">         *     &lt;dt&gt;type:&lt;/dt&gt;       &lt;dd&gt;required, the component type (js or css)&lt;/dd&gt;</span>
707<span class="c">         *     &lt;dt&gt;path:&lt;/dt&gt;       &lt;dd&gt;required, the path to the script from &quot;base&quot;&lt;/dd&gt;</span>
708<span class="c">         *     &lt;dt&gt;requires:&lt;/dt&gt;   &lt;dd&gt;array of modules required by this component&lt;/dd&gt;</span>
709<span class="c">         *     &lt;dt&gt;optional:&lt;/dt&gt;   &lt;dd&gt;array of optional modules for this component&lt;/dd&gt;</span>
710<span class="c">         *     &lt;dt&gt;supersedes:&lt;/dt&gt; &lt;dd&gt;array of the modules this component replaces&lt;/dd&gt;</span>
711<span class="c">         *     &lt;dt&gt;after:&lt;/dt&gt;      &lt;dd&gt;array of modules the components which, if present, should be sorted above this one&lt;/dd&gt;</span>
712<span class="c">         *     &lt;dt&gt;rollup:&lt;/dt&gt;     &lt;dd&gt;the number of superseded modules required for automatic rollup&lt;/dd&gt;</span>
713<span class="c">         *     &lt;dt&gt;fullpath:&lt;/dt&gt;   &lt;dd&gt;If fullpath is specified, this is used instead of the configured base + path&lt;/dd&gt;</span>
714<span class="c">         *     &lt;dt&gt;skinnable:&lt;/dt&gt;  &lt;dd&gt;flag to determine if skin assets should automatically be pulled in&lt;/dd&gt;</span>
715<span class="c">         *     &lt;dt&gt;submodules:&lt;/dt&gt; &lt;dd&gt;a has of submodules&lt;/dd&gt;</span>
716<span class="c">         * &lt;/dl&gt;</span>
717<span class="c">         * @method addModule</span>
718<span class="c">         * @param o An object containing the module data</span>
719<span class="c">         * @param name the module name (optional), required if not in the module data</span>
720<span class="c">         * @return {boolean} true if the module was added, false if </span>
721<span class="c">         * the object passed in did not provide all required attributes</span>
722<span class="c">         */</span>
723        <span class="nx">addModule</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">name</span><span class="o">)</span> <span class="o">{</span>
724
725            <span class="nx">name</span> <span class="o">=</span> <span class="nx">name</span> <span class="o">||</span> <span class="nx">o</span><span class="o">.</span><span class="nx">name</span><span class="o">;</span>
726            <span class="nx">o</span><span class="o">.</span><span class="nx">name</span> <span class="o">=</span> <span class="nx">name</span><span class="o">;</span>
727
728            <span class="k">if</span> <span class="o">(!</span><span class="nx">o</span> <span class="o">||</span> <span class="o">!</span><span class="nx">o</span><span class="o">.</span><span class="nx">name</span><span class="o">)</span> <span class="o">{</span>
729                <span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
730            <span class="o">}</span>
731
732            <span class="k">if</span> <span class="o">(!</span><span class="nx">o</span><span class="o">.</span><span class="nx">type</span><span class="o">)</span> <span class="o">{</span>
733                <span class="nx">o</span><span class="o">.</span><span class="nx">type</span> <span class="o">=</span> <span class="nx">JS</span><span class="o">;</span>
734            <span class="o">}</span>
735
736            <span class="k">if</span> <span class="o">(!</span><span class="nx">o</span><span class="o">.</span><span class="nx">path</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">o</span><span class="o">.</span><span class="nx">fullpath</span><span class="o">)</span> <span class="o">{</span>
737                <span class="c">// o.path = name + &quot;/&quot; + name + &quot;-min.&quot; + o.type;</span>
738<span class="c"></span>                <span class="nx">o</span><span class="o">.</span><span class="nx">path</span> <span class="o">=</span> <span class="nx">_path</span><span class="o">(</span><span class="nx">name</span><span class="o">,</span> <span class="nx">name</span><span class="o">,</span> <span class="nx">o</span><span class="o">.</span><span class="nx">type</span><span class="o">);</span>
739            <span class="o">}</span>
740
741            <span class="nx">o</span><span class="o">.</span><span class="nx">ext</span> <span class="o">=</span> <span class="o">(</span><span class="s1">&#39;ext&#39;</span> <span class="k">in</span> <span class="nx">o</span><span class="o">)</span> <span class="o">?</span> <span class="nx">o</span><span class="o">.</span><span class="nx">ext</span> <span class="o">:</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_internal</span><span class="o">)</span> <span class="o">?</span> <span class="kc">false</span> <span class="o">:</span> <span class="kc">true</span><span class="o">;</span>
742            <span class="nx">o</span><span class="o">.</span><span class="nx">requires</span> <span class="o">=</span> <span class="nx">o</span><span class="o">.</span><span class="nx">requires</span> <span class="o">||</span> <span class="o">[];</span>
743
744            <span class="c">// Y.log(&#39;New module &#39; + name);</span>
745<span class="c"></span>
746            <span class="c">// Handle submodule logic</span>
747<span class="c"></span>            <span class="k">var</span> <span class="nx">subs</span> <span class="o">=</span> <span class="nx">o</span><span class="o">.</span><span class="nx">submodules</span><span class="o">;</span>
748            <span class="k">if</span> <span class="o">(</span><span class="nx">subs</span><span class="o">)</span> <span class="o">{</span>
749                <span class="k">var</span> <span class="nx">sup</span> <span class="o">=</span> <span class="o">[],</span> <span class="nx">l</span><span class="o">=</span><span class="m">0</span><span class="o">;</span>
750
751                <span class="k">for</span> <span class="o">(</span><span class="k">var</span> <span class="nx">i</span> <span class="k">in</span> <span class="nx">subs</span><span class="o">)</span> <span class="o">{</span>
752                    <span class="k">var</span> <span class="nx">s</span> <span class="o">=</span> <span class="nx">subs</span><span class="o">[</span><span class="nx">i</span><span class="o">];</span>
753                    <span class="nx">s</span><span class="o">.</span><span class="nx">path</span> <span class="o">=</span> <span class="nx">_path</span><span class="o">(</span><span class="nx">name</span><span class="o">,</span> <span class="nx">i</span><span class="o">,</span> <span class="nx">o</span><span class="o">.</span><span class="nx">type</span><span class="o">);</span>
754                    <span class="k">this</span><span class="o">.</span><span class="nx">addModule</span><span class="o">(</span><span class="nx">s</span><span class="o">,</span> <span class="nx">i</span><span class="o">);</span>
755                    <span class="nx">sup</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">i</span><span class="o">);</span>
756                    <span class="nx">l</span><span class="o">++;</span>
757                <span class="o">}</span>
758
759                <span class="nx">o</span><span class="o">.</span><span class="nx">supersedes</span> <span class="o">=</span> <span class="nx">sup</span><span class="o">;</span>
760                <span class="nx">o</span><span class="o">.</span><span class="nx">rollup</span> <span class="o">=</span> <span class="nb">Math</span><span class="o">.</span><span class="nx">min</span><span class="o">(</span><span class="nx">l</span><span class="o">-</span><span class="m">1</span><span class="o">,</span> <span class="m">4</span><span class="o">);</span>
761            <span class="o">}</span>
762
763            <span class="k">this</span><span class="o">.</span><span class="nx">moduleInfo</span><span class="o">[</span><span class="nx">name</span><span class="o">]</span> <span class="o">=</span> <span class="nx">o</span><span class="o">;</span>
764            <span class="k">this</span><span class="o">.</span><span class="nx">dirty</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
765
766            <span class="k">return</span> <span class="nx">o</span><span class="o">;</span>
767        <span class="o">},</span>
768
769        <span class="c">/**</span>
770<span class="c">         * Add a requirement for one or more module</span>
771<span class="c">         * @method require</span>
772<span class="c">         * @param what {string[] | string*} the modules to load</span>
773<span class="c">         */</span>
774        <span class="nx">require</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">what</span><span class="o">)</span> <span class="o">{</span>
775            <span class="k">var</span> <span class="nx">a</span> <span class="o">=</span> <span class="o">(</span><span class="k">typeof</span> <span class="nx">what</span> <span class="o">===</span> <span class="s2">&quot;string&quot;</span><span class="o">)</span> <span class="o">?</span> <span class="nx">arguments</span> <span class="o">:</span> <span class="nx">what</span><span class="o">;</span>
776            <span class="k">this</span><span class="o">.</span><span class="nx">dirty</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
777            <span class="nx">Y</span><span class="o">.</span><span class="nx">mix</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">required</span><span class="o">,</span> <span class="nx">Y</span><span class="o">.</span><span class="nb">Array</span><span class="o">.</span><span class="nx">hash</span><span class="o">(</span><span class="nx">a</span><span class="o">));</span>
778        <span class="o">},</span>
779
780        <span class="c">/**</span>
781<span class="c">         * Returns an object containing properties for all modules required</span>
782<span class="c">         * in order to load the requested module</span>
783<span class="c">         * @method getRequires</span>
784<span class="c">         * @param mod The module definition from moduleInfo</span>
785<span class="c">         */</span>
786        <span class="nx">getRequires</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">mod</span><span class="o">)</span> <span class="o">{</span>
787
788            <span class="k">if</span> <span class="o">(!</span><span class="nx">mod</span><span class="o">)</span> <span class="o">{</span>
789                <span class="c">// Y.log(&#39;getRequires, no module&#39;);</span>
790<span class="c"></span>                <span class="k">return</span> <span class="o">[];</span>
791            <span class="o">}</span>
792
793            <span class="k">if</span> <span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">dirty</span> <span class="o">&amp;&amp;</span> <span class="nx">mod</span><span class="o">.</span><span class="nx">expanded</span><span class="o">)</span> <span class="o">{</span>
794                <span class="c">// Y.log(&#39;already expanded&#39;);</span>
795<span class="c"></span>                <span class="k">return</span> <span class="nx">mod</span><span class="o">.</span><span class="nx">expanded</span><span class="o">;</span>
796            <span class="o">}</span>
797
798            <span class="k">var</span> <span class="nx">i</span><span class="o">,</span> <span class="nx">d</span><span class="o">=[],</span> <span class="nx">r</span><span class="o">=</span><span class="nx">mod</span><span class="o">.</span><span class="nx">requires</span><span class="o">,</span> <span class="nx">o</span><span class="o">=</span><span class="nx">mod</span><span class="o">.</span><span class="nx">optional</span><span class="o">,</span> 
799                <span class="nx">info</span><span class="o">=</span><span class="k">this</span><span class="o">.</span><span class="nx">moduleInfo</span><span class="o">,</span> <span class="nx">m</span><span class="o">,</span> <span class="nx">j</span><span class="o">,</span> <span class="nx">add</span><span class="o">;</span>
800
801            <span class="k">for</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">i</span><span class="o">&lt;</span><span class="nx">r</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">i</span><span class="o">=</span><span class="nx">i</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
802                <span class="c">// Y.log(mod.name + &#39; requiring &#39; + r[i]);</span>
803<span class="c"></span>                <span class="nx">d</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">r</span><span class="o">[</span><span class="nx">i</span><span class="o">]);</span>
804                <span class="nx">m</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">getModule</span><span class="o">(</span><span class="nx">r</span><span class="o">[</span><span class="nx">i</span><span class="o">]);</span>
805                <span class="nx">add</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">getRequires</span><span class="o">(</span><span class="nx">m</span><span class="o">);</span>
806                <span class="k">for</span> <span class="o">(</span><span class="nx">j</span><span class="o">=</span><span class="m">0</span><span class="o">;</span><span class="nx">j</span><span class="o">&lt;</span><span class="nx">add</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span><span class="nx">j</span><span class="o">=</span><span class="nx">j</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
807                    <span class="nx">d</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">add</span><span class="o">[</span><span class="nx">j</span><span class="o">]);</span>
808                <span class="o">}</span>
809            <span class="o">}</span>
810
811            <span class="c">// get the requirements from superseded modules, if any</span>
812<span class="c"></span>            <span class="nx">r</span><span class="o">=</span><span class="nx">mod</span><span class="o">.</span><span class="nx">supersedes</span><span class="o">;</span>
813            <span class="k">if</span> <span class="o">(</span><span class="nx">r</span><span class="o">)</span> <span class="o">{</span>
814                <span class="k">for</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">i</span><span class="o">&lt;</span><span class="nx">r</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">i</span><span class="o">=</span><span class="nx">i</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
815                    <span class="c">// Y.log(mod.name + &#39; requiring &#39; + r[i]);</span>
816<span class="c"></span>                    <span class="nx">d</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">r</span><span class="o">[</span><span class="nx">i</span><span class="o">]);</span>
817                    <span class="nx">m</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">getModule</span><span class="o">(</span><span class="nx">r</span><span class="o">[</span><span class="nx">i</span><span class="o">]);</span>
818                    <span class="nx">add</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">getRequires</span><span class="o">(</span><span class="nx">m</span><span class="o">);</span>
819                    <span class="k">for</span> <span class="o">(</span><span class="nx">j</span><span class="o">=</span><span class="m">0</span><span class="o">;</span><span class="nx">j</span><span class="o">&lt;</span><span class="nx">add</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span><span class="nx">j</span><span class="o">=</span><span class="nx">j</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
820                        <span class="nx">d</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">add</span><span class="o">[</span><span class="nx">j</span><span class="o">]);</span>
821                    <span class="o">}</span>
822                <span class="o">}</span>
823            <span class="o">}</span>
824
825            <span class="k">if</span> <span class="o">(</span><span class="nx">o</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="o">.</span><span class="nx">loadOptional</span><span class="o">)</span> <span class="o">{</span>
826                <span class="k">for</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">i</span><span class="o">&lt;</span><span class="nx">o</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">i</span><span class="o">=</span><span class="nx">i</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
827                    <span class="nx">d</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">o</span><span class="o">[</span><span class="nx">i</span><span class="o">]);</span>
828                    <span class="nx">add</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">getRequires</span><span class="o">(</span><span class="nx">info</span><span class="o">[</span><span class="nx">o</span><span class="o">[</span><span class="nx">i</span><span class="o">]]);</span>
829                    <span class="k">for</span> <span class="o">(</span><span class="nx">j</span><span class="o">=</span><span class="m">0</span><span class="o">;</span><span class="nx">j</span><span class="o">&lt;</span><span class="nx">add</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span><span class="nx">j</span><span class="o">=</span><span class="nx">j</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
830                        <span class="nx">d</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">add</span><span class="o">[</span><span class="nx">j</span><span class="o">]);</span>
831                    <span class="o">}</span>
832                <span class="o">}</span>
833            <span class="o">}</span>
834
835            <span class="nx">mod</span><span class="o">.</span><span class="nx">expanded</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nb">Object</span><span class="o">.</span><span class="nx">keys</span><span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nb">Array</span><span class="o">.</span><span class="nx">hash</span><span class="o">(</span><span class="nx">d</span><span class="o">));</span>
836
837            <span class="c">// Y.log(mod.expanded);</span>
838<span class="c"></span>
839            <span class="k">return</span> <span class="nx">mod</span><span class="o">.</span><span class="nx">expanded</span><span class="o">;</span>
840        <span class="o">},</span>
841
842
843        <span class="c">/**</span>
844<span class="c">         * Returns an object literal of the modules the supplied module satisfies</span>
845<span class="c">         * @method getProvides</span>
846<span class="c">         * @param name{string} The name of the module</span>
847<span class="c">         * @param notMe {string} don&#39;t add this module name, only include superseded modules</span>
848<span class="c">         * @return what this module provides</span>
849<span class="c">         */</span>
850        <span class="nx">getProvides</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">name</span><span class="o">,</span> <span class="nx">notMe</span><span class="o">)</span> <span class="o">{</span>
851            <span class="k">var</span> <span class="nx">addMe</span> <span class="o">=</span> <span class="o">!(</span><span class="nx">notMe</span><span class="o">),</span> <span class="nx">ckey</span> <span class="o">=</span> <span class="o">(</span><span class="nx">addMe</span><span class="o">)</span> <span class="o">?</span> <span class="nx">PROV</span> <span class="o">:</span> <span class="nx">SUPER</span><span class="o">,</span>
852                <span class="nx">m</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">getModule</span><span class="o">(</span><span class="nx">name</span><span class="o">),</span> <span class="nx">o</span> <span class="o">=</span> <span class="o">{};</span>
853
854            <span class="k">if</span> <span class="o">(!</span><span class="nx">m</span><span class="o">)</span> <span class="o">{</span>
855                <span class="k">return</span> <span class="nx">o</span><span class="o">;</span>
856            <span class="o">}</span>
857
858            <span class="k">if</span> <span class="o">(</span><span class="nx">m</span><span class="o">[</span><span class="nx">ckey</span><span class="o">])</span> <span class="o">{</span>
859<span class="c">// Y.log(&#39;cached: &#39; + name + &#39; &#39; + ckey + &#39; &#39; + L.dump(this.moduleInfo[name][ckey], 0));</span>
860<span class="c"></span>                <span class="k">return</span> <span class="nx">m</span><span class="o">[</span><span class="nx">ckey</span><span class="o">];</span>
861            <span class="o">}</span>
862
863            <span class="k">var</span> <span class="nx">s</span> <span class="o">=</span> <span class="nx">m</span><span class="o">.</span><span class="nx">supersedes</span><span class="o">,</span> <span class="nx">done</span><span class="o">={},</span> <span class="nx">me</span> <span class="o">=</span> <span class="k">this</span><span class="o">;</span>
864
865            <span class="c">// use worker to break cycles</span>
866<span class="c"></span>            <span class="k">var</span> <span class="nx">add</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">mm</span><span class="o">)</span> <span class="o">{</span>
867                <span class="k">if</span> <span class="o">(!</span><span class="nx">done</span><span class="o">[</span><span class="nx">mm</span><span class="o">])</span> <span class="o">{</span>
868                    <span class="c">// Y.log(name + &#39; provides worker trying: &#39; + mm);</span>
869<span class="c"></span>                    <span class="nx">done</span><span class="o">[</span><span class="nx">mm</span><span class="o">]</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
870                    <span class="c">// we always want the return value normal behavior </span>
871<span class="c"></span>                    <span class="c">// (provides) for superseded modules.</span>
872<span class="c"></span>                    <span class="nx">Y</span><span class="o">.</span><span class="nx">mix</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">me</span><span class="o">.</span><span class="nx">getProvides</span><span class="o">(</span><span class="nx">mm</span><span class="o">));</span>
873                <span class="o">}</span> 
874               
875                <span class="c">// else {</span>
876<span class="c"></span>                <span class="c">// Y.log(name + &#39; provides worker skipping done: &#39; + mm);</span>
877<span class="c"></span>                <span class="c">// }</span>
878<span class="c"></span>            <span class="o">};</span>
879
880            <span class="c">// calculate superseded modules</span>
881<span class="c"></span>            <span class="k">if</span> <span class="o">(</span><span class="nx">s</span><span class="o">)</span> <span class="o">{</span>
882                <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">i</span><span class="o">&lt;</span><span class="nx">s</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">i</span><span class="o">=</span><span class="nx">i</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
883                    <span class="nx">add</span><span class="o">(</span><span class="nx">s</span><span class="o">[</span><span class="nx">i</span><span class="o">]);</span>
884                <span class="o">}</span>
885            <span class="o">}</span>
886
887            <span class="c">// supersedes cache</span>
888<span class="c"></span>            <span class="nx">m</span><span class="o">[</span><span class="nx">SUPER</span><span class="o">]</span> <span class="o">=</span> <span class="nx">o</span><span class="o">;</span>
889            <span class="c">// provides cache</span>
890<span class="c"></span>            <span class="nx">m</span><span class="o">[</span><span class="nx">PROV</span><span class="o">]</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">merge</span><span class="o">(</span><span class="nx">o</span><span class="o">);</span>
891            <span class="nx">m</span><span class="o">[</span><span class="nx">PROV</span><span class="o">][</span><span class="nx">name</span><span class="o">]</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
892
893<span class="c">// Y.log(name + &quot; supersedes &quot; + L.dump(m[SUPER], 0));</span>
894<span class="c">// Y.log(name + &quot; provides &quot; + L.dump(m[PROV], 0));</span>
895<span class="c"></span>
896            <span class="k">return</span> <span class="nx">m</span><span class="o">[</span><span class="nx">ckey</span><span class="o">];</span>
897        <span class="o">},</span>
898
899
900        <span class="c">/**</span>
901<span class="c">         * Calculates the dependency tree, the result is stored in the sorted </span>
902<span class="c">         * property</span>
903<span class="c">         * @method calculate</span>
904<span class="c">         * @param o optional options object</span>
905<span class="c">         */</span>
906        <span class="nx">calculate</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">o</span><span class="o">)</span> <span class="o">{</span>
907            <span class="k">if</span> <span class="o">(</span><span class="nx">o</span> <span class="o">||</span> <span class="k">this</span><span class="o">.</span><span class="nx">dirty</span><span class="o">)</span> <span class="o">{</span>
908                <span class="k">this</span><span class="o">.</span><span class="nx">_config</span><span class="o">(</span><span class="nx">o</span><span class="o">);</span>
909                <span class="k">this</span><span class="o">.</span><span class="nx">_setup</span><span class="o">();</span>
910                <span class="k">this</span><span class="o">.</span><span class="nx">_explode</span><span class="o">();</span>
911                <span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">allowRollup</span><span class="o">)</span> <span class="o">{</span>
912                    <span class="k">this</span><span class="o">.</span><span class="nx">_rollup</span><span class="o">();</span>
913                <span class="o">}</span>
914                <span class="k">this</span><span class="o">.</span><span class="nx">_reduce</span><span class="o">();</span>
915                <span class="k">this</span><span class="o">.</span><span class="nx">_sort</span><span class="o">();</span>
916
917                <span class="c">// Y.log(&quot;after calculate: &quot; + this.sorted);</span>
918<span class="c"></span>
919                <span class="k">this</span><span class="o">.</span><span class="nx">dirty</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
920            <span class="o">}</span>
921        <span class="o">},</span>
922
923        <span class="c">/**</span>
924<span class="c">         * Investigates the current YUI configuration on the page.  By default,</span>
925<span class="c">         * modules already detected will not be loaded again unless a force</span>
926<span class="c">         * option is encountered.  Called by calculate()</span>
927<span class="c">         * @method _setup</span>
928<span class="c">         * @private</span>
929<span class="c">         */</span>
930        <span class="nx">_setup</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
931
932            <span class="k">var</span> <span class="nx">info</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">moduleInfo</span><span class="o">,</span> <span class="nx">name</span><span class="o">,</span> <span class="nx">i</span><span class="o">,</span> <span class="nx">j</span><span class="o">;</span>
933
934            <span class="k">var</span> <span class="nx">l</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">merge</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">inserted</span><span class="o">);</span> <span class="c">// shallow clone</span>
935<span class="c"></span>
936            <span class="c">// available modules</span>
937<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">ignoreRegistered</span><span class="o">)</span> <span class="o">{</span>
938                <span class="nx">Y</span><span class="o">.</span><span class="nx">mix</span><span class="o">(</span><span class="nx">l</span><span class="o">,</span> <span class="nx">YUI</span><span class="o">.</span><span class="nx">Env</span><span class="o">.</span><span class="nx">mods</span><span class="o">);</span>
939            <span class="o">}</span>
940           
941            <span class="c">// Y.log(&quot;Already loaded stuff: &quot; + L.dump(l, 0));</span>
942<span class="c"></span>
943            <span class="c">// add the ignore list to the list of loaded packages</span>
944<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">ignore</span><span class="o">)</span> <span class="o">{</span>
945                <span class="c">// OU.appendArray(l, this.ignore);</span>
946<span class="c"></span>                <span class="nx">Y</span><span class="o">.</span><span class="nx">mix</span><span class="o">(</span><span class="nx">l</span><span class="o">,</span> <span class="nx">Y</span><span class="o">.</span><span class="nb">Array</span><span class="o">.</span><span class="nx">hash</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">ignore</span><span class="o">));</span>
947            <span class="o">}</span>
948
949            <span class="c">// expand the list to include superseded modules</span>
950<span class="c"></span>            <span class="k">for</span> <span class="o">(</span><span class="nx">j</span> <span class="k">in</span> <span class="nx">l</span><span class="o">)</span> <span class="o">{</span>
951                <span class="c">// Y.log(&quot;expanding: &quot; + j);</span>
952<span class="c"></span>                <span class="k">if</span> <span class="o">(</span><span class="nx">l</span><span class="o">.</span><span class="nx">hasOwnProperty</span><span class="o">(</span><span class="nx">j</span><span class="o">))</span> <span class="o">{</span>
953                    <span class="nx">Y</span><span class="o">.</span><span class="nx">mix</span><span class="o">(</span><span class="nx">l</span><span class="o">,</span> <span class="k">this</span><span class="o">.</span><span class="nx">getProvides</span><span class="o">(</span><span class="nx">j</span><span class="o">));</span>
954                <span class="o">}</span>
955            <span class="o">}</span>
956
957            <span class="c">// remove modules on the force list from the loaded list</span>
958<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">force</span><span class="o">)</span> <span class="o">{</span>
959                <span class="k">for</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">i</span><span class="o">&lt;</span><span class="k">this</span><span class="o">.</span><span class="nx">force</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">i</span><span class="o">=</span><span class="nx">i</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
960                    <span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">force</span><span class="o">[</span><span class="nx">i</span><span class="o">]</span> <span class="k">in</span> <span class="nx">l</span><span class="o">)</span> <span class="o">{</span>
961                        <span class="nx">delete</span> <span class="nx">l</span><span class="o">[</span><span class="k">this</span><span class="o">.</span><span class="nx">force</span><span class="o">[</span><span class="nx">i</span><span class="o">]];</span>
962                    <span class="o">}</span>
963                <span class="o">}</span>
964            <span class="o">}</span>
965
966            <span class="c">// Y.log(&quot;loaded expanded: &quot; + L.dump(l, 0));</span>
967<span class="c"></span>
968            <span class="k">this</span><span class="o">.</span><span class="nx">loaded</span> <span class="o">=</span> <span class="nx">l</span><span class="o">;</span>
969
970        <span class="o">},</span>
971       
972
973        <span class="c">/**</span>
974<span class="c">         * Inspects the required modules list looking for additional </span>
975<span class="c">         * dependencies.  Expands the required list to include all </span>
976<span class="c">         * required modules.  Called by calculate()</span>
977<span class="c">         * @method _explode</span>
978<span class="c">         * @private</span>
979<span class="c">         */</span>
980        <span class="nx">_explode</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
981
982            <span class="k">var</span> <span class="nx">r</span><span class="o">=</span><span class="k">this</span><span class="o">.</span><span class="nx">required</span><span class="o">,</span> <span class="nx">i</span><span class="o">,</span> <span class="nx">mod</span><span class="o">;</span>
983
984            <span class="k">for</span> <span class="o">(</span><span class="nx">i</span> <span class="k">in</span> <span class="nx">r</span><span class="o">)</span> <span class="o">{</span>
985                <span class="k">if</span> <span class="o">(</span><span class="nx">r</span><span class="o">.</span><span class="nx">hasOwnProperty</span><span class="o">(</span><span class="nx">i</span><span class="o">))</span> <span class="o">{</span>
986                    <span class="nx">mod</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">getModule</span><span class="o">(</span><span class="nx">i</span><span class="o">);</span>
987                    <span class="c">// Y.log(&#39;exploding &#39; + i);</span>
988<span class="c"></span>
989                    <span class="k">var</span> <span class="nx">req</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">getRequires</span><span class="o">(</span><span class="nx">mod</span><span class="o">);</span>
990
991                    <span class="k">if</span> <span class="o">(</span><span class="nx">req</span><span class="o">)</span> <span class="o">{</span>
992                        <span class="c">// Y.log(&#39;via explode: &#39; + req);</span>
993<span class="c"></span>                        <span class="nx">Y</span><span class="o">.</span><span class="nx">mix</span><span class="o">(</span><span class="nx">r</span><span class="o">,</span> <span class="nx">Y</span><span class="o">.</span><span class="nb">Array</span><span class="o">.</span><span class="nx">hash</span><span class="o">(</span><span class="nx">req</span><span class="o">));</span>
994                    <span class="o">}</span>
995                <span class="o">}</span>
996            <span class="o">}</span>
997        <span class="o">},</span>
998
999        <span class="nx">getModule</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">name</span><span class="o">)</span> <span class="o">{</span>
1000
1001            <span class="k">var</span> <span class="nx">m</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">moduleInfo</span><span class="o">[</span><span class="nx">name</span><span class="o">];</span>
1002
1003            <span class="c">// create the default module</span>
1004<span class="c"></span>            <span class="c">// if (!m) {</span>
1005<span class="c"></span>                <span class="c">// Y.log(&#39;Module does not exist: &#39; + name + &#39;, creating with defaults&#39;);</span>
1006<span class="c"></span>                <span class="c">// m = this.addModule({ext: false}, name);</span>
1007<span class="c"></span>            <span class="c">// }</span>
1008<span class="c"></span>
1009            <span class="k">return</span> <span class="nx">m</span><span class="o">;</span>
1010        <span class="o">},</span>
1011
1012        <span class="c">/**</span>
1013<span class="c">         * Look for rollup packages to determine if all of the modules a</span>
1014<span class="c">         * rollup supersedes are required.  If so, include the rollup to</span>
1015<span class="c">         * help reduce the total number of connections required.  Called</span>
1016<span class="c">         * by calculate()</span>
1017<span class="c">         * @method _rollup</span>
1018<span class="c">         * @private</span>
1019<span class="c">         */</span>
1020        <span class="nx">_rollup</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
1021            <span class="k">var</span> <span class="nx">i</span><span class="o">,</span> <span class="nx">j</span><span class="o">,</span> <span class="nx">m</span><span class="o">,</span> <span class="nx">s</span><span class="o">,</span> <span class="nx">rollups</span><span class="o">={},</span> <span class="nx">r</span><span class="o">=</span><span class="k">this</span><span class="o">.</span><span class="nx">required</span><span class="o">,</span> <span class="nx">roll</span><span class="o">,</span>
1022                <span class="nx">info</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">moduleInfo</span><span class="o">;</span>
1023
1024            <span class="c">// find and cache rollup modules</span>
1025<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">dirty</span> <span class="o">||</span> <span class="o">!</span><span class="k">this</span><span class="o">.</span><span class="nx">rollups</span><span class="o">)</span> <span class="o">{</span>
1026                <span class="k">for</span> <span class="o">(</span><span class="nx">i</span> <span class="k">in</span> <span class="nx">info</span><span class="o">)</span> <span class="o">{</span>
1027                    <span class="k">if</span> <span class="o">(</span><span class="nx">info</span><span class="o">.</span><span class="nx">hasOwnProperty</span><span class="o">(</span><span class="nx">i</span><span class="o">))</span> <span class="o">{</span>
1028                        <span class="nx">m</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">getModule</span><span class="o">(</span><span class="nx">i</span><span class="o">);</span>
1029                        <span class="c">// if (m &amp;&amp; m.rollup &amp;&amp; m.supersedes) {</span>
1030<span class="c"></span>                        <span class="k">if</span> <span class="o">(</span><span class="nx">m</span> <span class="o">&amp;&amp;</span> <span class="nx">m</span><span class="o">.</span><span class="nx">rollup</span><span class="o">)</span> <span class="o">{</span>
1031                            <span class="nx">rollups</span><span class="o">[</span><span class="nx">i</span><span class="o">]</span> <span class="o">=</span> <span class="nx">m</span><span class="o">;</span>
1032                        <span class="o">}</span>
1033                    <span class="o">}</span>
1034                <span class="o">}</span>
1035
1036                <span class="k">this</span><span class="o">.</span><span class="nx">rollups</span> <span class="o">=</span> <span class="nx">rollups</span><span class="o">;</span>
1037            <span class="o">}</span>
1038
1039            <span class="c">// make as many passes as needed to pick up rollup rollups</span>
1040<span class="c"></span>            <span class="k">for</span> <span class="o">(;;)</span> <span class="o">{</span>
1041                <span class="k">var</span> <span class="nx">rolled</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
1042
1043                <span class="c">// go through the rollup candidates</span>
1044<span class="c"></span>                <span class="k">for</span> <span class="o">(</span><span class="nx">i</span> <span class="k">in</span> <span class="nx">rollups</span><span class="o">)</span> <span class="o">{</span> 
1045
1046                    <span class="c">// there can be only one</span>
1047<span class="c"></span>                    <span class="k">if</span> <span class="o">(!</span><span class="nx">r</span><span class="o">[</span><span class="nx">i</span><span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="k">this</span><span class="o">.</span><span class="nx">loaded</span><span class="o">[</span><span class="nx">i</span><span class="o">])</span> <span class="o">{</span>
1048                        <span class="nx">m</span> <span class="o">=</span><span class="k">this</span><span class="o">.</span><span class="nx">getModule</span><span class="o">(</span><span class="nx">i</span><span class="o">);</span> <span class="nx">s</span> <span class="o">=</span> <span class="nx">m</span><span class="o">.</span><span class="nx">supersedes</span> <span class="o">||[];</span> <span class="nx">roll</span><span class="o">=</span><span class="kc">false</span><span class="o">;</span>
1049
1050                        <span class="k">if</span> <span class="o">(!</span><span class="nx">m</span><span class="o">.</span><span class="nx">rollup</span><span class="o">)</span> <span class="o">{</span>
1051                            <span class="k">continue</span><span class="o">;</span>
1052                        <span class="o">}</span>
1053
1054                        <span class="k">var</span> <span class="nx">c</span><span class="o">=</span><span class="m">0</span><span class="o">;</span>
1055
1056                        <span class="c">// check the threshold</span>
1057<span class="c"></span>                        <span class="k">for</span> <span class="o">(</span><span class="nx">j</span><span class="o">=</span><span class="m">0</span><span class="o">;</span><span class="nx">j</span><span class="o">&lt;</span><span class="nx">s</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span><span class="nx">j</span><span class="o">=</span><span class="nx">j</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
1058
1059                            <span class="c">// if the superseded module is loaded, we can&#39;t load the rollup</span>
1060<span class="c"></span>                            <span class="c">// if (this.loaded[s[j]] &amp;&amp; (!_Y.dupsAllowed[s[j]])) {</span>
1061<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">loaded</span><span class="o">[</span><span class="nx">s</span><span class="o">[</span><span class="nx">j</span><span class="o">]])</span> <span class="o">{</span>
1062                                <span class="nx">roll</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
1063                                <span class="k">break</span><span class="o">;</span>
1064                            <span class="c">// increment the counter if this module is required.  if we are</span>
1065<span class="c"></span>                            <span class="c">// beyond the rollup threshold, we will use the rollup module</span>
1066<span class="c"></span>                            <span class="o">}</span> <span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">r</span><span class="o">[</span><span class="nx">s</span><span class="o">[</span><span class="nx">j</span><span class="o">]])</span> <span class="o">{</span>
1067                                <span class="nx">c</span><span class="o">++;</span>
1068                                <span class="nx">roll</span> <span class="o">=</span> <span class="o">(</span><span class="nx">c</span> <span class="o">&gt;=</span> <span class="nx">m</span><span class="o">.</span><span class="nx">rollup</span><span class="o">);</span>
1069                                <span class="k">if</span> <span class="o">(</span><span class="nx">roll</span><span class="o">)</span> <span class="o">{</span>
1070                                    <span class="c">// Y.log(&quot;over thresh &quot; + c + &quot;, &quot; + L.dump(r));</span>
1071<span class="c"></span>                                    <span class="k">break</span><span class="o">;</span>
1072                                <span class="o">}</span>
1073                            <span class="o">}</span>
1074                        <span class="o">}</span>
1075
1076                        <span class="k">if</span> <span class="o">(</span><span class="nx">roll</span><span class="o">)</span> <span class="o">{</span>
1077                            <span class="c">// Y.log(&quot;rollup: &quot; +  i + &quot;, &quot; + L.dump(this, 1));</span>
1078<span class="c"></span>                            <span class="c">// add the rollup</span>
1079<span class="c"></span>                            <span class="nx">r</span><span class="o">[</span><span class="nx">i</span><span class="o">]</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
1080                            <span class="nx">rolled</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
1081
1082                            <span class="c">// expand the rollup&#39;s dependencies</span>
1083<span class="c"></span>                            <span class="k">this</span><span class="o">.</span><span class="nx">getRequires</span><span class="o">(</span><span class="nx">m</span><span class="o">);</span>
1084                        <span class="o">}</span>
1085                    <span class="o">}</span>
1086                <span class="o">}</span>
1087
1088                <span class="c">// if we made it here w/o rolling up something, we are done</span>
1089<span class="c"></span>                <span class="k">if</span> <span class="o">(!</span><span class="nx">rolled</span><span class="o">)</span> <span class="o">{</span>
1090                    <span class="k">break</span><span class="o">;</span>
1091                <span class="o">}</span>
1092            <span class="o">}</span>
1093        <span class="o">},</span>
1094
1095        <span class="c">/**</span>
1096<span class="c">         * Remove superceded modules and loaded modules.  Called by</span>
1097<span class="c">         * calculate() after we have the mega list of all dependencies</span>
1098<span class="c">         * @method _reduce</span>
1099<span class="c">         * @private</span>
1100<span class="c">         */</span>
1101        <span class="nx">_reduce</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
1102
1103            <span class="k">var</span> <span class="nx">i</span><span class="o">,</span> <span class="nx">j</span><span class="o">,</span> <span class="nx">s</span><span class="o">,</span> <span class="nx">m</span><span class="o">,</span> <span class="nx">r</span><span class="o">=</span><span class="k">this</span><span class="o">.</span><span class="nx">required</span><span class="o">;</span>
1104            <span class="k">for</span> <span class="o">(</span><span class="nx">i</span> <span class="k">in</span> <span class="nx">r</span><span class="o">)</span> <span class="o">{</span>
1105
1106                <span class="c">// remove if already loaded</span>
1107<span class="c"></span>                <span class="k">if</span> <span class="o">(</span><span class="nx">i</span> <span class="k">in</span> <span class="k">this</span><span class="o">.</span><span class="nx">loaded</span><span class="o">)</span> <span class="o">{</span> 
1108                    <span class="nx">delete</span> <span class="nx">r</span><span class="o">[</span><span class="nx">i</span><span class="o">];</span>
1109
1110                <span class="c">// remove anything this module supersedes</span>
1111<span class="c"></span>                <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
1112
1113                     <span class="nx">m</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">getModule</span><span class="o">(</span><span class="nx">i</span><span class="o">);</span>
1114                     <span class="nx">s</span> <span class="o">=</span> <span class="nx">m</span> <span class="o">&amp;&amp;</span> <span class="nx">m</span><span class="o">.</span><span class="nx">supersedes</span><span class="o">;</span>
1115                     <span class="k">if</span> <span class="o">(</span><span class="nx">s</span><span class="o">)</span> <span class="o">{</span>
1116                         <span class="k">for</span> <span class="o">(</span><span class="nx">j</span><span class="o">=</span><span class="m">0</span><span class="o">;</span> <span class="nx">j</span><span class="o">&lt;</span><span class="nx">s</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">j</span><span class="o">=</span><span class="nx">j</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
1117                             <span class="k">if</span> <span class="o">(</span><span class="nx">s</span><span class="o">[</span><span class="nx">j</span><span class="o">]</span> <span class="k">in</span> <span class="nx">r</span><span class="o">)</span> <span class="o">{</span>
1118                                 <span class="nx">delete</span> <span class="nx">r</span><span class="o">[</span><span class="nx">s</span><span class="o">[</span><span class="nx">j</span><span class="o">]];</span>
1119                             <span class="o">}</span>
1120                         <span class="o">}</span>
1121                     <span class="o">}</span>
1122                <span class="o">}</span>
1123            <span class="o">}</span>
1124        <span class="o">},</span>
1125
1126        <span class="nx">_attach</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
1127
1128            <span class="c">// this is the full list of items the YUI needs attached,</span>
1129<span class="c"></span>            <span class="c">// which is needed if some dependencies are already on</span>
1130<span class="c"></span>            <span class="c">// the page without their dependencies.</span>
1131<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">attaching</span><span class="o">)</span> <span class="o">{</span>
1132                <span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;attaching Y supplied deps: &#39;</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">attaching</span><span class="o">,</span> <span class="s2">&quot;info&quot;</span><span class="o">,</span> <span class="s2">&quot;loader&quot;</span><span class="o">);</span>
1133                <span class="nx">Y</span><span class="o">.</span><span class="nx">_attach</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">attaching</span><span class="o">);</span>
1134            <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
1135                <span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;attaching sorted list: &#39;</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">sorted</span><span class="o">,</span> <span class="s2">&quot;info&quot;</span><span class="o">,</span> <span class="s2">&quot;loader&quot;</span><span class="o">);</span>
1136                <span class="nx">Y</span><span class="o">.</span><span class="nx">_attach</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">sorted</span><span class="o">);</span>
1137            <span class="o">}</span>
1138
1139            <span class="k">this</span><span class="o">.</span><span class="nx">_pushEvents</span><span class="o">();</span>
1140
1141        <span class="o">},</span>
1142
1143        <span class="nx">_onSuccess</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
1144
1145            <span class="k">this</span><span class="o">.</span><span class="nx">_attach</span><span class="o">();</span>
1146
1147            <span class="k">for</span> <span class="o">(</span><span class="k">var</span> <span class="nx">i</span> <span class="k">in</span> <span class="k">this</span><span class="o">.</span><span class="nx">skipped</span><span class="o">)</span> <span class="o">{</span>
1148                <span class="nx">delete</span> <span class="k">this</span><span class="o">.</span><span class="nx">inserted</span><span class="o">[</span><span class="nx">i</span><span class="o">];</span>
1149            <span class="o">}</span>
1150
1151            <span class="k">this</span><span class="o">.</span><span class="nx">skipped</span> <span class="o">=</span> <span class="o">{};</span>
1152
1153            <span class="c">// this.fire(&#39;success&#39;, {</span>
1154<span class="c"></span>            <span class="c">//     data: this.data</span>
1155<span class="c"></span>            <span class="c">// });</span>
1156<span class="c"></span>
1157            <span class="k">var</span> <span class="nx">f</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">onSuccess</span><span class="o">;</span>
1158            <span class="k">if</span> <span class="o">(</span><span class="nx">f</span><span class="o">)</span> <span class="o">{</span>
1159                <span class="nx">f</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">context</span><span class="o">,</span> <span class="o">{</span>
1160                    <span class="nx">msg</span><span class="o">:</span> <span class="s1">&#39;success&#39;</span><span class="o">,</span>
1161                    <span class="nx">data</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">data</span><span class="o">,</span>
1162                    <span class="nx">success</span><span class="o">:</span> <span class="kc">true</span>
1163                <span class="o">});</span>
1164            <span class="o">}</span>
1165
1166        <span class="o">},</span>
1167
1168        <span class="nx">_onFailure</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">msg</span><span class="o">)</span> <span class="o">{</span>
1169            <span class="k">this</span><span class="o">.</span><span class="nx">_attach</span><span class="o">();</span>
1170            <span class="c">// this.fire(&#39;failure&#39;, {</span>
1171<span class="c"></span>            <span class="c">//     msg: &#39;operation failed: &#39; + msg,</span>
1172<span class="c"></span>            <span class="c">//     data: this.data</span>
1173<span class="c"></span>            <span class="c">// });</span>
1174<span class="c"></span>
1175            <span class="k">var</span> <span class="nx">f</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">onFailure</span><span class="o">;</span>
1176            <span class="k">if</span> <span class="o">(</span><span class="nx">f</span><span class="o">)</span> <span class="o">{</span>
1177                <span class="nx">f</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">context</span><span class="o">,</span> <span class="o">{</span>
1178                    <span class="nx">msg</span><span class="o">:</span> <span class="s1">&#39;failure: &#39;</span> <span class="o">+</span> <span class="nx">msg</span><span class="o">,</span>
1179                    <span class="nx">data</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">data</span><span class="o">,</span>
1180                    <span class="nx">success</span><span class="o">:</span> <span class="kc">false</span>
1181                <span class="o">});</span>
1182            <span class="o">}</span>
1183        <span class="o">},</span>
1184
1185        <span class="nx">_onTimeout</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
1186            <span class="k">this</span><span class="o">.</span><span class="nx">_attach</span><span class="o">();</span>
1187
1188            <span class="c">// this.fire(&#39;timeout&#39;, {</span>
1189<span class="c"></span>            <span class="c">//     data: this.data</span>
1190<span class="c"></span>            <span class="c">// });</span>
1191<span class="c"></span>
1192            <span class="k">var</span> <span class="nx">f</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">onTimeout</span><span class="o">;</span>
1193            <span class="k">if</span> <span class="o">(</span><span class="nx">f</span><span class="o">)</span> <span class="o">{</span>
1194                <span class="nx">f</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">context</span><span class="o">,</span> <span class="o">{</span>
1195                    <span class="nx">msg</span><span class="o">:</span> <span class="s1">&#39;timeout&#39;</span><span class="o">,</span>
1196                    <span class="nx">data</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">data</span><span class="o">,</span>
1197                    <span class="nx">success</span><span class="o">:</span> <span class="kc">false</span>
1198                <span class="o">});</span>
1199            <span class="o">}</span>
1200        <span class="o">},</span>
1201       
1202        <span class="c">/**</span>
1203<span class="c">         * Sorts the dependency tree.  The last step of calculate()</span>
1204<span class="c">         * @method _sort</span>
1205<span class="c">         * @private</span>
1206<span class="c">         */</span>
1207        <span class="nx">_sort</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
1208            <span class="c">// create an indexed list</span>
1209<span class="c"></span>            <span class="k">var</span> <span class="nx">s</span><span class="o">=</span><span class="nx">Y</span><span class="o">.</span><span class="nb">Object</span><span class="o">.</span><span class="nx">keys</span><span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">required</span><span class="o">),</span> <span class="nx">info</span><span class="o">=</span><span class="k">this</span><span class="o">.</span><span class="nx">moduleInfo</span><span class="o">,</span> <span class="nx">loaded</span><span class="o">=</span><span class="k">this</span><span class="o">.</span><span class="nx">loaded</span><span class="o">,</span>
1210                <span class="nx">me</span> <span class="o">=</span> <span class="k">this</span><span class="o">;</span>
1211
1212            <span class="c">// returns true if b is not loaded, and is required</span>
1213<span class="c"></span>            <span class="c">// directly or by means of modules it supersedes.</span>
1214<span class="c"></span>            <span class="k">var</span> <span class="nx">requires</span> <span class="o">=</span> <span class="k">function</span><span class="o">(</span><span class="nx">aa</span><span class="o">,</span> <span class="nx">bb</span><span class="o">)</span> <span class="o">{</span>
1215
1216                <span class="k">var</span> <span class="nx">mm</span><span class="o">=</span><span class="nx">info</span><span class="o">[</span><span class="nx">aa</span><span class="o">];</span>
1217
1218                <span class="k">if</span> <span class="o">(</span><span class="nx">loaded</span><span class="o">[</span><span class="nx">bb</span><span class="o">]</span> <span class="o">||</span> <span class="o">!</span><span class="nx">mm</span><span class="o">)</span> <span class="o">{</span>
1219                    <span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
1220                <span class="o">}</span>
1221
1222                <span class="k">var</span> <span class="nx">ii</span><span class="o">,</span> <span class="nx">rr</span> <span class="o">=</span> <span class="nx">mm</span><span class="o">.</span><span class="nx">expanded</span><span class="o">,</span> 
1223                    <span class="nx">after</span> <span class="o">=</span> <span class="nx">mm</span><span class="o">.</span><span class="nx">after</span><span class="o">,</span> <span class="nx">other</span><span class="o">=</span><span class="nx">info</span><span class="o">[</span><span class="nx">bb</span><span class="o">];</span>
1224
1225                <span class="c">// check if this module requires the other directly</span>
1226<span class="c"></span>                <span class="k">if</span> <span class="o">(</span><span class="nx">rr</span> <span class="o">&amp;&amp;</span> <span class="nx">Y</span><span class="o">.</span><span class="nb">Array</span><span class="o">.</span><span class="nx">indexOf</span><span class="o">(</span><span class="nx">rr</span><span class="o">,</span> <span class="nx">bb</span><span class="o">)</span> <span class="o">&gt;</span> <span class="o">-</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
1227                    <span class="k">return</span> <span class="kc">true</span><span class="o">;</span>
1228                <span class="o">}</span>
1229
1230                <span class="c">// check if this module should be sorted after the other</span>
1231<span class="c"></span>                <span class="k">if</span> <span class="o">(</span><span class="nx">after</span> <span class="o">&amp;&amp;</span> <span class="nx">Y</span><span class="o">.</span><span class="nb">Array</span><span class="o">.</span><span class="nx">indexOf</span><span class="o">(</span><span class="nx">after</span><span class="o">,</span> <span class="nx">bb</span><span class="o">)</span> <span class="o">&gt;</span> <span class="o">-</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
1232                    <span class="k">return</span> <span class="kc">true</span><span class="o">;</span>
1233                <span class="o">}</span>
1234
1235                <span class="c">// check if this module requires one the other supersedes</span>
1236<span class="c"></span>                <span class="k">var</span> <span class="nx">ss</span><span class="o">=</span><span class="nx">info</span><span class="o">[</span><span class="nx">bb</span><span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="nx">info</span><span class="o">[</span><span class="nx">bb</span><span class="o">].</span><span class="nx">supersedes</span><span class="o">;</span>
1237                <span class="k">if</span> <span class="o">(</span><span class="nx">ss</span><span class="o">)</span> <span class="o">{</span>
1238                    <span class="k">for</span> <span class="o">(</span><span class="nx">ii</span><span class="o">=</span><span class="m">0</span><span class="o">;</span> <span class="nx">ii</span><span class="o">&lt;</span><span class="nx">ss</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">ii</span><span class="o">=</span><span class="nx">ii</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
1239                        <span class="k">if</span> <span class="o">(</span><span class="nx">requires</span><span class="o">(</span><span class="nx">aa</span><span class="o">,</span> <span class="nx">ss</span><span class="o">[</span><span class="nx">ii</span><span class="o">]))</span> <span class="o">{</span>
1240                            <span class="k">return</span> <span class="kc">true</span><span class="o">;</span>
1241                        <span class="o">}</span>
1242                    <span class="o">}</span>
1243                <span class="o">}</span>
1244
1245                <span class="c">// external css files should be sorted below yui css</span>
1246<span class="c"></span>                <span class="k">if</span> <span class="o">(</span><span class="nx">mm</span><span class="o">.</span><span class="nx">ext</span> <span class="o">&amp;&amp;</span> <span class="nx">mm</span><span class="o">.</span><span class="nx">type</span> <span class="o">==</span> <span class="nx">CSS</span> <span class="o">&amp;&amp;</span> <span class="o">(!</span><span class="nx">other</span><span class="o">.</span><span class="nx">ext</span><span class="o">))</span> <span class="o">{</span>
1247                    <span class="k">return</span> <span class="kc">true</span><span class="o">;</span>
1248                <span class="o">}</span>
1249
1250                <span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
1251            <span class="o">};</span>
1252
1253            <span class="c">// pointer to the first unsorted item</span>
1254<span class="c"></span>            <span class="k">var</span> <span class="nx">p</span><span class="o">=</span><span class="m">0</span><span class="o">;</span> 
1255
1256            <span class="c">// keep going until we make a pass without moving anything</span>
1257<span class="c"></span>            <span class="k">for</span> <span class="o">(;;)</span> <span class="o">{</span>
1258               
1259                <span class="k">var</span> <span class="nx">l</span><span class="o">=</span><span class="nx">s</span><span class="o">.</span><span class="nx">length</span><span class="o">,</span> <span class="nx">a</span><span class="o">,</span> <span class="nx">b</span><span class="o">,</span> <span class="nx">j</span><span class="o">,</span> <span class="nx">k</span><span class="o">,</span> <span class="nx">moved</span><span class="o">=</span><span class="kc">false</span><span class="o">;</span>
1260
1261                <span class="c">// start the loop after items that are already sorted</span>
1262<span class="c"></span>                <span class="k">for</span> <span class="o">(</span><span class="nx">j</span><span class="o">=</span><span class="nx">p</span><span class="o">;</span> <span class="nx">j</span><span class="o">&lt;</span><span class="nx">l</span><span class="o">;</span> <span class="nx">j</span><span class="o">=</span><span class="nx">j</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
1263
1264                    <span class="c">// check the next module on the list to see if its</span>
1265<span class="c"></span>                    <span class="c">// dependencies have been met</span>
1266<span class="c"></span>                    <span class="nx">a</span> <span class="o">=</span> <span class="nx">s</span><span class="o">[</span><span class="nx">j</span><span class="o">];</span>
1267
1268                    <span class="c">// check everything below current item and move if we</span>
1269<span class="c"></span>                    <span class="c">// find a requirement for the current item</span>
1270<span class="c"></span>                    <span class="k">for</span> <span class="o">(</span><span class="nx">k</span><span class="o">=</span><span class="nx">j</span><span class="o">+</span><span class="m">1</span><span class="o">;</span> <span class="nx">k</span><span class="o">&lt;</span><span class="nx">l</span><span class="o">;</span> <span class="nx">k</span><span class="o">=</span><span class="nx">k</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
1271                        <span class="k">if</span> <span class="o">(</span><span class="nx">requires</span><span class="o">(</span><span class="nx">a</span><span class="o">,</span> <span class="nx">s</span><span class="o">[</span><span class="nx">k</span><span class="o">]))</span> <span class="o">{</span>
1272
1273                            <span class="c">// extract the dependency so we can move it up</span>
1274<span class="c"></span>                            <span class="nx">b</span> <span class="o">=</span> <span class="nx">s</span><span class="o">.</span><span class="nx">splice</span><span class="o">(</span><span class="nx">k</span><span class="o">,</span> <span class="m">1</span><span class="o">);</span>
1275
1276                            <span class="c">// insert the dependency above the item that </span>
1277<span class="c"></span>                            <span class="c">// requires it</span>
1278<span class="c"></span>                            <span class="nx">s</span><span class="o">.</span><span class="nx">splice</span><span class="o">(</span><span class="nx">j</span><span class="o">,</span> <span class="m">0</span><span class="o">,</span> <span class="nx">b</span><span class="o">[</span><span class="m">0</span><span class="o">]);</span>
1279
1280                            <span class="nx">moved</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
1281                            <span class="k">break</span><span class="o">;</span>
1282                        <span class="o">}</span>
1283                    <span class="o">}</span>
1284
1285                    <span class="c">// jump out of loop if we moved something</span>
1286<span class="c"></span>                    <span class="k">if</span> <span class="o">(</span><span class="nx">moved</span><span class="o">)</span> <span class="o">{</span>
1287                        <span class="k">break</span><span class="o">;</span>
1288                    <span class="c">// this item is sorted, move our pointer and keep going</span>
1289<span class="c"></span>                    <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
1290                        <span class="nx">p</span> <span class="o">=</span> <span class="nx">p</span> <span class="o">+</span> <span class="m">1</span><span class="o">;</span>
1291                    <span class="o">}</span>
1292                <span class="o">}</span>
1293
1294                <span class="c">// when we make it here and moved is false, we are </span>
1295<span class="c"></span>                <span class="c">// finished sorting</span>
1296<span class="c"></span>                <span class="k">if</span> <span class="o">(!</span><span class="nx">moved</span><span class="o">)</span> <span class="o">{</span>
1297                    <span class="k">break</span><span class="o">;</span>
1298                <span class="o">}</span>
1299
1300            <span class="o">}</span>
1301
1302            <span class="k">this</span><span class="o">.</span><span class="nx">sorted</span> <span class="o">=</span> <span class="nx">s</span><span class="o">;</span>
1303        <span class="o">},</span>
1304
1305        <span class="c">/**</span>
1306<span class="c">         * inserts the requested modules and their dependencies.  </span>
1307<span class="c">         * &lt;code&gt;type&lt;/code&gt; can be &quot;js&quot; or &quot;css&quot;.  Both script and </span>
1308<span class="c">         * css are inserted if type is not provided.</span>
1309<span class="c">         * @method insert</span>
1310<span class="c">         * @param o optional options object</span>
1311<span class="c">         * @param type {string} the type of dependency to insert</span>
1312<span class="c">         */</span>
1313        <span class="nx">insert</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">type</span><span class="o">)</span> <span class="o">{</span>
1314
1315            <span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Insert() &#39;</span> <span class="o">+</span> <span class="o">(</span><span class="nx">type</span> <span class="o">||</span> <span class="s1">&#39;&#39;</span><span class="o">),</span> <span class="s2">&quot;info&quot;</span><span class="o">,</span> <span class="s2">&quot;loader&quot;</span><span class="o">);</span>
1316
1317            <span class="c">// build the dependency list</span>
1318<span class="c"></span>            <span class="k">this</span><span class="o">.</span><span class="nx">calculate</span><span class="o">(</span><span class="nx">o</span><span class="o">);</span>
1319
1320            <span class="k">if</span> <span class="o">(!</span><span class="nx">type</span><span class="o">)</span> <span class="o">{</span>
1321                <span class="c">// Y.log(&quot;trying to load css first&quot;);</span>
1322<span class="c"></span>                <span class="k">var</span> <span class="nx">self</span> <span class="o">=</span> <span class="k">this</span><span class="o">;</span>
1323                <span class="k">this</span><span class="o">.</span><span class="nx">_internalCallback</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
1324                            <span class="nx">self</span><span class="o">.</span><span class="nx">_internalCallback</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
1325                            <span class="nx">self</span><span class="o">.</span><span class="nx">insert</span><span class="o">(</span><span class="kc">null</span><span class="o">,</span> <span class="nx">JS</span><span class="o">);</span>
1326                        <span class="o">};</span>
1327                <span class="k">this</span><span class="o">.</span><span class="nx">insert</span><span class="o">(</span><span class="kc">null</span><span class="o">,</span> <span class="nx">CSS</span><span class="o">);</span>
1328                <span class="k">return</span><span class="o">;</span>
1329            <span class="o">}</span>
1330
1331            <span class="c">// set a flag to indicate the load has started</span>
1332<span class="c"></span>            <span class="k">this</span><span class="o">.</span><span class="nx">_loading</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
1333
1334            <span class="c">// flag to indicate we are done with the combo service</span>
1335<span class="c"></span>            <span class="c">// and any additional files will need to be loaded</span>
1336<span class="c"></span>            <span class="c">// individually</span>
1337<span class="c"></span>            <span class="k">this</span><span class="o">.</span><span class="nx">_combineComplete</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
1338
1339            <span class="c">// keep the loadType (js, css or undefined) cached</span>
1340<span class="c"></span>            <span class="k">this</span><span class="o">.</span><span class="nx">loadType</span> <span class="o">=</span> <span class="nx">type</span><span class="o">;</span>
1341
1342            <span class="c">// start the load</span>
1343<span class="c"></span>            <span class="k">this</span><span class="o">.</span><span class="nx">loadNext</span><span class="o">();</span>
1344
1345        <span class="o">},</span>
1346
1347        <span class="c">/**</span>
1348<span class="c">         * Executed every time a module is loaded, and if we are in a load</span>
1349<span class="c">         * cycle, we attempt to load the next script.  Public so that it</span>
1350<span class="c">         * is possible to call this if using a method other than</span>
1351<span class="c">         * Y.register to determine when scripts are fully loaded</span>
1352<span class="c">         * @method loadNext</span>
1353<span class="c">         * @param mname {string} optional the name of the module that has</span>
1354<span class="c">         * been loaded (which is usually why it is time to load the next</span>
1355<span class="c">         * one)</span>
1356<span class="c">         */</span>
1357        <span class="nx">loadNext</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">mname</span><span class="o">)</span> <span class="o">{</span>
1358
1359            <span class="c">// It is possible that this function is executed due to something</span>
1360<span class="c"></span>            <span class="c">// else one the page loading a YUI module.  Only react when we</span>
1361<span class="c"></span>            <span class="c">// are actively loading something</span>
1362<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">_loading</span><span class="o">)</span> <span class="o">{</span>
1363                <span class="k">return</span><span class="o">;</span>
1364            <span class="o">}</span>
1365
1366            <span class="k">var</span> <span class="nx">s</span><span class="o">,</span> <span class="nx">len</span><span class="o">,</span> <span class="nx">i</span><span class="o">,</span> <span class="nx">m</span><span class="o">,</span> <span class="nx">url</span><span class="o">,</span> <span class="nx">self</span><span class="o">=</span><span class="k">this</span><span class="o">;</span>
1367
1368            <span class="c">// @TODO this will need to handle the two phase insert when</span>
1369<span class="c"></span>            <span class="c">// CSS support is added</span>
1370<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">loadType</span> <span class="o">!==</span> <span class="nx">CSS</span> <span class="o">&amp;&amp;</span> <span class="k">this</span><span class="o">.</span><span class="nx">combine</span> <span class="o">&amp;&amp;</span> <span class="o">(!</span><span class="k">this</span><span class="o">.</span><span class="nx">_combineComplete</span><span class="o">))</span> <span class="o">{</span>
1371
1372                <span class="k">this</span><span class="o">.</span><span class="nx">_combining</span> <span class="o">=</span> <span class="o">[];</span> 
1373                <span class="nx">s</span><span class="o">=</span><span class="k">this</span><span class="o">.</span><span class="nx">sorted</span><span class="o">;</span>
1374                <span class="nx">len</span><span class="o">=</span><span class="nx">s</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span>
1375                <span class="nx">url</span><span class="o">=</span><span class="k">this</span><span class="o">.</span><span class="nx">comboBase</span><span class="o">;</span>
1376
1377                <span class="k">for</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">i</span><span class="o">&lt;</span><span class="nx">len</span><span class="o">;</span> <span class="nx">i</span><span class="o">=</span><span class="nx">i</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
1378                    <span class="nx">m</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">getModule</span><span class="o">(</span><span class="nx">s</span><span class="o">[</span><span class="nx">i</span><span class="o">]);</span>
1379<span class="c">// @TODO we can&#39;t combine CSS yet until we deliver files with absolute paths to the assets</span>
1380<span class="c"></span>                    <span class="c">// Do not try to combine non-yui JS</span>
1381<span class="c"></span>                    <span class="k">if</span> <span class="o">(</span><span class="nx">m</span><span class="o">.</span><span class="nx">type</span> <span class="o">==</span> <span class="nx">JS</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">m</span><span class="o">.</span><span class="nx">ext</span><span class="o">)</span> <span class="o">{</span>
1382                        <span class="nx">url</span> <span class="o">+=</span> <span class="k">this</span><span class="o">.</span><span class="nx">root</span> <span class="o">+</span> <span class="nx">m</span><span class="o">.</span><span class="nx">path</span><span class="o">;</span>
1383                        <span class="k">if</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="m">1</span><span class="o">)</span> <span class="o">{</span>
1384                            <span class="nx">url</span> <span class="o">+=</span> <span class="s1">&#39;&amp;&#39;</span><span class="o">;</span>
1385                        <span class="o">}</span>
1386
1387                        <span class="k">this</span><span class="o">.</span><span class="nx">_combining</span><span class="o">.</span><span class="nx">push</span><span class="o">(</span><span class="nx">s</span><span class="o">[</span><span class="nx">i</span><span class="o">]);</span>
1388                    <span class="o">}</span>
1389                <span class="o">}</span>
1390
1391                <span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">_combining</span><span class="o">.</span><span class="nx">length</span><span class="o">)</span> <span class="o">{</span>
1392
1393<span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Attempting to combine: &#39;</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">_combining</span><span class="o">,</span> <span class="s2">&quot;info&quot;</span><span class="o">,</span> <span class="s2">&quot;loader&quot;</span><span class="o">);</span>
1394
1395                    <span class="k">var</span> <span class="nx">callback</span><span class="o">=</span><span class="k">function</span><span class="o">(</span><span class="nx">o</span><span class="o">)</span> <span class="o">{</span>
1396                        <span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Combo complete: &#39;</span> <span class="o">+</span> <span class="nx">o</span><span class="o">.</span><span class="nx">data</span><span class="o">,</span> <span class="s2">&quot;info&quot;</span><span class="o">,</span> <span class="s2">&quot;loader&quot;</span><span class="o">);</span>
1397                        <span class="k">this</span><span class="o">.</span><span class="nx">_combineComplete</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
1398
1399
1400                        <span class="k">var</span> <span class="nx">c</span><span class="o">=</span><span class="k">this</span><span class="o">.</span><span class="nx">_combining</span><span class="o">,</span> <span class="nx">len</span><span class="o">=</span><span class="nx">c</span><span class="o">.</span><span class="nx">length</span><span class="o">,</span> <span class="nx">i</span><span class="o">,</span> <span class="nx">m</span><span class="o">;</span>
1401                        <span class="k">for</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">i</span><span class="o">&lt;</span><span class="nx">len</span><span class="o">;</span> <span class="nx">i</span><span class="o">=</span><span class="nx">i</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
1402                            <span class="k">this</span><span class="o">.</span><span class="nx">inserted</span><span class="o">[</span><span class="nx">c</span><span class="o">[</span><span class="nx">i</span><span class="o">]]</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
1403                        <span class="o">}</span>
1404
1405                        <span class="k">this</span><span class="o">.</span><span class="nx">loadNext</span><span class="o">(</span><span class="nx">o</span><span class="o">.</span><span class="nx">data</span><span class="o">);</span>
1406                    <span class="o">};</span>
1407
1408                    <span class="c">// @TODO get rid of the redundant Get code</span>
1409<span class="c"></span>                    <span class="nx">Y</span><span class="o">.</span><span class="nx">Get</span><span class="o">.</span><span class="nx">script</span><span class="o">(</span><span class="nx">url</span><span class="o">,</span> <span class="o">{</span>
1410                        <span class="nx">data</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">_loading</span><span class="o">,</span>
1411                        <span class="nx">onSuccess</span><span class="o">:</span> <span class="nx">callback</span><span class="o">,</span>
1412                        <span class="nx">onFailure</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onFailure</span><span class="o">,</span>
1413                        <span class="nx">onTimeout</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onTimeout</span><span class="o">,</span>
1414                        <span class="nx">insertBefore</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">insertBefore</span><span class="o">,</span>
1415                        <span class="nx">charset</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">charset</span><span class="o">,</span>
1416                        <span class="nx">timeout</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">timeout</span><span class="o">,</span>
1417                        <span class="nx">context</span><span class="o">:</span> <span class="nx">self</span> 
1418                    <span class="o">});</span>
1419
1420                    <span class="k">return</span><span class="o">;</span>
1421
1422                <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
1423                    <span class="k">this</span><span class="o">.</span><span class="nx">_combineComplete</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
1424                <span class="o">}</span>
1425            <span class="o">}</span>
1426
1427            <span class="k">if</span> <span class="o">(</span><span class="nx">mname</span><span class="o">)</span> <span class="o">{</span>
1428
1429                <span class="c">// if the module that was just loaded isn&#39;t what we were expecting,</span>
1430<span class="c"></span>                <span class="c">// continue to wait</span>
1431<span class="c"></span>                <span class="k">if</span> <span class="o">(</span><span class="nx">mname</span> <span class="o">!==</span> <span class="k">this</span><span class="o">.</span><span class="nx">_loading</span><span class="o">)</span> <span class="o">{</span>
1432                    <span class="k">return</span><span class="o">;</span>
1433                <span class="o">}</span>
1434
1435<span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">&quot;loadNext executing, just loaded &quot;</span> <span class="o">+</span> <span class="nx">mname</span> <span class="o">||</span> <span class="s2">&quot;&quot;</span><span class="o">,</span> <span class="s2">&quot;info&quot;</span><span class="o">,</span> <span class="s2">&quot;loader&quot;</span><span class="o">);</span>
1436
1437                <span class="c">// The global handler that is called when each module is loaded</span>
1438<span class="c"></span>                <span class="c">// will pass that module name to this function.  Storing this</span>
1439<span class="c"></span>                <span class="c">// data to avoid loading the same module multiple times</span>
1440<span class="c"></span>                <span class="k">this</span><span class="o">.</span><span class="nx">inserted</span><span class="o">[</span><span class="nx">mname</span><span class="o">]</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
1441
1442                <span class="c">// this.fire(&#39;progress&#39;, {</span>
1443<span class="c"></span>                <span class="c">//     name: mname,</span>
1444<span class="c"></span>                <span class="c">//     data: this.data</span>
1445<span class="c"></span>                <span class="c">// });</span>
1446<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">onProgress</span><span class="o">)</span> <span class="o">{</span>
1447                    <span class="k">this</span><span class="o">.</span><span class="nx">onProgress</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">context</span><span class="o">,</span> <span class="o">{</span>
1448                            <span class="nx">name</span><span class="o">:</span> <span class="nx">mname</span><span class="o">,</span>
1449                            <span class="nx">data</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">data</span>
1450                        <span class="o">});</span>
1451                <span class="o">}</span>
1452
1453
1454            <span class="o">}</span>
1455
1456            <span class="nx">s</span><span class="o">=</span><span class="k">this</span><span class="o">.</span><span class="nx">sorted</span><span class="o">;</span>
1457            <span class="nx">len</span><span class="o">=</span><span class="nx">s</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span>
1458
1459            <span class="k">for</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">i</span><span class="o">&lt;</span><span class="nx">len</span><span class="o">;</span> <span class="nx">i</span><span class="o">=</span><span class="nx">i</span><span class="o">+</span><span class="m">1</span><span class="o">)</span> <span class="o">{</span>
1460
1461                <span class="c">// this.inserted keeps track of what the loader has loaded.</span>
1462<span class="c"></span>                <span class="c">// move on if this item is done.</span>
1463<span class="c"></span>                <span class="k">if</span> <span class="o">(</span><span class="nx">s</span><span class="o">[</span><span class="nx">i</span><span class="o">]</span> <span class="k">in</span> <span class="k">this</span><span class="o">.</span><span class="nx">inserted</span><span class="o">)</span> <span class="o">{</span>
1464                    <span class="c">// Y.log(s[i] + &quot; alread loaded &quot;);</span>
1465<span class="c"></span>                    <span class="k">continue</span><span class="o">;</span>
1466                <span class="o">}</span>
1467
1468                <span class="c">// Because rollups will cause multiple load notifications</span>
1469<span class="c"></span>                <span class="c">// from Y, loadNext may be called multiple times for</span>
1470<span class="c"></span>                <span class="c">// the same module when loading a rollup.  We can safely</span>
1471<span class="c"></span>                <span class="c">// skip the subsequent requests</span>
1472<span class="c"></span>                <span class="k">if</span> <span class="o">(</span><span class="nx">s</span><span class="o">[</span><span class="nx">i</span><span class="o">]</span> <span class="o">===</span> <span class="k">this</span><span class="o">.</span><span class="nx">_loading</span><span class="o">)</span> <span class="o">{</span>
1473                    <span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">&quot;still loading &quot;</span> <span class="o">+</span> <span class="nx">s</span><span class="o">[</span><span class="nx">i</span><span class="o">]</span> <span class="o">+</span> <span class="s2">&quot;, waiting&quot;</span><span class="o">,</span> <span class="s2">&quot;info&quot;</span><span class="o">,</span> <span class="s2">&quot;loader&quot;</span><span class="o">);</span>
1474                    <span class="k">return</span><span class="o">;</span>
1475                <span class="o">}</span>
1476
1477                <span class="c">// log(&quot;inserting &quot; + s[i]);</span>
1478<span class="c"></span>                <span class="nx">m</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">getModule</span><span class="o">(</span><span class="nx">s</span><span class="o">[</span><span class="nx">i</span><span class="o">]);</span>
1479
1480                <span class="k">if</span> <span class="o">(!</span><span class="nx">m</span><span class="o">)</span> <span class="o">{</span>
1481
1482                    <span class="k">var</span> <span class="nx">msg</span> <span class="o">=</span> <span class="s2">&quot;Undefined module &quot;</span> <span class="o">+</span> <span class="nx">s</span><span class="o">[</span><span class="nx">i</span><span class="o">]</span> <span class="o">+</span> <span class="s2">&quot; skipped&quot;</span><span class="o">;</span>
1483                    <span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="nx">msg</span><span class="o">,</span> <span class="s1">&#39;warn&#39;</span><span class="o">,</span> <span class="s1">&#39;loader&#39;</span><span class="o">);</span>
1484                    <span class="k">this</span><span class="o">.</span><span class="nx">inserted</span><span class="o">[</span><span class="nx">s</span><span class="o">[</span><span class="nx">i</span><span class="o">]]</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
1485                    <span class="k">this</span><span class="o">.</span><span class="nx">skipped</span><span class="o">[</span><span class="nx">s</span><span class="o">[</span><span class="nx">i</span><span class="o">]]</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
1486                    <span class="k">continue</span><span class="o">;</span>
1487
1488                    <span class="c">// this.fire(&#39;failure&#39;, {</span>
1489<span class="c"></span>                        <span class="c">// msg: msg,</span>
1490<span class="c"></span>                        <span class="c">// data: this.data</span>
1491<span class="c"></span>                    <span class="c">// });</span>
1492<span class="c"></span>                <span class="o">}</span>
1493
1494
1495                <span class="c">// The load type is stored to offer the possibility to load</span>
1496<span class="c"></span>                <span class="c">// the css separately from the script.</span>
1497<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">loadType</span> <span class="o">||</span> <span class="k">this</span><span class="o">.</span><span class="nx">loadType</span> <span class="o">===</span> <span class="nx">m</span><span class="o">.</span><span class="nx">type</span><span class="o">)</span> <span class="o">{</span>
1498                    <span class="k">this</span><span class="o">.</span><span class="nx">_loading</span> <span class="o">=</span> <span class="nx">s</span><span class="o">[</span><span class="nx">i</span><span class="o">];</span>
1499                    <span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s2">&quot;attempting to load &quot;</span> <span class="o">+</span> <span class="nx">s</span><span class="o">[</span><span class="nx">i</span><span class="o">]</span> <span class="o">+</span> <span class="s2">&quot;, &quot;</span> <span class="o">+</span> <span class="k">this</span><span class="o">.</span><span class="nx">base</span><span class="o">,</span> <span class="s2">&quot;info&quot;</span><span class="o">,</span> <span class="s2">&quot;loader&quot;</span><span class="o">);</span>
1500
1501                    <span class="k">var</span> <span class="nx">fn</span><span class="o">=(</span><span class="nx">m</span><span class="o">.</span><span class="nx">type</span> <span class="o">===</span> <span class="nx">CSS</span><span class="o">)</span> <span class="o">?</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Get</span><span class="o">.</span><span class="nx">css</span> <span class="o">:</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Get</span><span class="o">.</span><span class="nx">script</span><span class="o">,</span>
1502                        <span class="nx">onsuccess</span><span class="o">=</span><span class="k">function</span><span class="o">(</span><span class="nx">o</span><span class="o">)</span> <span class="o">{</span>
1503                            <span class="c">// Y.log(&#39;loading next, just loaded&#39; + o.data);</span>
1504<span class="c"></span>                            <span class="nx">self</span><span class="o">.</span><span class="nx">loadNext</span><span class="o">(</span><span class="nx">o</span><span class="o">.</span><span class="nx">data</span><span class="o">);</span>
1505                        <span class="o">};</span>
1506                       
1507                    <span class="nx">url</span><span class="o">=</span><span class="nx">m</span><span class="o">.</span><span class="nx">fullpath</span> <span class="o">||</span> <span class="k">this</span><span class="o">.</span><span class="nx">_url</span><span class="o">(</span><span class="nx">m</span><span class="o">.</span><span class="nx">path</span><span class="o">,</span> <span class="nx">s</span><span class="o">[</span><span class="nx">i</span><span class="o">]);</span>
1508                    <span class="nx">self</span><span class="o">=</span><span class="k">this</span><span class="o">;</span> 
1509
1510                    <span class="nx">fn</span><span class="o">(</span><span class="nx">url</span><span class="o">,</span> <span class="o">{</span>
1511                        <span class="nx">data</span><span class="o">:</span> <span class="nx">s</span><span class="o">[</span><span class="nx">i</span><span class="o">],</span>
1512                        <span class="nx">onSuccess</span><span class="o">:</span> <span class="nx">onsuccess</span><span class="o">,</span>
1513                        <span class="nx">insertBefore</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">insertBefore</span><span class="o">,</span>
1514                        <span class="nx">charset</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">charset</span><span class="o">,</span>
1515                        <span class="nx">onFailure</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onFailure</span><span class="o">,</span>
1516                        <span class="nx">onTimeout</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">_onTimeout</span><span class="o">,</span>
1517                        <span class="nx">timeout</span><span class="o">:</span> <span class="k">this</span><span class="o">.</span><span class="nx">timeout</span><span class="o">,</span>
1518                        <span class="nx">context</span><span class="o">:</span> <span class="nx">self</span> 
1519                    <span class="o">});</span>
1520
1521                    <span class="k">return</span><span class="o">;</span>
1522                <span class="o">}</span>
1523            <span class="o">}</span>
1524
1525            <span class="c">// we are finished</span>
1526<span class="c"></span>            <span class="k">this</span><span class="o">.</span><span class="nx">_loading</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
1527
1528            <span class="c">// internal callback for loading css first</span>
1529<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">_internalCallback</span><span class="o">)</span> <span class="o">{</span>
1530                <span class="c">// Y.log(&#39;loader internal&#39;);</span>
1531<span class="c"></span>
1532                <span class="k">var</span> <span class="nx">f</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">_internalCallback</span><span class="o">;</span>
1533                <span class="k">this</span><span class="o">.</span><span class="nx">_internalCallback</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
1534                <span class="nx">f</span><span class="o">.</span><span class="nx">call</span><span class="o">(</span><span class="k">this</span><span class="o">);</span>
1535
1536            <span class="c">// } else if (this.onSuccess) {</span>
1537<span class="c"></span>            <span class="o">}</span> <span class="k">else</span> <span class="o">{</span>
1538                <span class="c">// Y.log(&#39;loader complete&#39;);</span>
1539<span class="c"></span>
1540                <span class="c">// call Y.use passing this instance. Y will use the sorted</span>
1541<span class="c"></span>                <span class="c">// dependency list.</span>
1542<span class="c"></span>
1543                <span class="k">this</span><span class="o">.</span><span class="nx">_onSuccess</span><span class="o">();</span>
1544
1545            <span class="o">}</span>
1546
1547        <span class="o">},</span>
1548
1549        <span class="c">/**</span>
1550<span class="c">         * In IE, the onAvailable/onDOMReady events need help when Event is</span>
1551<span class="c">         * loaded dynamically</span>
1552<span class="c">         * @method _pushEvents</span>
1553<span class="c">         * @param {Function} optional function reference</span>
1554<span class="c">         * @private</span>
1555<span class="c">         */</span>
1556        <span class="nx">_pushEvents</span><span class="o">:</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
1557            <span class="k">if</span> <span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Event</span><span class="o">)</span> <span class="o">{</span>
1558                <span class="nx">Y</span><span class="o">.</span><span class="nx">Event</span><span class="o">.</span><span class="nx">_load</span><span class="o">();</span>
1559            <span class="o">}</span>
1560        <span class="o">},</span>
1561
1562        <span class="c">/**</span>
1563<span class="c">         * Generates the full url for a module</span>
1564<span class="c">         * method _url</span>
1565<span class="c">         * @param path {string} the path fragment</span>
1566<span class="c">         * @return {string} the full url</span>
1567<span class="c">         * @private</span>
1568<span class="c">         */</span>
1569        <span class="nx">_url</span><span class="o">:</span> <span class="k">function</span><span class="o">(</span><span class="nx">path</span><span class="o">,</span> <span class="nx">name</span><span class="o">)</span> <span class="o">{</span>
1570           
1571            <span class="k">var</span> <span class="nx">u</span> <span class="o">=</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">base</span> <span class="o">||</span> <span class="s2">&quot;&quot;</span><span class="o">)</span> <span class="o">+</span> <span class="nx">path</span><span class="o">,</span> 
1572                <span class="nx">f</span> <span class="o">=</span> <span class="k">this</span><span class="o">.</span><span class="nx">filter</span><span class="o">;</span>
1573
1574            <span class="k">if</span> <span class="o">(</span><span class="nx">f</span><span class="o">)</span> <span class="o">{</span>
1575                <span class="k">var</span> <span class="nx">useFilter</span> <span class="o">=</span> <span class="kc">true</span><span class="o">;</span>
1576
1577                <span class="k">if</span> <span class="o">(</span><span class="k">this</span><span class="o">.</span><span class="nx">filterName</span> <span class="o">==</span> <span class="s2">&quot;DEBUG&quot;</span><span class="o">)</span> <span class="o">{</span>
1578               
1579                    <span class="k">var</span> <span class="nx">self</span> <span class="o">=</span> <span class="k">this</span><span class="o">,</span> 
1580                        <span class="nx">exc</span> <span class="o">=</span> <span class="nx">self</span><span class="o">.</span><span class="nx">logExclude</span><span class="o">,</span>
1581                        <span class="nx">inc</span> <span class="o">=</span> <span class="nx">self</span><span class="o">.</span><span class="nx">logInclude</span><span class="o">;</span>
1582                    <span class="k">if</span> <span class="o">(</span><span class="nx">inc</span> <span class="o">&amp;&amp;</span> <span class="o">!(</span><span class="nx">name</span> <span class="k">in</span> <span class="nx">inc</span><span class="o">))</span> <span class="o">{</span>
1583                        <span class="nx">useFilter</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
1584                    <span class="o">}</span> <span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">exc</span> <span class="o">&amp;&amp;</span> <span class="o">(</span><span class="nx">name</span> <span class="k">in</span> <span class="nx">exc</span><span class="o">))</span> <span class="o">{</span>
1585                        <span class="nx">useFilter</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
1586                    <span class="o">}</span>
1587
1588                <span class="o">}</span>
1589               
1590                <span class="c">// Y.log(&quot;filter: &quot; + f + &quot;, &quot; + f.searchExp + </span>
1591<span class="c"></span>                <span class="c">// &quot;, &quot; + f.replaceStr);</span>
1592<span class="c"></span>                <span class="k">if</span> <span class="o">(</span><span class="nx">useFilter</span><span class="o">)</span> <span class="o">{</span>
1593                    <span class="nx">u</span> <span class="o">=</span> <span class="nx">u</span><span class="o">.</span><span class="nx">replace</span><span class="o">(</span><span class="k">new</span> <span class="nb">RegExp</span><span class="o">(</span><span class="nx">f</span><span class="o">.</span><span class="nx">searchExp</span><span class="o">),</span> <span class="nx">f</span><span class="o">.</span><span class="nx">replaceStr</span><span class="o">);</span>
1594                <span class="o">}</span>
1595            <span class="o">}</span>
1596
1597            <span class="c">// Y.log(u);</span>
1598<span class="c"></span>
1599            <span class="k">return</span> <span class="nx">u</span><span class="o">;</span>
1600        <span class="o">}</span>
1601
1602    <span class="o">};</span>
1603
1604    <span class="c">// Y.augment(Y.Loader, Y.Event.Target);</span>
1605<span class="c"></span>
1606<span class="o">},</span> <span class="s2">&quot;@VERSION@&quot;</span><span class="o">);</span>
1607</pre></div>
1608                    </div>
1609                        </div>
1610                </div>
1611                <div class="yui-b">
1612            <div class="nav">
1613
1614                    <div class="module">
1615                        <h4>Modules</h4>
1616                        <ul class="content">
1617
1618                                <li class=""><a href="module_anim.html">anim</a></li>
1619
1620                                <li class=""><a href="module_attribute.html">attribute</a></li>
1621
1622                                <li class=""><a href="module_base.html">base</a></li>
1623
1624                                <li class=""><a href="module_cookie.html">cookie</a></li>
1625
1626                                <li class=""><a href="module_dd.html">dd</a></li>
1627
1628                                <li class=""><a href="module_dd-plugin.html">dd-plugin</a></li>
1629
1630                                <li class=""><a href="module_dom.html">dom</a></li>
1631
1632                                <li class=""><a href="module_dump.html">dump</a></li>
1633
1634                                <li class=""><a href="module_event.html">event</a></li>
1635
1636                                <li class=""><a href="module_io.html">io</a></li>
1637
1638                                <li class=""><a href="module_json.html">json</a></li>
1639
1640                                <li class=""><a href="module_node.html">node</a></li>
1641
1642                                <li class=""><a href="module_oop.html">oop</a></li>
1643
1644                                <li class=""><a href="module_queue.html">queue</a></li>
1645
1646                                <li class=""><a href="module_substitute.html">substitute</a></li>
1647
1648                                <li class="selected"><a href="module_yui.html">yui</a></li>
1649                        </ul>
1650                    </div>
1651
1652                    <div class="module">
1653                        <h4>Classes</h4>
1654                        <ul class="content">
1655                                <li class=""><a href="Get.html">Get</a></li>
1656                                <li class=""><a href="Lang.html">Lang</a></li>
1657                                <li class=""><a href="Loader.html">Loader</a></li>
1658                                <li class=""><a href="UA.html">UA</a></li>
1659                                <li class=""><a href="YUI.html">YUI</a></li>
1660                                <li class=""><a href="YUI~array.html">YUI~array</a></li>
1661                                <li class=""><a href="YUI~object.html">YUI~object</a></li>
1662                        </ul>
1663                    </div>
1664
1665                    <div class="module">
1666                        <h4>Files</h4>
1667                        <ul class="content">       
1668                                <li class=""><a href="get.js.html">get.js</a></li>
1669                                <li class="selected"><a href="loader.js.html">loader.js</a></li>
1670                                <li class=""><a href="yui-array.js.html">yui-array.js</a></li>
1671                                <li class=""><a href="yui-core.js.html">yui-core.js</a></li>
1672                                <li class=""><a href="yui-dump.js.html">yui-dump.js</a></li>
1673                                <li class=""><a href="yui-init.js.html">yui-init.js</a></li>
1674                                <li class=""><a href="yui-lang.js.html">yui-lang.js</a></li>
1675                                <li class=""><a href="yui-later.js.html">yui-later.js</a></li>
1676                                <li class=""><a href="yui-log.js.html">yui-log.js</a></li>
1677                                <li class=""><a href="yui-object.js.html">yui-object.js</a></li>
1678                                <li class=""><a href="yui-ua.js.html">yui-ua.js</a></li>
1679                                <li class=""><a href="yui.js.html">yui.js</a></li>
1680                        </ul>
1681                    </div>
1682
1683
1684
1685
1686
1687            </div>
1688                </div>
1689        </div>
1690        <div id="ft">
1691        <hr />
1692        Copyright &copy; 2008 Yahoo! Inc. All rights reserved.
1693        </div>
1694</div>
1695</body>
1696</html>
Note: See TracBrowser for help on using the repository browser.