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