index.mustache revision 4613cfd8960e141ac5d088a10bc6124df2e46f24
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<div class="intro">
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <p>The YUI module is the single core dependency for all YUI 3.x implementations. It must be included on all pages that use YUI — and it is the only dependency required to start writing YUI code. The YUI module contains loader functionality and a dependency calculator, allowing it to serve as a "seed" for your implementation. You provide the YUI module list you're using and the code that makes use of those modules; YUI will fetch all necessary components in a single, optimized HTTP request before executing your dependent code. While you may use some of the script- and CSS-loading facilities of the YUI module in your own implementation, this module's core purpose is to serve as a small seed from which complex, highly modular implementations can grow.</p>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <p>The YUI module creates a global YUI object. This object is instantiable, and it is used to create YUI instances to which are bound specific functional modules. A page can share a single YUI instance or can use different, insular instances for each piece of functionality on the page.</p>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<p>The YUI Global object is provided by one of our seed files:</p>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<h3 id="loader-seed">The Loader Seed</h3>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<script src="http://yui.yahooapis.com/{{{yuiVersion}}}/build/yui/yui-min.js"></script>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<p>This seed file contains everything you need to fetch/use YUI core modules. It includes our dynamic script loader as well as all of the meta-data required to load additional YUI modules.</p>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<h3 id="base-seed">The Base Seed</h3>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<script src="http://yui.yahooapis.com/{{{yuiVersion}}}/build/yui-base/yui-base-min.js"></script>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<p>This seed file contains the core items you need to use YUI core modules. It also includes the capability to fetch our dynamic script loader. <em>This seed was our old `yui.js`</em></p>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<h3 id="why">Why the namespace change?</h3>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li><strong>Backward Compatibility</strong>: With the change from <code>YAHOO</code> to <code>YUI</code> we are guaranteed not to break backward compatibility. This allows you to use both YUI 2.x and YUI 3.x on
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass the same page without fear of breaking existing code.</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li><strong>Sandboxing</strong>: The new YUI Global Object is now smarter than ever, allowing you to create an instance of YUI in your own namespace and only load the modules that you need.
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass It makes it easier for multiple developers to work on different parts of the page with different modules with less worry of them stepping on each other's toes.</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li><strong>Versioning</strong>: If another version of YUI is loaded on the page, it will not change objects used in
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass existing YUI instances. Both versions of YUI will operate with the corresponding versions of the reqested YUI modules without impacting each other.</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li><strong>More Dynamic</strong>: With Loader built into the core, loading files when you need them just got easier.</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li><strong>Selector Powered</strong>: Using Selector as its base for node handling, you now get more power and ease of use for free.</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li><strong>Event Normalization</strong>: With the new Event Facade, you get maximum event normalization for cleaner cross browser code.</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<h3 id="core">YUI Core</h3>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<p>The YUI Global Object is an instantiatable object that allows you to create as many YUI instances as you need. Each completely configurable and loaded with only the modules that you need.</p>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav GlassYUI().use('node', function(Y) {
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<p>All of this functionality is available in the YUI Core:</p>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <th>YUI 3 Component</th>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <th>Module</th>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <td>Array Operations</td><td>array</td>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <td>YUI Core</td><td>core</td>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <td>JavaScript language helper methods</td><td>lang</td>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <td>Periodic execution method</td><td>later</td>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <td>Logging support</td><td>log</td>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <td>Object Operations</td><td>object</td>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <td>Browser Sniffing</td><td>ua</td>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <td>YUI Object</td><td>yui</td>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <td>Dynamic script and css loading</td><td>get</td>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <td>YUI Loader</td><td>loader</td>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<h3 id="use">Use method</h3>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<p>The `use` method allows you to choose the modules that you want loaded into your YUI instance. You can pick and choose what you need, you don't have to load everything that was included on the page.</p>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav GlassYUI().use('dd-drop', 'anim', function(Y) {
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass // Y.DD is available
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass // Y.Anim is available
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav GlassYUI().use('anim', function(Y) {
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass // Y.DD is NOT available
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass // Y.Anim is available
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<h3>Use callback</h3>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<p>You can pass a function in as the last argument to <code>use</code>. This function will execute after the YUI instance loads all the modules.
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav GlassThis is required if you do not have all dependencies on the page.</p>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<p>The callback method has one argument passed, the YUI instance that we are dealing with. In this function you know that all the modules have been loaded and it's ok to use them.</p>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav GlassYUI().use('animation', function(Y) {
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass // Y.Anim is available
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<h3>Use shorthand</h3>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<p>The <code>use</code> method contains a shorthand reference for all modules on the page. It uses the <code>*</code> as the module name.</p>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<p>This will load every module that is included on the page.</p>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav GlassYUI().use('*', function(Y) {
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass // Implementation code
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<h3>Static inclusion vs. dynamic loading</h3>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<p>YUI automatically tries to complete itself when missing dependencies are detected.
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass When dynamically loading the dependencies, the callback passed to <code>use</code>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass will be executed <em>asynchronously</em>. If you statically include all of the
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass library requirements (or all were previously loaded by another means), the
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass use() callback will execute synchronously. The purpose of the callback is so
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass that it doesn't matter to the implementation whether the operation was synchronous
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass or not. Code immediately following the <code>use</code> statement will not have
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass access to any of the requested modules if anything has to be dynamically loaded.
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass You can prevent YUI from automatically trying to obtain missing dependencies by setting the
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass YUI config <code>bootstrap</code> to false.</p>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<h3 id="modulelist">Module List</h3>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<p>Here is a partial list of the modules and their descriptions.</p>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <th>YUI 3 Component</th>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <th>Module</th>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <td>Animation</td><td>anim</td>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <td>Attribute Engine</td><td>attribute</td>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <td>Class Builder</td><td>base</td>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <td>Collection Utilities</td><td>collection</td>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <td>Drag & Drop</td><td>dd</td>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <td>DOM Element Utilites</td><td>dom</td>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <td>DOM Event Utilities</td><td>event</td>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <td>Custom Event Engine</td><td>event-custom</td>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <td>IO (XHR/XDR)</td><td>io</td>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <td>JSON</td><td>json</td>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <td>HTML Element Wrapper</td><td>node</td>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <td>Support for non-blocking iterative operations</td><td>async-queue</td>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<h3 id="yuiadd">Creating Custom Modules with YUI.add</h3>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<p><code>YUI.add</code> is a static global method that is
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glassthe single entry point for first class YUI modules. This method
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glassregisters the module so that it can attached to a YUI instance
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glassvia the <code>use</code> method. Modules registered this way
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glassare dynamically attached during the <code>use</code> phase, so
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glassthey can be fully protected by the YUI sandbox.</p>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<p>During the <code>use</code> phase, the function passed to
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<code>YUI.add</code> is executed. It receives the YUI instance
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glassas a parameter, and this can be used to add functionality to
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glassthe instance.</p>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<p>While you can add the module wrapper to your code yourself,
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glassthe <a href="http://yuilibrary.com/projects/builder">YUI Build Tool</a>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glasscan wrap your code for you (it can also minify and lint your code, among
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glassother things).
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<p>The third parameter is a version identifier for your module. This
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glassis not the YUI version you are targeting</p>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<p>The fourth parameter is an optional metadata object. This is read
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glassby YUI when <code>YUI.add</code> executes -- it is used to fill in the
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glassdependency information if this information was not previously provided
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glassin the loader metadata provided to the YUI instance. See below for
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glassinformation about dynamically loading modules. Dependencies are declared
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glassvia the <code>requires</code> attribute. The <code>use</code> attribute
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glassdescribes a module/submodule relationship -- when you build a YUI
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glassmodule with submodules, the built module file will have the entire
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav GlassYUI.add wrapped content for each submodule. The <code>use</code> attribute
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glassinforms YUI that these modules must be used when the parent module is.
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav GlassYUI.add('mymodules-mod1', function(Y) {
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass Y.namespace('mynamespace');
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass // expose an API
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass}, '0.1.1' /* module version */, {
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass requires: ['base']
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<h3 id="loader">Loader</h3>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<p>Loader's functionality is now built into the YUI Global Object
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass (as long as it's on the page) and puts its power behind the
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <code>YUI().use</code> method.</p>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<p>If you request a module that is not loaded on the page
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass(or a dependency that is not loaded), loader will fetch a copy
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glassof that module (and its dependencies) and attach them to your
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav GlassYUI instance.</p>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass lang: 'ko-KR,en-GB,zh-Hant-TW', // languages in order of preference
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass base: '../../build/', // the base path to the YUI install. Usually not needed because the default is the same base path as the yui.js include file
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass charset: 'utf-8', // specify a charset for inserted nodes, default is utf-8
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass loadOptional: true, // automatically load optional dependencies, default false
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass combine: true, // use the Yahoo! CDN combo service for YUI resources, default is true unless 'base' has been changed
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass filter: 'raw', // apply a filter to load the raw or debug version of YUI files
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass timeout: 10000, // specify the amount of time to wait for a node to finish loading before aborting
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass insertBefore: 'customstyles', // The insertion point for new nodes
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass // one or more external modules that can be loaded along side of YUI. This is the only pattern
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass // that was supported in 3.0.0 for declaring external modules. 3.1.0 adds 'groups' support,
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass // which is an easier way to define a group of modules. See below.
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass yui2_yde_datasource: {
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass fullpath: 'http://yui.yahooapis.com/combo?2.7.0/build/yahoo-dom-event/yahoo-dom-event.js&2.7.0/build/datasource/datasource-min.js'
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass fullpath: 'http://bluesmoon.github.com/yui-flot/yui.flot.js',
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass requires: ['yui2_yde_datasource']
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass // one or more groups of modules which share the same base path and
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass // combo service specification.
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass // Note, while this is a valid way to load YUI2, 3.1.0 has intrinsic
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass // YUI 2 loading built in. See the examples to learn how to use
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass // this feature.
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass combine: true,
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass root: '2.8.0r4/build/',
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass modules: { // one or more external modules that can be loaded along side of YUI
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass yui2_anim: {
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass requires: ['yui2_yde']
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass}).use('dd', 'yui_flot', function(Y) {
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass // All YUI modules required to get drag and drop to work are now loaded.
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<p>The valid configuration options for Loader are as follows:<p>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`lang`: The list of preferred languages, as BCP 47 language tags, in order of preference.
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass The loader uses this list to determine the best language to use for modules with
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass language sensitive behavior and to load the necessary resource bundles.
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass See the <a href="../intl/">Internationalization</a> module for more information.</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`base`: The base dir</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`comboBase`: The YUI combo service base dir. Ex: http://yui.yahooapis.com/combo?</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`root`: The root path to prepend to module names for the combo service. Ex: 2.5.2/build/</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`filter`: A filter to apply to result urls. This filter will modify the default
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass path for all modules. The default path for the YUI library is the
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass minified version of the files (e.g., event-min.js). The filter property
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass can be a predefined filter or a custom filter. The valid predefined
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass filters are:
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`DEBUG`: Selects the debug versions of the library (e.g., event-debug.js). </li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`RAW`: Selects the non-minified version of the library (e.g., event.js).</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass You can also define a custom filter, which must be an object literal
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass containing a search expression and a replace string:
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass myFilter: {
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass 'searchExp': "-min\\.js",
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass 'replaceStr': "-debug.js"
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`combine`: Use the YUI combo service to reduce the number of http connections required to load your dependencies</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`ignore`: A list of modules that should never be dynamically loaded</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`force`: A list of modules that should always be loaded when required, even if already present on the page</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`insertBefore`: Node or id for a node that should be used as the insertion point for new nodes</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`charset`: charset for dynamic nodes</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`jsAttributes`: attributes to apply to dynamic script nodes</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`cssAttributes`: attributes to apply to dynamic link nodes</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`timeout`: number of milliseconds before a timeout occurs when dynamically loading nodes. in not set, there is no timeout</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`context`: execution context for all callbacks</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`modules`: A list of module definitions. The valid module configuration data is as follows:
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`name`: required, the component name</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`type`: required, the component type (js or css)</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`path`: required if fullpath is not specified, the path to the script from "base"</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`fullpath`: required if path isn't specified, the full path to the script. "base" will not be used to build the url</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`requires`: array of modules required by this component</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`optional`: array of optional modules for this component</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`supersedes`: array of the modules this component replaces</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`after`: array of modules the components which, if present, should be sorted above this one</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`rollup`: the number of superseded modules required for automatic rollup</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`lang`: array of BCP 47 language tags of languages for which this module has localized resource bundles</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`condition`: Specifies that the module should be loaded automatically if
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass a condition is met. This is an object with up to three fields:
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`trigger` - the name of a module that can trigger the auto-load</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`test` - a function that returns true when the module is to be loaded.</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`when` - specifies the load order of the conditional module with regard to the position of the trigger module.
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass This should be one of three values: `before`, `after`, or `instead`. The default is `after`.</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass <li>`groups`: in 3.1.0, the groups config was added as an enhancement over the 'modules' config. Each group can
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass the <code>base</code>, <code>comboBase</code>, <code>root</code>, <code>combine</code>, and <code>modules</code>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass configs listed above. These values are used for all of the modules listed in the group</li>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<h3 id="Lang">Lang</h3>
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass<p><code>Lang</code> contains JavaScript language utilities and extensions that are used in the YUI library.
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glassvar Y = YUI();
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass// true, an array literal is an array
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass// false, an object literal is not an array
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav GlassY.Lang.isArray({"one": "two"});
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass// however, when declared as an array, it is true
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass var a = new Array();
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass a["one"] = "two";
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass// false, a collection of elements is like an array, but isn't
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav GlassY.Lang.isArray(document.getElementsByTagName("body"));
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass// true, false is a boolean
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass// false, 1 and the string "true" are not booleans
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass// null is null, but false, undefined and "" are not
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav GlassY.Lang.isNull(undefined); // false
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass// a function is a function, but an object is not
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav GlassY.Lang.isFunction(function(){}); // true
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav GlassY.Lang.isFunction({foo: "bar"}); // false
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass// true, ints and floats are numbers
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass// false, strings that can be cast to numbers aren't really numbers
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass// false, undefined numbers and infinity are not numbers we want to use
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass// true, objects, functions, and arrays are objects
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass// false, primitives are not objects
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav GlassY.Lang.isString({foo: "bar"}); // false
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav GlassY.Lang.isString(true); // false
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav Glass// undefined is undefined, but null and false are not
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav GlassY.Lang.isUndefined(undefined); // true
4613cfd8960e141ac5d088a10bc6124df2e46f24Dav GlassY.Lang.isUndefined(false); // false