/loggerhead/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/loggerhead/trunk

« back to all changes in this revision

Viewing changes to loggerhead/static/javascript/yui/build/get/get-debug.js

  • Committer: Matt Nordhoff
  • Date: 2010-02-26 04:37:13 UTC
  • mfrom: (400 trunk)
  • mto: This revision was merged to the branch mainline in revision 401.
  • Revision ID: mnordhoff@mattnordhoff.com-20100226043713-7mw3r6dr9qowutmi
Merge trunk for NEWS

Show diffs side-by-side

added added

removed removed

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