src/cm/media/js/lib/yui/yui3.0.0/build/get/get-debug.js
changeset 0 40c8f766c9b8
equal deleted inserted replaced
-1:000000000000 0:40c8f766c9b8
       
     1 /*
       
     2 Copyright (c) 2009, Yahoo! Inc. All rights reserved.
       
     3 Code licensed under the BSD License:
       
     4 http://developer.yahoo.net/yui/license.txt
       
     5 version: 3.0.0
       
     6 build: 1549
       
     7 */
       
     8 YUI.add('get', function(Y) {
       
     9 
       
    10 (function() {
       
    11 
       
    12 /**
       
    13  * Provides a mechanism to fetch remote resources and
       
    14  * insert them into a document.
       
    15  * @module yui
       
    16  * @submodule get
       
    17  */
       
    18 
       
    19 var ua         = Y.UA, 
       
    20     L          = Y.Lang,
       
    21     // PREFIX     = Y.guid(),
       
    22     TYPE_JS    = "text/javascript",
       
    23     TYPE_CSS   = "text/css",
       
    24     STYLESHEET = "stylesheet";
       
    25 
       
    26 /**
       
    27  * Fetches and inserts one or more script or link nodes into the document 
       
    28  * @class Get
       
    29  * @static
       
    30  */
       
    31 Y.Get = function() {
       
    32 
       
    33     /**
       
    34      * hash of queues to manage multiple requests
       
    35      * @property queues
       
    36      * @private
       
    37      */
       
    38     var queues={}, 
       
    39         
       
    40     /**
       
    41      * queue index used to generate transaction ids
       
    42      * @property qidx
       
    43      * @type int
       
    44      * @private
       
    45      */
       
    46         qidx=0, 
       
    47         
       
    48     /**
       
    49      * interal property used to prevent multiple simultaneous purge 
       
    50      * processes
       
    51      * @property purging
       
    52      * @type boolean
       
    53      * @private
       
    54      */
       
    55         purging=false,
       
    56 
       
    57     
       
    58     /** 
       
    59      * Generates an HTML element, this is not appended to a document
       
    60      * @method _node
       
    61      * @param type {string} the type of element
       
    62      * @param attr {string} the attributes
       
    63      * @param win {Window} optional window to create the element in
       
    64      * @return {HTMLElement} the generated node
       
    65      * @private
       
    66      */
       
    67     _node = function(type, attr, win) {
       
    68         var w = win || Y.config.win, d=w.document, n=d.createElement(type),
       
    69             i;
       
    70 
       
    71         for (i in attr) {
       
    72             if (attr[i] && attr.hasOwnProperty(i)) {
       
    73                 n.setAttribute(i, attr[i]);
       
    74             }
       
    75         }
       
    76 
       
    77         return n;
       
    78     },
       
    79 
       
    80     /**
       
    81      * Generates a link node
       
    82      * @method _linkNode
       
    83      * @param url {string} the url for the css file
       
    84      * @param win {Window} optional window to create the node in
       
    85      * @param attributes optional attributes collection to apply to the new node
       
    86      * @return {HTMLElement} the generated node
       
    87      * @private
       
    88      */
       
    89     _linkNode = function(url, win, attributes) {
       
    90         var o = {
       
    91             id:   Y.guid(),
       
    92             type: TYPE_CSS,
       
    93             rel:  STYLESHEET,
       
    94             href: url
       
    95         };
       
    96         if (attributes) {
       
    97             Y.mix(o, attributes);
       
    98         }
       
    99         return _node("link", o, win);
       
   100     },
       
   101 
       
   102     /**
       
   103      * Generates a script node
       
   104      * @method _scriptNode
       
   105      * @param url {string} the url for the script file
       
   106      * @param win {Window} optional window to create the node in
       
   107      * @param attributes optional attributes collection to apply to the new node
       
   108      * @return {HTMLElement} the generated node
       
   109      * @private
       
   110      */
       
   111     _scriptNode = function(url, win, attributes) {
       
   112         var o = {
       
   113             id:   Y.guid(),
       
   114             type: TYPE_JS,
       
   115             src:  url
       
   116         };
       
   117 
       
   118         if (attributes) {
       
   119             Y.mix(o, attributes);
       
   120         }
       
   121 
       
   122         return _node("script", o, win);
       
   123     },
       
   124 
       
   125     /**
       
   126      * Removes the nodes for the specified queue
       
   127      * @method _purge
       
   128      * @private
       
   129      */
       
   130     _purge = function(tId) {
       
   131         var q=queues[tId], n, l, d, h, s, i, node, attr;
       
   132         if (q) {
       
   133             n = q.nodes; 
       
   134             l = n.length;
       
   135             d = q.win.document;
       
   136             h = d.getElementsByTagName("head")[0];
       
   137 
       
   138             if (q.insertBefore) {
       
   139                 s = _get(q.insertBefore, tId);
       
   140                 if (s) {
       
   141                     h = s.parentNode;
       
   142                 }
       
   143             }
       
   144 
       
   145             for (i=0; i<l; i=i+1) {
       
   146                 node = n[i];
       
   147                 if (node.clearAttributes) {
       
   148                     node.clearAttributes();
       
   149                 } else {
       
   150                     // This is a hostile delete
       
   151                     // operation attempting to improve
       
   152                     // memory performance.  As such, the
       
   153                     // hasOwnProperty check is intentionally
       
   154                     // ommitted.
       
   155                     for (attr in node) {
       
   156                         delete node[attr];
       
   157                     }
       
   158                 }
       
   159 
       
   160                 h.removeChild(node);
       
   161             }
       
   162         }
       
   163         q.nodes = [];
       
   164     },
       
   165 
       
   166     /**
       
   167      * Returns the data payload for callback functions
       
   168      * @method _returnData
       
   169      * @private
       
   170      */
       
   171     _returnData = function(q, msg, result) {
       
   172         return {
       
   173                 tId: q.tId,
       
   174                 win: q.win,
       
   175                 data: q.data,
       
   176                 nodes: q.nodes,
       
   177                 msg: msg,
       
   178                 statusText: result,
       
   179                 purge: function() {
       
   180                     _purge(this.tId);
       
   181                 }
       
   182             };
       
   183     },
       
   184 
       
   185     /**
       
   186      * The transaction is finished
       
   187      * @method _end
       
   188      * @param id {string} the id of the request
       
   189      * @private
       
   190      */
       
   191     _end = function(id, msg, result) {
       
   192         var q = queues[id], sc;
       
   193         if (q && q.onEnd) {
       
   194             sc = q.context || q;
       
   195             q.onEnd.call(sc, _returnData(q, msg, result));
       
   196         }
       
   197     },
       
   198 
       
   199     /*
       
   200      * The request failed, execute fail handler with whatever
       
   201      * was accomplished.  There isn't a failure case at the
       
   202      * moment unless you count aborted transactions
       
   203      * @method _fail
       
   204      * @param id {string} the id of the request
       
   205      * @private
       
   206      */
       
   207     _fail = function(id, msg) {
       
   208 
       
   209         Y.log("get failure: " + msg, "warn", "get");
       
   210 
       
   211         var q = queues[id], sc;
       
   212         if (q.timer) {
       
   213             // q.timer.cancel();
       
   214             clearTimeout(q.timer);
       
   215         }
       
   216 
       
   217         // execute failure callback
       
   218         if (q.onFailure) {
       
   219             sc = q.context || q;
       
   220             q.onFailure.call(sc, _returnData(q, msg));
       
   221         }
       
   222 
       
   223         _end(id, msg, 'failure');
       
   224     },
       
   225 
       
   226     _get = function(nId, tId) {
       
   227         var q = queues[tId],
       
   228             n = (L.isString(nId)) ? q.win.document.getElementById(nId) : nId;
       
   229         if (!n) {
       
   230             _fail(tId, "target node not found: " + nId);
       
   231         }
       
   232 
       
   233         return n;
       
   234     },
       
   235 
       
   236     /**
       
   237      * The request is complete, so executing the requester's callback
       
   238      * @method _finish
       
   239      * @param id {string} the id of the request
       
   240      * @private
       
   241      */
       
   242     _finish = function(id) {
       
   243         Y.log("Finishing transaction " + id, "info", "get");
       
   244         var q = queues[id], msg, sc;
       
   245         if (q.timer) {
       
   246             // q.timer.cancel();
       
   247             clearTimeout(q.timer);
       
   248         }
       
   249         q.finished = true;
       
   250 
       
   251         if (q.aborted) {
       
   252             msg = "transaction " + id + " was aborted";
       
   253             _fail(id, msg);
       
   254             return;
       
   255         }
       
   256 
       
   257         // execute success callback
       
   258         if (q.onSuccess) {
       
   259             sc = q.context || q;
       
   260             q.onSuccess.call(sc, _returnData(q));
       
   261         }
       
   262 
       
   263         _end(id, msg, 'OK');
       
   264     },
       
   265 
       
   266     /**
       
   267      * Timeout detected
       
   268      * @method _timeout
       
   269      * @param id {string} the id of the request
       
   270      * @private
       
   271      */
       
   272     _timeout = function(id) {
       
   273         Y.log("Timeout " + id, "info", "get");
       
   274         var q = queues[id], sc;
       
   275         if (q.onTimeout) {
       
   276             sc = q.context || q;
       
   277             q.onTimeout.call(sc, _returnData(q));
       
   278         }
       
   279 
       
   280         _end(id, 'timeout', 'timeout');
       
   281     },
       
   282     
       
   283 
       
   284     /**
       
   285      * Loads the next item for a given request
       
   286      * @method _next
       
   287      * @param id {string} the id of the request
       
   288      * @param loaded {string} the url that was just loaded, if any
       
   289      * @private
       
   290      */
       
   291     _next = function(id, loaded) {
       
   292 
       
   293         Y.log("_next: " + id + ", loaded: " + (loaded || "nothing"), "info", "get");
       
   294 
       
   295         var q = queues[id], msg, w, d, h, n, url, s;
       
   296 
       
   297         if (q.timer) {
       
   298             // Y.log('cancel timer');
       
   299             // q.timer.cancel();
       
   300             clearTimeout(q.timer);
       
   301         }
       
   302 
       
   303         if (q.aborted) {
       
   304             msg = "transaction " + id + " was aborted";
       
   305             _fail(id, msg);
       
   306             return;
       
   307         }
       
   308 
       
   309         if (loaded) {
       
   310             q.url.shift(); 
       
   311             if (q.varName) {
       
   312                 q.varName.shift(); 
       
   313             }
       
   314         } else {
       
   315             // This is the first pass: make sure the url is an array
       
   316             q.url = (L.isString(q.url)) ? [q.url] : q.url;
       
   317             if (q.varName) {
       
   318                 q.varName = (L.isString(q.varName)) ? [q.varName] : q.varName;
       
   319             }
       
   320         }
       
   321 
       
   322         w = q.win; 
       
   323         d = w.document; 
       
   324         h = d.getElementsByTagName("head")[0];
       
   325 
       
   326         if (q.url.length === 0) {
       
   327             _finish(id);
       
   328             return;
       
   329         } 
       
   330 
       
   331         url = q.url[0];
       
   332 
       
   333         // if the url is undefined, this is probably a trailing comma problem in IE
       
   334         if (!url) {
       
   335             q.url.shift(); 
       
   336             Y.log('skipping empty url');
       
   337             return _next(id);
       
   338         }
       
   339 
       
   340         Y.log("attempting to load " + url, "info", "get");
       
   341 
       
   342         if (q.timeout) {
       
   343             // Y.log('create timer');
       
   344             // q.timer = L.later(q.timeout, q, _timeout, id);
       
   345             q.timer = setTimeout(function() { 
       
   346                 _timeout(id);
       
   347             }, q.timeout);
       
   348         }
       
   349 
       
   350         if (q.type === "script") {
       
   351             n = _scriptNode(url, w, q.attributes);
       
   352         } else {
       
   353             n = _linkNode(url, w, q.attributes);
       
   354         }
       
   355 
       
   356         // track this node's load progress
       
   357         _track(q.type, n, id, url, w, q.url.length);
       
   358 
       
   359         // add the node to the queue so we can return it to the user supplied callback
       
   360         q.nodes.push(n);
       
   361 
       
   362         // add it to the head or insert it before 'insertBefore'
       
   363         if (q.insertBefore) {
       
   364             s = _get(q.insertBefore, id);
       
   365             if (s) {
       
   366                 s.parentNode.insertBefore(n, s);
       
   367             }
       
   368         } else {
       
   369             h.appendChild(n);
       
   370         }
       
   371         
       
   372         Y.log("Appending node: " + url, "info", "get");
       
   373 
       
   374         // FireFox does not support the onload event for link nodes, so there is
       
   375         // no way to make the css requests synchronous. This means that the css 
       
   376         // rules in multiple files could be applied out of order in this browser
       
   377         // if a later request returns before an earlier one.  Safari too.
       
   378         if ((ua.webkit || ua.gecko) && q.type === "css") {
       
   379             _next(id, url);
       
   380         }
       
   381     },
       
   382 
       
   383     /**
       
   384      * Removes processed queues and corresponding nodes
       
   385      * @method _autoPurge
       
   386      * @private
       
   387      */
       
   388     _autoPurge = function() {
       
   389 
       
   390         if (purging) {
       
   391             return;
       
   392         }
       
   393 
       
   394         purging = true;
       
   395 
       
   396         var i, q;
       
   397 
       
   398         for (i in queues) {
       
   399             if (queues.hasOwnProperty(i)) {
       
   400                 q = queues[i];
       
   401                 if (q.autopurge && q.finished) {
       
   402                     _purge(q.tId);
       
   403                     delete queues[i];
       
   404                 }
       
   405             }
       
   406         }
       
   407 
       
   408         purging = false;
       
   409     },
       
   410 
       
   411     /**
       
   412      * Saves the state for the request and begins loading
       
   413      * the requested urls
       
   414      * @method queue
       
   415      * @param type {string} the type of node to insert
       
   416      * @param url {string} the url to load
       
   417      * @param opts the hash of options for this request
       
   418      * @private
       
   419      */
       
   420     _queue = function(type, url, opts) {
       
   421 
       
   422         opts = opts || {};
       
   423 
       
   424         var id = "q" + (qidx++), q,
       
   425             thresh = opts.purgethreshold || Y.Get.PURGE_THRESH;
       
   426 
       
   427         if (qidx % thresh === 0) {
       
   428             _autoPurge();
       
   429         }
       
   430 
       
   431         queues[id] = Y.merge(opts, {
       
   432             tId: id,
       
   433             type: type,
       
   434             url: url,
       
   435             finished: false,
       
   436             nodes: []
       
   437         });
       
   438 
       
   439         q           = queues[id];
       
   440         q.win       = q.win || Y.config.win;
       
   441         q.context   = q.context || q;
       
   442         q.autopurge = ("autopurge" in q) ? q.autopurge : 
       
   443                       (type === "script") ? true : false;
       
   444 
       
   445         if (opts.charset) {
       
   446             q.attributes = q.attributes || {};
       
   447             q.attributes.charset = opts.charset;
       
   448         }
       
   449 
       
   450         // L.later(0, q, _next, id);
       
   451         setTimeout(function() {
       
   452             _next(id);
       
   453         }, 0);
       
   454 
       
   455         return {
       
   456             tId: id
       
   457         };
       
   458     },
       
   459 
       
   460     /**
       
   461      * Detects when a node has been loaded.  In the case of
       
   462      * script nodes, this does not guarantee that contained
       
   463      * script is ready to use.
       
   464      * @method _track
       
   465      * @param type {string} the type of node to track
       
   466      * @param n {HTMLElement} the node to track
       
   467      * @param id {string} the id of the request
       
   468      * @param url {string} the url that is being loaded
       
   469      * @param win {Window} the targeted window
       
   470      * @param qlength the number of remaining items in the queue,
       
   471      * including this one
       
   472      * @param trackfn {Function} function to execute when finished
       
   473      * the default is _next
       
   474      * @private
       
   475      */
       
   476     _track = function(type, n, id, url, win, qlength, trackfn) {
       
   477         var f = trackfn || _next;
       
   478 
       
   479         // IE supports the readystatechange event for script and css nodes
       
   480         // Opera only for script nodes.  Opera support onload for script
       
   481         // nodes, but this doesn't fire when there is a load failure.
       
   482         // The onreadystatechange appears to be a better way to respond
       
   483         // to both success and failure.
       
   484         if (ua.ie) {
       
   485             n.onreadystatechange = function() {
       
   486                 var rs = this.readyState;
       
   487                 if ("loaded" === rs || "complete" === rs) {
       
   488                     Y.log(id + " onreadstatechange " + url, "info", "get");
       
   489                     n.onreadystatechange = null;
       
   490                     f(id, url);
       
   491                 }
       
   492             };
       
   493 
       
   494         // webkit prior to 3.x is no longer supported
       
   495         } else if (ua.webkit) {
       
   496 
       
   497             if (type === "script") {
       
   498                 // Safari 3.x supports the load event for script nodes (DOM2)
       
   499                 n.addEventListener("load", function() {
       
   500                     Y.log(id + " DOM2 onload " + url, "info", "get");
       
   501                     f(id, url);
       
   502                 });
       
   503             } 
       
   504 
       
   505         // FireFox and Opera support onload (but not DOM2 in FF) handlers for
       
   506         // script nodes.  Opera, but not FF, supports the onload event for link
       
   507         // nodes.
       
   508         } else { 
       
   509 
       
   510             n.onload = function() {
       
   511                 Y.log(id + " onload " + url, "info", "get");
       
   512                 f(id, url);
       
   513             };
       
   514 
       
   515             n.onerror = function(e) {
       
   516                 _fail(id, e + ": " + url);
       
   517             };
       
   518         }
       
   519     };
       
   520 
       
   521     return {
       
   522 
       
   523         /**
       
   524          * The number of request required before an automatic purge.
       
   525          * Can be configured via the 'purgethreshold' config
       
   526          * property PURGE_THRESH
       
   527          * @static
       
   528          * @type int
       
   529          * @default 20
       
   530          * @private
       
   531          */
       
   532         PURGE_THRESH: 20,
       
   533 
       
   534         /**
       
   535          * Called by the the helper for detecting script load in Safari
       
   536          * @method _finalize
       
   537          * @static
       
   538          * @param id {string} the transaction id
       
   539          * @private
       
   540          */
       
   541         _finalize: function(id) {
       
   542             Y.log(id + " finalized ", "info", "get");
       
   543             // L.later(0, null, _finish, id);
       
   544             setTimeout(function() {
       
   545                 _finish(id);
       
   546             }, 0);
       
   547         },
       
   548 
       
   549         /**
       
   550          * Abort a transaction
       
   551          * @method abort
       
   552          * @static
       
   553          * @param o {string|object} Either the tId or the object returned from
       
   554          * script() or css()
       
   555          */
       
   556         abort: function(o) {
       
   557             var id = (L.isString(o)) ? o : o.tId,
       
   558                 q = queues[id];
       
   559             if (q) {
       
   560                 Y.log("Aborting " + id, "info", "get");
       
   561                 q.aborted = true;
       
   562             }
       
   563         }, 
       
   564 
       
   565         /**
       
   566          * Fetches and inserts one or more script nodes into the head
       
   567          * of the current document or the document in a specified window.
       
   568          *
       
   569          * @method script
       
   570          * @static
       
   571          * @param url {string|string[]} the url or urls to the script(s)
       
   572          * @param opts {object} Options: 
       
   573          * <dl>
       
   574          * <dt>onSuccess</dt>
       
   575          * <dd>
       
   576          * callback to execute when the script(s) are finished loading
       
   577          * The callback receives an object back with the following
       
   578          * data:
       
   579          * <dl>
       
   580          * <dt>win</dt>
       
   581          * <dd>the window the script(s) were inserted into</dd>
       
   582          * <dt>data</dt>
       
   583          * <dd>the data object passed in when the request was made</dd>
       
   584          * <dt>nodes</dt>
       
   585          * <dd>An array containing references to the nodes that were
       
   586          * inserted</dd>
       
   587          * <dt>purge</dt>
       
   588          * <dd>A function that, when executed, will remove the nodes
       
   589          * that were inserted</dd>
       
   590          * <dt>
       
   591          * </dl>
       
   592          * </dd>
       
   593          * <dt>onTimeout</dt>
       
   594          * <dd>
       
   595          * callback to execute when a timeout occurs.
       
   596          * The callback receives an object back with the following
       
   597          * data:
       
   598          * <dl>
       
   599          * <dt>win</dt>
       
   600          * <dd>the window the script(s) were inserted into</dd>
       
   601          * <dt>data</dt>
       
   602          * <dd>the data object passed in when the request was made</dd>
       
   603          * <dt>nodes</dt>
       
   604          * <dd>An array containing references to the nodes that were
       
   605          * inserted</dd>
       
   606          * <dt>purge</dt>
       
   607          * <dd>A function that, when executed, will remove the nodes
       
   608          * that were inserted</dd>
       
   609          * <dt>
       
   610          * </dl>
       
   611          * </dd>
       
   612          * <dt>onEnd</dt>
       
   613          * <dd>a function that executes when the transaction finishes, regardless of the exit path</dd>
       
   614          * <dt>onFailure</dt>
       
   615          * <dd>
       
   616          * callback to execute when the script load operation fails
       
   617          * The callback receives an object back with the following
       
   618          * data:
       
   619          * <dl>
       
   620          * <dt>win</dt>
       
   621          * <dd>the window the script(s) were inserted into</dd>
       
   622          * <dt>data</dt>
       
   623          * <dd>the data object passed in when the request was made</dd>
       
   624          * <dt>nodes</dt>
       
   625          * <dd>An array containing references to the nodes that were
       
   626          * inserted successfully</dd>
       
   627          * <dt>purge</dt>
       
   628          * <dd>A function that, when executed, will remove any nodes
       
   629          * that were inserted</dd>
       
   630          * <dt>
       
   631          * </dl>
       
   632          * </dd>
       
   633          * <dt>context</dt>
       
   634          * <dd>the execution context for the callbacks</dd>
       
   635          * <dt>win</dt>
       
   636          * <dd>a window other than the one the utility occupies</dd>
       
   637          * <dt>autopurge</dt>
       
   638          * <dd>
       
   639          * setting to true will let the utilities cleanup routine purge 
       
   640          * the script once loaded
       
   641          * </dd>
       
   642          * <dt>purgethreshold</dt>
       
   643          * <dd>
       
   644          * The number of transaction before autopurge should be initiated
       
   645          * </dd>
       
   646          * <dt>data</dt>
       
   647          * <dd>
       
   648          * data that is supplied to the callback when the script(s) are
       
   649          * loaded.
       
   650          * </dd>
       
   651          * <dt>insertBefore</dt>
       
   652          * <dd>node or node id that will become the new node's nextSibling</dd>
       
   653          * </dl>
       
   654          * <dt>charset</dt>
       
   655          * <dd>Node charset, default utf-8 (deprecated, use the attributes config)</dd>
       
   656          * <dt>attributes</dt>
       
   657          * <dd>An object literal containing additional attributes to add to the link tags</dd>
       
   658          * <dt>timeout</dt>
       
   659          * <dd>Number of milliseconds to wait before aborting and firing the timeout event</dd>
       
   660          * <pre>
       
   661          * &nbsp;&nbsp;Y.Get.script(
       
   662          * &nbsp;&nbsp;["http://yui.yahooapis.com/2.5.2/build/yahoo/yahoo-min.js",
       
   663          * &nbsp;&nbsp;&nbsp;"http://yui.yahooapis.com/2.5.2/build/event/event-min.js"], &#123;
       
   664          * &nbsp;&nbsp;&nbsp;&nbsp;onSuccess: function(o) &#123;
       
   665          * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.log("won't cause error because Y is the context");
       
   666          * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Y.log(o.data); // foo
       
   667          * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Y.log(o.nodes.length === 2) // true
       
   668          * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// o.purge(); // optionally remove the script nodes immediately
       
   669          * &nbsp;&nbsp;&nbsp;&nbsp;&#125;,
       
   670          * &nbsp;&nbsp;&nbsp;&nbsp;onFailure: function(o) &#123;
       
   671          * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Y.log("transaction failed");
       
   672          * &nbsp;&nbsp;&nbsp;&nbsp;&#125;,
       
   673          * &nbsp;&nbsp;&nbsp;&nbsp;onTimeout: function(o) &#123;
       
   674          * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Y.log("transaction timed out");
       
   675          * &nbsp;&nbsp;&nbsp;&nbsp;&#125;,
       
   676          * &nbsp;&nbsp;&nbsp;&nbsp;data: "foo",
       
   677          * &nbsp;&nbsp;&nbsp;&nbsp;timeout: 10000, // 10 second timeout
       
   678          * &nbsp;&nbsp;&nbsp;&nbsp;context: Y, // make the YUI instance
       
   679          * &nbsp;&nbsp;&nbsp;&nbsp;// win: otherframe // target another window/frame
       
   680          * &nbsp;&nbsp;&nbsp;&nbsp;autopurge: true // allow the utility to choose when to remove the nodes
       
   681          * &nbsp;&nbsp;&nbsp;&nbsp;purgetheshold: 1 // purge previous transaction before next transaction
       
   682          * &nbsp;&nbsp;&#125;);
       
   683          * </pre>
       
   684          * @return {tId: string} an object containing info about the transaction
       
   685          */
       
   686         script: function(url, opts) { 
       
   687             return _queue("script", url, opts); 
       
   688         },
       
   689 
       
   690         /**
       
   691          * Fetches and inserts one or more css link nodes into the 
       
   692          * head of the current document or the document in a specified
       
   693          * window.
       
   694          * @method css
       
   695          * @static
       
   696          * @param url {string} the url or urls to the css file(s)
       
   697          * @param opts Options: 
       
   698          * <dl>
       
   699          * <dt>onSuccess</dt>
       
   700          * <dd>
       
   701          * callback to execute when the css file(s) are finished loading
       
   702          * The callback receives an object back with the following
       
   703          * data:
       
   704          * <dl>win</dl>
       
   705          * <dd>the window the link nodes(s) were inserted into</dd>
       
   706          * <dt>data</dt>
       
   707          * <dd>the data object passed in when the request was made</dd>
       
   708          * <dt>nodes</dt>
       
   709          * <dd>An array containing references to the nodes that were
       
   710          * inserted</dd>
       
   711          * <dt>purge</dt>
       
   712          * <dd>A function that, when executed, will remove the nodes
       
   713          * that were inserted</dd>
       
   714          * <dt>
       
   715          * </dl>
       
   716          * </dd>
       
   717          * <dt>context</dt>
       
   718          * <dd>the execution context for the callbacks</dd>
       
   719          * <dt>win</dt>
       
   720          * <dd>a window other than the one the utility occupies</dd>
       
   721          * <dt>data</dt>
       
   722          * <dd>
       
   723          * data that is supplied to the callbacks when the nodes(s) are
       
   724          * loaded.
       
   725          * </dd>
       
   726          * <dt>insertBefore</dt>
       
   727          * <dd>node or node id that will become the new node's nextSibling</dd>
       
   728          * <dt>charset</dt>
       
   729          * <dd>Node charset, default utf-8 (deprecated, use the attributes config)</dd>
       
   730          * <dt>attributes</dt>
       
   731          * <dd>An object literal containing additional attributes to add to the link tags</dd>
       
   732          * </dl>
       
   733          * <pre>
       
   734          *      Y.Get.css("http://yui.yahooapis.com/2.3.1/build/menu/assets/skins/sam/menu.css");
       
   735          * </pre>
       
   736          * <pre>
       
   737          * &nbsp;&nbsp;Y.Get.css(
       
   738          * &nbsp;&nbsp;["http://yui.yahooapis.com/2.3.1/build/menu/assets/skins/sam/menu.css",
       
   739          * &nbsp;&nbsp;&nbsp;"http://yui.yahooapis.com/2.3.1/build/logger/assets/skins/sam/logger.css"], &#123;
       
   740          * &nbsp;&nbsp;&nbsp;&nbsp;insertBefore: 'custom-styles' // nodes will be inserted before the specified node
       
   741          * &nbsp;&nbsp;&#125;);
       
   742          * </pre>
       
   743          * @return {tId: string} an object containing info about the transaction
       
   744          */
       
   745         css: function(url, opts) {
       
   746             return _queue("css", url, opts); 
       
   747         }
       
   748     };
       
   749 }();
       
   750 
       
   751 })();
       
   752 
       
   753 
       
   754 }, '3.0.0' );