2
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
3
Code licensed under the BSD License:
4
http://developer.yahoo.net/yui/license.txt
8
* The YAHOO object is the single global object used by YUI Library. It
9
* contains utility function for setting up namespaces, inheritance, and
10
* logging. YAHOO.util, YAHOO.widget, and YAHOO.example are namespaces
11
* created automatically for and used by the library.
17
* YAHOO_config is not included as part of the library. Instead it is an
18
* object that can be defined by the implementer immediately before
19
* including the YUI library. The properties included in this object
20
* will be used to configure global properties needed as soon as the
21
* library begins to load.
27
* A reference to a function that will be executed every time a YAHOO module
28
* is loaded. As parameter, this function will receive the version
29
* information for the module. See <a href="YAHOO.env.html#getVersion">
30
* YAHOO.env.getVersion</a> for the description of the version data structure.
38
* Set to true if the library will be dynamically loaded after window.onload.
47
* Instructs the yuiloader component to dynamically load yui components and
48
* their dependencies. See the yuiloader documentation for more information
49
* about dynamic loading
57
* Forces the use of the supplied locale where applicable in the library
64
if (typeof YAHOO == "undefined" || !YAHOO) {
66
* The YAHOO global namespace object. If YAHOO is already defined, the
67
* existing YAHOO object will not be overwritten so that defined
68
* namespaces are preserved.
76
* Returns the namespace specified and creates it if it doesn't exist
78
* YAHOO.namespace("property.package");
79
* YAHOO.namespace("YAHOO.property.package");
81
* Either of the above would create YAHOO.property, then
82
* YAHOO.property.package
84
* Be careful when naming packages. Reserved words may work in some browsers
85
* and not others. For instance, the following will fail in Safari:
87
* YAHOO.namespace("really.long.nested.namespace");
89
* This fails because "long" is a future reserved word in ECMAScript
93
* @param {String*} arguments 1-n namespaces to create
94
* @return {Object} A reference to the last namespace object created
96
YAHOO.namespace = function() {
97
var a=arguments, o=null, i, j, d;
98
for (i=0; i<a.length; i=i+1) {
102
// YAHOO is implied, so it is ignored if it is included
103
for (j=(d[0] == "YAHOO") ? 1 : 0; j<d.length; j=j+1) {
104
o[d[j]]=o[d[j]] || {};
113
* Uses YAHOO.widget.Logger to output a log message, if the widget is
118
* @param {String} msg The message to log.
119
* @param {String} cat The log category for the message. Default
120
* categories are "info", "warn", "error", time".
121
* Custom categories can be used as well. (opt)
122
* @param {String} src The source of the the message (opt)
123
* @return {Boolean} True if the log operation was successful.
125
YAHOO.log = function(msg, cat, src) {
126
var l=YAHOO.widget.Logger;
128
return l.log(msg, cat, src);
135
* Registers a module with the YAHOO object
138
* @param {String} name the name of the module (event, slider, etc)
139
* @param {Function} mainClass a reference to class in the module. This
140
* class will be tagged with the version info
141
* so that it will be possible to identify the
142
* version that is in use when multiple versions
144
* @param {Object} data metadata object for the module. Currently it
145
* is expected to contain a "version" property
146
* and a "build" property at minimum.
148
YAHOO.register = function(name, mainClass, data) {
149
var mods = YAHOO.env.modules;
151
mods[name] = { versions:[], builds:[] };
153
var m=mods[name],v=data.version,b=data.build,ls=YAHOO.env.listeners;
159
m.mainClass = mainClass;
160
// fire the module load listeners
161
for (var i=0;i<ls.length;i=i+1) {
164
// label the main class
166
mainClass.VERSION = v;
169
YAHOO.log("mainClass is undefined for module " + name, "warn");
174
* YAHOO.env is used to keep track of what is known about the YUI library and
175
* the browsing environment
179
YAHOO.env = YAHOO.env || {
182
* Keeps the version info for all YUI modules that have reported themselves
189
* List of functions that should be executed every time a YUI module
191
* @property listeners
198
* Returns the version data for the specified module:
200
* <dt>name:</dt> <dd>The name of the module</dd>
201
* <dt>version:</dt> <dd>The version in use</dd>
202
* <dt>build:</dt> <dd>The build number in use</dd>
203
* <dt>versions:</dt> <dd>All versions that were registered</dd>
204
* <dt>builds:</dt> <dd>All builds that were registered.</dd>
205
* <dt>mainClass:</dt> <dd>An object that was was stamped with the
206
* current version and build. If
207
* mainClass.VERSION != version or mainClass.BUILD != build,
208
* multiple versions of pieces of the library have been
209
* loaded, potentially causing issues.</dd>
214
* @param {String} name the name of the module (event, slider, etc)
215
* @return {Object} The version info
217
YAHOO.env.getVersion = function(name) {
218
return YAHOO.env.modules[name] || null;
222
* Do not fork for a browser if it can be avoided. Use feature detection when
223
* you can. Use the user agent as a last resort. YAHOO.env.ua stores a version
224
* number for the browser engine, 0 otherwise. This value may or may not map
225
* to the version number of the browser using the engine. The value is
226
* presented as a float so that it can easily be used for boolean evaluation
227
* as well as for looking for a particular range of versions. Because of this,
228
* some of the granularity of the version info may be lost (e.g., Gecko 1.8.0.9
230
* @class YAHOO.env.ua
233
YAHOO.env.ua = function() {
237
* Internet Explorer version number or 0. Example: 6
244
* Opera version number or 0. Example: 9.2
251
* Gecko engine revision number. Will evaluate to 1 if Gecko
252
* is detected but the revision could not be found. Other browsers
253
* will be 0. Example: 1.8
255
* Firefox 1.0.0.4: 1.7.8 <-- Reports 1.7
256
* Firefox 1.5.0.9: 1.8.0.9 <-- Reports 1.8
257
* Firefox 2.0.0.3: 1.8.1.3 <-- Reports 1.8
258
* Firefox 3 alpha: 1.9a4 <-- Reports 1.9
266
* AppleWebKit version. KHTML browsers that are not WebKit browsers
267
* will evaluate to 1, other browsers 0. Example: 418.9.1
269
* Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the
270
* latest available for Mac OSX 10.3.
271
* Safari 2.0.2: 416 <-- hasOwnProperty introduced
272
* Safari 2.0.4: 418 <-- preventDefault fixed
273
* Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run
274
* different versions of webkit
275
* Safari 2.0.4 (419.3): 419 <-- Tiger installations that have been
276
* updated, but not updated
277
* to the latest patch.
278
* Webkit 212 nightly: 522+ <-- Safari 3.0 precursor (with native SVG
279
* and many major issues fixed).
280
* 3.x yahoo.com, flickr:422 <-- Safari 3.x hacks the user agent
281
* string when hitting yahoo.com and
283
* Safari 3.0.4 (523.12):523.12 <-- First Tiger release - automatic update
284
* from 2.x via the 10.4.11 OS patch
285
* Webkit nightly 1/2008:525+ <-- Supports DOMContentLoaded event.
286
* yahoo.com user agent hack removed.
289
* http://developer.apple.com/internet/safari/uamatrix.html
296
* The mobile property will be set to a string containing any relevant
297
* user agent information when a modern mobile browser is detected.
298
* Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series
299
* devices with the WebKit-based browser, and Opera Mini.
306
* Adobe AIR version number or 0. Only populated if webkit is detected.
315
var ua=navigator.userAgent, m;
317
// Modern KHTML browsers should qualify as Safari X-Grade
318
if ((/KHTML/).test(ua)) {
321
// Modern WebKit browsers are at least X-Grade
322
m=ua.match(/AppleWebKit\/([^\s]*)/);
324
o.webkit=parseFloat(m[1]);
326
// Mobile browser check
327
if (/ Mobile\//.test(ua)) {
328
o.mobile = "Apple"; // iPhone or iPod Touch
330
m=ua.match(/NokiaN[^\/]*/);
332
o.mobile = m[0]; // Nokia N-series, ex: NokiaN95
336
m=ua.match(/AdobeAIR\/([^\s]*)/);
338
o.air = m[0]; // Adobe AIR 1.0 or better
343
if (!o.webkit) { // not webkit
344
// @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr)
345
m=ua.match(/Opera[\s\/]([^\s]*)/);
347
o.opera=parseFloat(m[1]);
348
m=ua.match(/Opera Mini[^;]*/);
350
o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316
352
} else { // not opera or webkit
353
m=ua.match(/MSIE\s([^;]*)/);
355
o.ie=parseFloat(m[1]);
356
} else { // not opera, webkit, or ie
357
m=ua.match(/Gecko\/([^\s]*)/);
359
o.gecko=1; // Gecko detected, look for revision
360
m=ua.match(/rv:([^\s\)]*)/);
362
o.gecko=parseFloat(m[1]);
373
* Initializes the global by creating the default namespaces and applying
374
* any new configuration information that is detected. This is the setup
381
YAHOO.namespace("util", "widget", "example");
382
if ("undefined" !== typeof YAHOO_config) {
383
var l=YAHOO_config.listener,ls=YAHOO.env.listeners,unique=true,i;
385
// if YAHOO is loaded multiple times we need to check to see if
386
// this is a new config object. If it is, add the new component
387
// load listener to the stack
388
for (i=0;i<ls.length;i=i+1) {
401
* Provides the language utilites and extensions used by the library
404
YAHOO.lang = YAHOO.lang || {};
410
// ADD = ["toString", "valueOf", "hasOwnProperty"],
411
ADD = ["toString", "valueOf"],
416
* Determines whether or not the provided object is an array.
417
* Testing typeof/instanceof/constructor of arrays across frame
418
* boundaries isn't possible in Safari unless you have a reference
419
* to the other frame to test against its Array prototype. To
420
* handle this case, we test well-known array properties instead.
423
* @param {any} o The object being testing
424
* @return {boolean} the result
426
isArray: function(o) {
428
return L.isNumber(o.length) && L.isFunction(o.splice);
434
* Determines whether or not the provided object is a boolean
436
* @param {any} o The object being testing
437
* @return {boolean} the result
439
isBoolean: function(o) {
440
return typeof o === 'boolean';
444
* Determines whether or not the provided object is a function
446
* @param {any} o The object being testing
447
* @return {boolean} the result
449
isFunction: function(o) {
450
return typeof o === 'function';
454
* Determines whether or not the provided object is null
456
* @param {any} o The object being testing
457
* @return {boolean} the result
459
isNull: function(o) {
464
* Determines whether or not the provided object is a legal number
466
* @param {any} o The object being testing
467
* @return {boolean} the result
469
isNumber: function(o) {
470
return typeof o === 'number' && isFinite(o);
474
* Determines whether or not the provided object is of type object
477
* @param {any} o The object being testing
478
* @return {boolean} the result
480
isObject: function(o) {
481
return (o && (typeof o === 'object' || L.isFunction(o))) || false;
485
* Determines whether or not the provided object is a string
487
* @param {any} o The object being testing
488
* @return {boolean} the result
490
isString: function(o) {
491
return typeof o === 'string';
495
* Determines whether or not the provided object is undefined
496
* @method isUndefined
497
* @param {any} o The object being testing
498
* @return {boolean} the result
500
isUndefined: function(o) {
501
return typeof o === 'undefined';
506
* IE will not enumerate native functions in a derived object even if the
507
* function was overridden. This is a workaround for specific functions
508
* we care about on the Object prototype.
509
* @property _IEEnumFix
510
* @param {Function} r the object to receive the augmentation
511
* @param {Function} s the object that supplies the properties to augment
515
_IEEnumFix: (YAHOO.env.ua.ie) ? function(r, s) {
516
for (var i=0;i<ADD.length;i=i+1) {
517
var fname=ADD[i],f=s[fname];
518
if (L.isFunction(f) && f!=Object.prototype[fname]) {
525
* Utility to set up the prototype, constructor and superclass properties to
526
* support an inheritance strategy that can chain constructors and methods.
527
* Static members will not be inherited.
531
* @param {Function} subc the object to modify
532
* @param {Function} superc the object to inherit
533
* @param {Object} overrides additional properties/methods to add to the
534
* subclass prototype. These will override the
535
* matching items obtained from the superclass
538
extend: function(subc, superc, overrides) {
539
if (!superc||!subc) {
540
throw new Error("extend failed, please check that " +
541
"all dependencies are included.");
543
var F = function() {};
544
F.prototype=superc.prototype;
545
subc.prototype=new F();
546
subc.prototype.constructor=subc;
547
subc.superclass=superc.prototype;
548
if (superc.prototype.constructor == Object.prototype.constructor) {
549
superc.prototype.constructor=superc;
553
for (var i in overrides) {
554
if (L.hasOwnProperty(overrides, i)) {
555
subc.prototype[i]=overrides[i];
559
L._IEEnumFix(subc.prototype, overrides);
564
* Applies all properties in the supplier to the receiver if the
565
* receiver does not have these properties yet. Optionally, one or
566
* more methods/properties can be specified (as additional
567
* parameters). This option will overwrite the property if receiver
568
* has it already. If true is passed as the third parameter, all
569
* properties will be applied and _will_ overwrite properties in
572
* @method augmentObject
575
* @param {Function} r the object to receive the augmentation
576
* @param {Function} s the object that supplies the properties to augment
577
* @param {String*|boolean} arguments zero or more properties methods
578
* to augment the receiver with. If none specified, everything
579
* in the supplier will be used unless it would
580
* overwrite an existing property in the receiver. If true
581
* is specified as the third parameter, all properties will
582
* be applied and will overwrite an existing property in
585
augmentObject: function(r, s) {
587
throw new Error("Absorb failed, verify dependencies.");
589
var a=arguments, i, p, override=a[2];
590
if (override && override!==true) { // only absorb the specified properties
591
for (i=2; i<a.length; i=i+1) {
594
} else { // take everything, overwriting only if the third parameter is true
596
if (override || !(p in r)) {
606
* Same as YAHOO.lang.augmentObject, except it only applies prototype properties
607
* @see YAHOO.lang.augmentObject
608
* @method augmentProto
610
* @param {Function} r the object to receive the augmentation
611
* @param {Function} s the object that supplies the properties to augment
612
* @param {String*|boolean} arguments zero or more properties methods
613
* to augment the receiver with. If none specified, everything
614
* in the supplier will be used unless it would overwrite an existing
615
* property in the receiver. if true is specified as the third
616
* parameter, all properties will be applied and will overwrite an
617
* existing property in the receiver
619
augmentProto: function(r, s) {
621
throw new Error("Augment failed, verify dependencies.");
623
//var a=[].concat(arguments);
624
var a=[r.prototype,s.prototype];
625
for (var i=2;i<arguments.length;i=i+1) {
626
a.push(arguments[i]);
628
L.augmentObject.apply(this, a);
633
* Returns a simple string representation of the object or array.
634
* Other types of objects will be returned unprocessed. Arrays
635
* are expected to be indexed. Use object notation for
636
* associative arrays.
639
* @param o {Object} The object to dump
640
* @param d {int} How deep to recurse child objects, default 3
641
* @return {String} the dump result
643
dump: function(o, d) {
644
var i,len,s=[],OBJ="{...}",FUN="f(){...}",
645
COMMA=', ', ARROW=' => ';
647
// Cast non-objects to string
648
// Skip dates because the std toString is what we want
649
// Skip HTMLElement-like objects because trying to dump
650
// an element will cause an unhandled exception in FF 2.x
651
if (!L.isObject(o)) {
653
} else if (o instanceof Date || ("nodeType" in o && "tagName" in o)) {
655
} else if (L.isFunction(o)) {
659
// dig into child objects the depth specifed. Default 3
660
d = (L.isNumber(d)) ? d : 3;
665
for (i=0,len=o.length;i<len;i=i+1) {
666
if (L.isObject(o[i])) {
667
s.push((d > 0) ? L.dump(o[i], d-1) : OBJ);
677
// objects {k1 => v1, k2 => v2}
681
if (L.hasOwnProperty(o, i)) {
683
if (L.isObject(o[i])) {
684
s.push((d > 0) ? L.dump(o[i], d-1) : OBJ);
701
* Does variable substitution on a string. It scans through the string
702
* looking for expressions enclosed in { } braces. If an expression
703
* is found, it is used a key on the object. If there is a space in
704
* the key, the first word is used for the key and the rest is provided
705
* to an optional function to be used to programatically determine the
706
* value (the extra information might be used for this decision). If
707
* the value for the key in the object, or what is returned from the
708
* function has a string value, number value, or object value, it is
709
* substituted for the bracket expression and it repeats. If this
710
* value is an object, it uses the Object's toString() if this has
711
* been overridden, otherwise it does a shallow dump of the key/value
715
* @param s {String} The string that will be modified.
716
* @param o {Object} An object containing the replacement values
717
* @param f {Function} An optional function that can be used to
718
* process each match. It receives the key,
719
* value, and any extra metadata included with
720
* the key inside of the braces.
721
* @return {String} the substituted string
723
substitute: function (s, o, f) {
724
var i, j, k, key, v, meta, saved=[], token,
725
DUMP='dump', SPACE=' ', LBRACE='{', RBRACE='}';
729
i = s.lastIndexOf(LBRACE);
733
j = s.indexOf(RBRACE, i);
738
//Extract key and meta info
739
token = s.substring(i + 1, j);
742
k = key.indexOf(SPACE);
744
meta = key.substring(k + 1);
745
key = key.substring(0, k);
751
// if a substitution function was provided, execute it
758
v = L.dump(v, parseInt(meta, 10));
762
// look for the keyword 'dump', if found force obj dump
763
var dump = meta.indexOf(DUMP);
765
meta = meta.substring(4);
768
// use the toString if it is not the Object toString
769
// and the 'dump' meta info was not found
770
if (v.toString===Object.prototype.toString||dump>-1) {
771
v = L.dump(v, parseInt(meta, 10));
776
} else if (!L.isString(v) && !L.isNumber(v)) {
777
// This {block} has no replace string. Save it for later.
778
v = "~-" + saved.length + "-~";
779
saved[saved.length] = token;
784
s = s.substring(0, i) + v + s.substring(j + 1);
789
// restore saved {block}s
790
for (i=saved.length-1; i>=0; i=i-1) {
791
s = s.replace(new RegExp("~-" + i + "-~"), "{" + saved[i] + "}", "g");
799
* Returns a string without any leading or trailing whitespace. If
800
* the input is not a string, the input will be returned untouched.
803
* @param s {string} the string to trim
804
* @return {string} the trimmed string
808
return s.replace(/^\s+|\s+$/g, "");
815
* Returns a new object containing all of the properties of
816
* all the supplied objects. The properties from later objects
817
* will overwrite those in earlier objects.
820
* @param arguments {Object*} the objects to merge
821
* @return the new merged object
824
var o={}, a=arguments;
825
for (var i=0, l=a.length; i<l; i=i+1) {
826
L.augmentObject(o, a[i], true);
832
* Executes the supplied function in the context of the supplied
833
* object 'when' milliseconds later. Executes the function a
834
* single time unless periodic is set to true.
837
* @param when {int} the number of milliseconds to wait until the fn
839
* @param o the context object
840
* @param fn {Function|String} the function to execute or the name of
841
* the method in the 'o' object to execute
842
* @param data [Array] data that is provided to the function. This accepts
843
* either a single item or an array. If an array is provided, the
844
* function is executed with one parameter for each array item. If
845
* you need to pass a single array parameter, it needs to be wrapped in
847
* @param periodic {boolean} if true, executes continuously at supplied
848
* interval until canceled
849
* @return a timer object. Call the cancel() method on this object to
852
later: function(when, o, fn, data, periodic) {
855
var m=fn, d=data, f, r;
857
if (L.isString(fn)) {
862
throw new TypeError("method undefined");
873
r = (periodic) ? setInterval(f, when) : setTimeout(f, when);
888
* A convenience method for detecting a legitimate non-null value.
889
* Returns false for null/undefined/NaN, true for other values,
890
* including 0/false/''
893
* @param o {any} the item to test
894
* @return {boolean} true if it is not null/undefined/NaN || false
896
isValue: function(o) {
897
// return (o || o === false || o === 0 || o === ''); // Infinity fails
898
return (L.isObject(o) || L.isString(o) || L.isNumber(o) || L.isBoolean(o));
904
* Determines whether or not the property was added
905
* to the object instance. Returns false if the property is not present
906
* in the object, or was inherited from the prototype.
907
* This abstraction is provided to enable hasOwnProperty for Safari 1.3.x.
908
* There is a discrepancy between YAHOO.lang.hasOwnProperty and
909
* Object.prototype.hasOwnProperty when the property is a primitive added to
910
* both the instance AND prototype with the same value:
912
* var A = function() {};
913
* A.prototype.foo = 'foo';
916
* alert(a.hasOwnProperty('foo')); // true
917
* alert(YAHOO.lang.hasOwnProperty(a, 'foo')); // false when using fallback
919
* @method hasOwnProperty
920
* @param {any} o The object being testing
921
* @param prop {string} the name of the property to test
922
* @return {boolean} the result
924
L.hasOwnProperty = (Object.prototype.hasOwnProperty) ?
926
return o && o.hasOwnProperty(prop);
927
} : function(o, prop) {
928
return !L.isUndefined(o[prop]) &&
929
o.constructor.prototype[prop] !== o[prop];
933
OB.augmentObject(L, OB, true);
936
* An alias for <a href="YAHOO.lang.html">YAHOO.lang</a>
937
* @class YAHOO.util.Lang
942
* Same as YAHOO.lang.augmentObject, except it only applies prototype
943
* properties. This is an alias for augmentProto.
944
* @see YAHOO.lang.augmentObject
947
* @param {Function} r the object to receive the augmentation
948
* @param {Function} s the object that supplies the properties to augment
949
* @param {String*|boolean} arguments zero or more properties methods to
950
* augment the receiver with. If none specified, everything
951
* in the supplier will be used unless it would
952
* overwrite an existing property in the receiver. if true
953
* is specified as the third parameter, all properties will
954
* be applied and will overwrite an existing property in
957
L.augment = L.augmentProto;
960
* An alias for <a href="YAHOO.lang.html#augment">YAHOO.lang.augment</a>
964
* @param {Function} r the object to receive the augmentation
965
* @param {Function} s the object that supplies the properties to augment
966
* @param {String*} arguments zero or more properties methods to
967
* augment the receiver with. If none specified, everything
968
* in the supplier will be used unless it would
969
* overwrite an existing property in the receiver
971
YAHOO.augment = L.augmentProto;
974
* An alias for <a href="YAHOO.lang.html#extend">YAHOO.lang.extend</a>
977
* @param {Function} subc the object to modify
978
* @param {Function} superc the object to inherit
979
* @param {Object} overrides additional properties/methods to add to the
980
* subclass prototype. These will override the
981
* matching items obtained from the superclass if present.
983
YAHOO.extend = L.extend;
986
YAHOO.register("yahoo", YAHOO, {version: "2.6.0", build: "1321"});
988
* Provides a mechanism to fetch remote resources and
989
* insert them into a document
995
* Fetches and inserts one or more script or link nodes into the document
996
* @namespace YAHOO.util
997
* @class YAHOO.util.Get
999
YAHOO.util.Get = function() {
1002
* hash of queues to manage multiple requests
1009
* queue index used to generate transaction ids
1017
* node index used to generate unique node ids
1026
// sandboxFrame=null,
1029
* interal property used to prevent multiple simultaneous purge
1042
* Generates an HTML element, this is not appended to a document
1044
* @param type {string} the type of element
1045
* @param attr {string} the attributes
1046
* @param win {Window} optional window to create the element in
1047
* @return {HTMLElement} the generated node
1050
var _node = function(type, attr, win) {
1051
var w = win || window, d=w.document, n=d.createElement(type);
1053
for (var i in attr) {
1054
if (attr[i] && YAHOO.lang.hasOwnProperty(attr, i)) {
1055
n.setAttribute(i, attr[i]);
1063
* Generates a link node
1065
* @param url {string} the url for the css file
1066
* @param win {Window} optional window to create the node in
1067
* @return {HTMLElement} the generated node
1070
var _linkNode = function(url, win, charset) {
1071
var c = charset || "utf-8";
1072
return _node("link", {
1073
"id": "yui__dyn_" + (nidx++),
1076
"rel": "stylesheet",
1082
* Generates a script node
1083
* @method _scriptNode
1084
* @param url {string} the url for the script file
1085
* @param win {Window} optional window to create the node in
1086
* @return {HTMLElement} the generated node
1089
var _scriptNode = function(url, win, charset) {
1090
var c = charset || "utf-8";
1091
return _node("script", {
1092
"id": "yui__dyn_" + (nidx++),
1093
"type": "text/javascript",
1100
* Returns the data payload for callback functions
1101
* @method _returnData
1104
var _returnData = function(q, msg) {
1117
var _get = function(nId, tId) {
1118
var q = queues[tId],
1119
n = (lang.isString(nId)) ? q.win.document.getElementById(nId) : nId;
1121
_fail(tId, "target node not found: " + nId);
1128
* The request failed, execute fail handler with whatever
1129
* was accomplished. There isn't a failure case at the
1130
* moment unless you count aborted transactions
1132
* @param id {string} the id of the request
1135
var _fail = function(id, msg) {
1137
// execute failure callback
1139
var sc=q.scope || q.win;
1140
q.onFailure.call(sc, _returnData(q, msg));
1145
* The request is complete, so executing the requester's callback
1147
* @param id {string} the id of the request
1150
var _finish = function(id) {
1155
var msg = "transaction " + id + " was aborted";
1160
// execute success callback
1162
var sc=q.scope || q.win;
1163
q.onSuccess.call(sc, _returnData(q));
1170
* @param id {string} the id of the request
1173
var _timeout = function(id) {
1176
var sc=q.context || q;
1177
q.onTimeout.call(sc, _returnData(q));
1182
* Loads the next item for a given request
1184
* @param id {string} the id of the request
1185
* @param loaded {string} the url that was just loaded, if any
1188
var _next = function(id, loaded) {
1192
// Y.log('cancel timer');
1197
var msg = "transaction " + id + " was aborted";
1208
// This is the first pass: make sure the url is an array
1209
q.url = (lang.isString(q.url)) ? [q.url] : q.url;
1211
q.varName = (lang.isString(q.varName)) ? [q.varName] : q.varName;
1215
var w=q.win, d=w.document, h=d.getElementsByTagName("head")[0], n;
1217
if (q.url.length === 0) {
1218
// Safari 2.x workaround - There is no way to know when
1219
// a script is ready in versions of Safari prior to 3.x.
1220
// Adding an extra node reduces the problem, but doesn't
1221
// eliminate it completely because the browser executes
1222
// them asynchronously.
1223
if (q.type === "script" && ua.webkit && ua.webkit < 420 &&
1224
!q.finalpass && !q.varName) {
1225
// Add another script node. This does not guarantee that the
1226
// scripts will execute in order, but it does appear to fix the
1227
// problem on fast connections more effectively than using an
1228
// arbitrary timeout. It is possible that the browser does
1229
// block subsequent script execution in this case for a limited
1231
var extra = _scriptNode(null, q.win, q.charset);
1232
extra.innerHTML='YAHOO.util.Get._finalize("' + id + '");';
1233
q.nodes.push(extra); h.appendChild(extra);
1245
// if the url is undefined, this is probably a trailing comma problem in IE
1253
// Y.log('create timer');
1254
q.timer = lang.later(q.timeout, q, _timeout, id);
1257
if (q.type === "script") {
1258
n = _scriptNode(url, w, q.charset);
1260
n = _linkNode(url, w, q.charset);
1263
// track this node's load progress
1264
_track(q.type, n, id, url, w, q.url.length);
1266
// add the node to the queue so we can return it to the user supplied callback
1269
// add it to the head or insert it before 'insertBefore'
1270
if (q.insertBefore) {
1271
var s = _get(q.insertBefore, id);
1273
s.parentNode.insertBefore(n, s);
1280
// FireFox does not support the onload event for link nodes, so there is
1281
// no way to make the css requests synchronous. This means that the css
1282
// rules in multiple files could be applied out of order in this browser
1283
// if a later request returns before an earlier one. Safari too.
1284
if ((ua.webkit || ua.gecko) && q.type === "css") {
1290
* Removes processed queues and corresponding nodes
1291
* @method _autoPurge
1294
var _autoPurge = function() {
1301
for (var i in queues) {
1303
if (q.autopurge && q.finished) {
1313
* Removes the nodes for the specified queue
1317
var _purge = function(tId) {
1320
var n=q.nodes, l=n.length, d=q.win.document,
1321
h=d.getElementsByTagName("head")[0];
1323
if (q.insertBefore) {
1324
var s = _get(q.insertBefore, tId);
1330
for (var i=0; i<l; i=i+1) {
1331
h.removeChild(n[i]);
1339
* Saves the state for the request and begins loading
1340
* the requested urls
1342
* @param type {string} the type of node to insert
1343
* @param url {string} the url to load
1344
* @param opts the hash of options for this request
1347
var _queue = function(type, url, opts) {
1349
var id = "q" + (qidx++);
1352
if (qidx % YAHOO.util.Get.PURGE_THRESH === 0) {
1356
queues[id] = lang.merge(opts, {
1366
q.win = q.win || window;
1367
q.scope = q.scope || q.win;
1368
q.autopurge = ("autopurge" in q) ? q.autopurge :
1369
(type === "script") ? true : false;
1371
lang.later(0, q, _next, id);
1379
* Detects when a node has been loaded. In the case of
1380
* script nodes, this does not guarantee that contained
1381
* script is ready to use.
1383
* @param type {string} the type of node to track
1384
* @param n {HTMLElement} the node to track
1385
* @param id {string} the id of the request
1386
* @param url {string} the url that is being loaded
1387
* @param win {Window} the targeted window
1388
* @param qlength the number of remaining items in the queue,
1389
* including this one
1390
* @param trackfn {Function} function to execute when finished
1391
* the default is _next
1394
var _track = function(type, n, id, url, win, qlength, trackfn) {
1395
var f = trackfn || _next;
1397
// IE supports the readystatechange event for script and css nodes
1399
n.onreadystatechange = function() {
1400
var rs = this.readyState;
1401
if ("loaded" === rs || "complete" === rs) {
1402
n.onreadystatechange = null;
1407
// webkit prior to 3.x is problemmatic
1408
} else if (ua.webkit) {
1410
if (type === "script") {
1412
// Safari 3.x supports the load event for script nodes (DOM2)
1413
if (ua.webkit >= 420) {
1415
n.addEventListener("load", function() {
1419
// Nothing can be done with Safari < 3.x except to pause and hope
1420
// for the best, particularly after last script is inserted. The
1421
// scripts will always execute in the order they arrive, not
1422
// necessarily the order in which they were inserted. To support
1423
// script nodes with complete reliability in these browsers, script
1424
// nodes either need to invoke a function in the window once they
1425
// are loaded or the implementer needs to provide a well-known
1426
// property that the utility can poll for.
1428
// Poll for the existence of the named variable, if it
1432
var freq=YAHOO.util.Get.POLL_FREQ;
1433
q.maxattempts = YAHOO.util.Get.TIMEOUT/freq;
1435
q._cache = q.varName[0].split(".");
1436
q.timer = lang.later(freq, q, function(o) {
1437
var a=this._cache, l=a.length, w=this.win, i;
1438
for (i=0; i<l; i=i+1) {
1441
// if we have exausted our attempts, give up
1443
if (this.attempts++ > this.maxattempts) {
1444
var msg = "Over retry limit, giving up";
1459
lang.later(YAHOO.util.Get.POLL_FREQ, null, f, [id, url]);
1464
// FireFox and Opera support onload (but not DOM2 in FF) handlers for
1465
// script nodes. Opera, but not FF, supports the onload event for link
1468
n.onload = function() {
1477
* The default poll freqency in ms, when needed
1478
* @property POLL_FREQ
1486
* The number of request required before an automatic purge.
1487
* property PURGE_THRESH
1495
* The length time to poll for varName when loading a script in
1496
* Safari 2.x before the transaction fails.
1505
* Called by the the helper for detecting script load in Safari
1507
* @param id {string} the transaction id
1510
_finalize: function(id) {
1511
lang.later(0, null, _finish, id);
1515
* Abort a transaction
1517
* @param {string|object} either the tId or the object returned from
1520
abort: function(o) {
1521
var id = (lang.isString(o)) ? o : o.tId;
1529
* Fetches and inserts one or more script nodes into the head
1530
* of the current document or the document in a specified window.
1534
* @param url {string|string[]} the url or urls to the script(s)
1535
* @param opts {object} Options:
1537
* <dt>onSuccess</dt>
1539
* callback to execute when the script(s) are finished loading
1540
* The callback receives an object back with the following
1544
* <dd>the window the script(s) were inserted into</dd>
1546
* <dd>the data object passed in when the request was made</dd>
1548
* <dd>An array containing references to the nodes that were
1551
* <dd>A function that, when executed, will remove the nodes
1552
* that were inserted</dd>
1556
* <dt>onFailure</dt>
1558
* callback to execute when the script load operation fails
1559
* The callback receives an object back with the following
1563
* <dd>the window the script(s) were inserted into</dd>
1565
* <dd>the data object passed in when the request was made</dd>
1567
* <dd>An array containing references to the nodes that were
1568
* inserted successfully</dd>
1570
* <dd>A function that, when executed, will remove any nodes
1571
* that were inserted</dd>
1575
* <dt>onTimeout</dt>
1577
* callback to execute when a timeout occurs.
1578
* The callback receives an object back with the following
1582
* <dd>the window the script(s) were inserted into</dd>
1584
* <dd>the data object passed in when the request was made</dd>
1586
* <dd>An array containing references to the nodes that were
1589
* <dd>A function that, when executed, will remove the nodes
1590
* that were inserted</dd>
1595
* <dd>the execution context for the callbacks</dd>
1597
* <dd>a window other than the one the utility occupies</dd>
1598
* <dt>autopurge</dt>
1600
* setting to true will let the utilities cleanup routine purge
1601
* the script once loaded
1605
* data that is supplied to the callback when the script(s) are
1610
* variable that should be available when a script is finished
1611
* loading. Used to help Safari 2.x and below with script load
1612
* detection. The type of this property should match what was
1613
* passed into the url parameter: if loading a single url, a
1614
* string can be supplied. If loading multiple scripts, you
1615
* must supply an array that contains the variable name for
1618
* <dt>insertBefore</dt>
1619
* <dd>node or node id that will become the new node's nextSibling</dd>
1622
* <dd>Node charset, default utf-8</dd>
1624
* <dd>Number of milliseconds to wait before aborting and firing the timeout event</dd>
1626
* // assumes yahoo, dom, and event are already on the page
1627
* YAHOO.util.Get.script(
1628
* ["http://yui.yahooapis.com/2.3.1/build/dragdrop/dragdrop-min.js",
1629
* "http://yui.yahooapis.com/2.3.1/build/animation/animation-min.js"], {
1630
* onSuccess: function(o) {
1631
* new YAHOO.util.DDProxy("dd1"); // also new o.reference("dd1"); would work
1632
* this.log("won't cause error because YAHOO is the scope");
1633
* this.log(o.nodes.length === 2) // true
1634
* // o.purge(); // optionally remove the script nodes immediately
1635
* },
1636
* onFailure: function(o) {
1637
* },
1638
* data: "foo",
1639
* timeout: 10000, // 10 second timeout
1640
* scope: YAHOO,
1641
* // win: otherframe // target another window/frame
1642
* autopurge: true // allow the utility to choose when to remove the nodes
1643
* });
1645
* @return {tId: string} an object containing info about the transaction
1647
script: function(url, opts) { return _queue("script", url, opts); },
1650
* Fetches and inserts one or more css link nodes into the
1651
* head of the current document or the document in a specified
1655
* @param url {string} the url or urls to the css file(s)
1656
* @param opts Options:
1658
* <dt>onSuccess</dt>
1660
* callback to execute when the css file(s) are finished loading
1661
* The callback receives an object back with the following
1664
* <dd>the window the link nodes(s) were inserted into</dd>
1666
* <dd>the data object passed in when the request was made</dd>
1668
* <dd>An array containing references to the nodes that were
1671
* <dd>A function that, when executed, will remove the nodes
1672
* that were inserted</dd>
1677
* <dd>the execution context for the callbacks</dd>
1679
* <dd>a window other than the one the utility occupies</dd>
1682
* data that is supplied to the callbacks when the nodes(s) are
1685
* <dt>insertBefore</dt>
1686
* <dd>node or node id that will become the new node's nextSibling</dd>
1688
* <dd>Node charset, default utf-8</dd>
1691
* YAHOO.util.Get.css("http://yui.yahooapis.com/2.3.1/build/menu/assets/skins/sam/menu.css");
1694
* YAHOO.util.Get.css(["http://yui.yahooapis.com/2.3.1/build/menu/assets/skins/sam/menu.css",
1696
* @return {tId: string} an object containing info about the transaction
1698
css: function(url, opts) {
1699
return _queue("css", url, opts);
1704
YAHOO.register("get", YAHOO.util.Get, {version: "2.6.0", build: "1321"});
1706
* Provides dynamic loading for the YUI library. It includes the dependency
1707
* info for the library, and will automatically pull in dependencies for
1708
* the modules requested. It supports rollup files (such as utilities.js
1709
* and yahoo-dom-event.js), and will automatically use these when
1710
* appropriate in order to minimize the number of http connections
1711
* required to load all of the dependencies.
1714
* @namespace YAHOO.util
1718
* YUILoader provides dynamic loading for YUI.
1719
* @class YAHOO.util.YUILoader
1721
* version management, automatic sandboxing
1725
var Y=YAHOO, util=Y.util, lang=Y.lang, env=Y.env,
1726
PROV = "_provides", SUPER = "_supersedes",
1727
REQ = "expanded", AFTER = "_after";
1731
dupsAllowed: {'yahoo': true, 'get': true},
1734
* The library metadata for the current release The is the default
1735
* value for YAHOO.util.YUILoader.moduleInfo
1741
// 'root': '2.5.2/build/',
1742
// 'base': 'http://yui.yahooapis.com/2.5.2/build/',
1744
'root': '2.6.0/build/',
1745
'base': 'http://yui.yahooapis.com/2.6.0/build/',
1747
'comboBase': 'http://yui.yahooapis.com/combo?',
1750
'defaultSkin': 'sam',
1751
'base': 'assets/skins/',
1753
'after': ['reset', 'fonts', 'grids', 'base'],
1757
dupsAllowed: ['yahoo', 'get'],
1763
'path': 'animation/animation-min.js',
1764
'requires': ['dom', 'event']
1769
'path': 'autocomplete/autocomplete-min.js',
1770
'requires': ['dom', 'event', 'datasource'],
1771
'optional': ['connection', 'animation'],
1777
'path': 'base/base-min.css',
1778
'after': ['reset', 'fonts', 'grids']
1783
'path': 'button/button-min.js',
1784
'requires': ['element'],
1785
'optional': ['menu'],
1791
'path': 'calendar/calendar-min.js',
1792
'requires': ['event', 'dom'],
1798
'path': 'carousel/carousel-beta-min.js',
1799
'requires': ['element'],
1800
'optional': ['animation'],
1806
'path': 'charts/charts-experimental-min.js',
1807
'requires': ['element', 'json', 'datasource']
1812
'path': 'colorpicker/colorpicker-min.js',
1813
'requires': ['slider', 'element'],
1814
'optional': ['animation'],
1820
'path': 'connection/connection-min.js',
1821
'requires': ['event']
1826
'path': 'container/container-min.js',
1827
'requires': ['dom', 'event'],
1828
// button is also optional, but this creates a circular
1829
// dependency when loadOptional is specified. button
1830
// optionally includes menu, menu requires container.
1831
'optional': ['dragdrop', 'animation', 'connection'],
1832
'supersedes': ['containercore'],
1838
'path': 'container/container_core-min.js',
1839
'requires': ['dom', 'event'],
1845
'path': 'cookie/cookie-min.js',
1846
'requires': ['yahoo']
1851
'path': 'datasource/datasource-min.js',
1852
'requires': ['event'],
1853
'optional': ['connection']
1858
'path': 'datatable/datatable-min.js',
1859
'requires': ['element', 'datasource'],
1860
'optional': ['calendar', 'dragdrop', 'paginator'],
1866
'path': 'dom/dom-min.js',
1867
'requires': ['yahoo']
1872
'path': 'dragdrop/dragdrop-min.js',
1873
'requires': ['dom', 'event']
1878
'path': 'editor/editor-min.js',
1879
'requires': ['menu', 'element', 'button'],
1880
'optional': ['animation', 'dragdrop'],
1881
'supersedes': ['simpleeditor'],
1887
'path': 'element/element-beta-min.js',
1888
'requires': ['dom', 'event']
1893
'path': 'event/event-min.js',
1894
'requires': ['yahoo']
1899
'path': 'fonts/fonts-min.css'
1904
'path': 'get/get-min.js',
1905
'requires': ['yahoo']
1910
'path': 'grids/grids-min.css',
1911
'requires': ['fonts'],
1912
'optional': ['reset']
1917
'path': 'history/history-min.js',
1918
'requires': ['event']
1923
'path': 'imagecropper/imagecropper-beta-min.js',
1924
'requires': ['dom', 'event', 'dragdrop', 'element', 'resize'],
1930
'path': 'imageloader/imageloader-min.js',
1931
'requires': ['event', 'dom']
1936
'path': 'json/json-min.js',
1937
'requires': ['yahoo']
1942
'path': 'layout/layout-min.js',
1943
'requires': ['dom', 'event', 'element'],
1944
'optional': ['animation', 'dragdrop', 'resize', 'selector'],
1950
'path': 'logger/logger-min.js',
1951
'requires': ['event', 'dom'],
1952
'optional': ['dragdrop'],
1958
'path': 'menu/menu-min.js',
1959
'requires': ['containercore'],
1965
'path': 'paginator/paginator-min.js',
1966
'requires': ['element'],
1972
'path': 'profiler/profiler-min.js',
1973
'requires': ['yahoo']
1979
'path': 'profilerviewer/profilerviewer-beta-min.js',
1980
'requires': ['profiler', 'yuiloader', 'element'],
1986
'path': 'reset/reset-min.css'
1989
'reset-fonts-grids': {
1991
'path': 'reset-fonts-grids/reset-fonts-grids.css',
1992
'supersedes': ['reset', 'fonts', 'grids', 'reset-fonts'],
1998
'path': 'reset-fonts/reset-fonts.css',
1999
'supersedes': ['reset', 'fonts'],
2005
'path': 'resize/resize-min.js',
2006
'requires': ['dom', 'event', 'dragdrop', 'element'],
2007
'optional': ['animation'],
2013
'path': 'selector/selector-beta-min.js',
2014
'requires': ['yahoo', 'dom']
2019
'path': 'editor/simpleeditor-min.js',
2020
'requires': ['element'],
2021
'optional': ['containercore', 'menu', 'button', 'animation', 'dragdrop'],
2028
'path': 'slider/slider-min.js',
2029
'requires': ['dragdrop'],
2030
'optional': ['animation'],
2036
'path': 'tabview/tabview-min.js',
2037
'requires': ['element'],
2038
'optional': ['connection'],
2044
'path': 'treeview/treeview-min.js',
2045
'requires': ['event', 'dom'],
2051
'path': 'uploader/uploader-experimental.js',
2052
'requires': ['element']
2057
'path': 'utilities/utilities.js',
2058
'supersedes': ['yahoo', 'event', 'dragdrop', 'animation', 'dom', 'connection', 'element', 'yahoo-dom-event', 'get', 'yuiloader', 'yuiloader-dom-event'],
2064
'path': 'yahoo/yahoo-min.js'
2067
'yahoo-dom-event': {
2069
'path': 'yahoo-dom-event/yahoo-dom-event.js',
2070
'supersedes': ['yahoo', 'event', 'dom'],
2076
'path': 'yuiloader/yuiloader-min.js',
2077
'supersedes': ['yahoo', 'get']
2080
'yuiloader-dom-event': {
2082
'path': 'yuiloader-dom-event/yuiloader-dom-event.js',
2083
'supersedes': ['yahoo', 'dom', 'event', 'get', 'yuiloader', 'yahoo-dom-event'],
2089
'path': 'yuitest/yuitest-min.js',
2090
'requires': ['logger'],
2098
appendArray: function(o, a) {
2100
for (var i=0; i<a.length; i=i+1) {
2106
keys: function(o, ordered) {
2109
if (lang.hasOwnProperty(o, i)) {
2120
appendArray: function(a1, a2) {
2121
Array.prototype.push.apply(a1, a2);
2123
for (var i=0; i<a2.length; i=i+1) {
2129
indexOf: function(a, val) {
2130
for (var i=0; i<a.length; i=i+1) {
2139
toObject: function(a) {
2141
for (var i=0; i<a.length; i=i+1) {
2149
* Returns a unique array. Does not maintain order, which is fine
2150
* for this application, and performs better than it would if it
2154
return YUI.ObjectUtil.keys(YUI.ArrayUtil.toObject(a));
2159
YAHOO.util.YUILoader = function(o) {
2162
* Internal callback to handle multiple internal insert() calls
2163
* so that css is inserted prior to js
2164
* @property _internalCallback
2167
this._internalCallback = null;
2170
* Use the YAHOO environment listener to detect script load. This
2171
* is only switched on for Safari 2.x and below.
2172
* @property _useYahooListener
2175
this._useYahooListener = false;
2178
* Callback that will be executed when the loader is finished
2183
this.onSuccess = null;
2186
* Callback that will be executed if there is a failure
2190
this.onFailure = Y.log;
2193
* Callback that will be executed each time a new module is loaded
2194
* @method onProgress
2197
this.onProgress = null;
2200
* Callback that will be executed if a timeout occurs
2204
this.onTimeout = null;
2207
* The execution scope for all callbacks
2214
* Data that is passed to all callbacks
2220
* Node reference or id where new nodes should be inserted before
2221
* @property insertBefore
2222
* @type string|HTMLElement
2224
this.insertBefore = null;
2227
* The charset attribute for inserted nodes
2232
this.charset = null;
2235
* The name of the variable in a sandbox or script node
2236
* (for external script support in Safari 2.x and earlier)
2237
* to reference when the load is complete. If this variable
2238
* is not available in the specified scripts, the operation will
2243
this.varName = null;
2246
* The base directory.
2249
* @default http://yui.yahooapis.com/[YUI VERSION]/build/
2251
this.base = YUI.info.base;
2254
* Base path for the combo service
2255
* @property comboBase
2257
* @default http://yui.yahooapis.com/combo?
2259
this.comboBase = YUI.info.comboBase;
2262
* If configured, YUI will use the the combo handler on the
2263
* Yahoo! CDN to pontentially reduce the number of http requests
2269
// this.combine = (o && !('base' in o));
2270
this.combine = false;
2274
* Root path to prepend to module path for the combo
2278
* @default [YUI VERSION]/build/
2280
this.root = YUI.info.root;
2283
* Timeout value in milliseconds. If set, this value will be used by
2284
* the get utility. the timeout event will fire if
2292
* A list of modules that should not be loaded, even if
2293
* they turn up in the dependency tree
2300
* A list of modules that should always be loaded, even
2301
* if they have already been inserted into the page.
2308
* Should we allow rollups
2309
* @property allowRollup
2313
this.allowRollup = true;
2316
* A filter to apply to result urls. This filter will modify the default
2317
* path for all modules. The default path for the YUI library is the
2318
* minified version of the files (e.g., event-min.js). The filter property
2319
* can be a predefined filter or a custom filter. The valid predefined
2323
* <dd>Selects the debug versions of the library (e.g., event-debug.js).
2324
* This option will automatically include the logger widget</dd>
2326
* <dd>Selects the non-minified version of the library (e.g., event.js).
2328
* You can also define a custom filter, which must be an object literal
2329
* containing a search expression and a replace string:
2332
* 'searchExp': "-min\\.js",
2333
* 'replaceStr': "-debug.js"
2337
* @type string|{searchExp: string, replaceStr: string}
2342
* The list of requested modules
2343
* @property required
2344
* @type {string: boolean}
2349
* The library metadata
2350
* @property moduleInfo
2352
this.moduleInfo = lang.merge(YUI.info.moduleInfo);
2355
* List of rollup files found in the library metadata
2358
this.rollups = null;
2361
* Whether or not to load optional dependencies for
2362
* the requested modules
2363
* @property loadOptional
2367
this.loadOptional = false;
2370
* All of the derived dependencies in sorted order, which
2371
* will be populated when either calculate() or insert()
2379
* Set when beginning to compute the dependency tree.
2380
* Composed of what YAHOO reports to be loaded combined
2381
* with what has been loaded by the tool
2383
* @type {string: boolean}
2388
* Flag to indicate the dependency tree needs to be recomputed
2389
* if insert is called again.
2397
* List of modules inserted by the utility
2398
* @property inserted
2399
* @type {string: boolean}
2404
* Provides the information used to skin the skinnable components.
2405
* The following skin definition would result in 'skin1' and 'skin2'
2406
* being loaded for calendar (if calendar was requested), and
2407
* 'sam' for all other skinnable components:
2412
* // The default skin, which is automatically applied if not
2413
* // overriden by a component-specific skin definition.
2414
* // Change this in to apply a different skin globally
2415
* defaultSkin: 'sam',
2417
* // This is combined with the loader base property to get
2418
* // the default root directory for a skin. ex:
2419
* // http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/
2420
* base: 'assets/skins/',
2422
* // The name of the rollup css file for the skin
2425
* // The number of skinnable components requested that are
2426
* // required before using the rollup file rather than the
2427
* // individual component css files
2430
* // Any component-specific overrides can be specified here,
2431
* // making it possible to load different skins for different
2432
* // components. It is possible to load more than one skin
2433
* // for a given component as well.
2435
* calendar: ['skin1', 'skin2']
2444
env.listeners.push(function(m) {
2445
if (self._useYahooListener) {
2446
//Y.log("YAHOO listener: " + m.name);
2447
self.loadNext(m.name);
2451
this.skin = lang.merge(YUI.info.skin);
2457
Y.util.YUILoader.prototype = {
2461
'searchExp': "-min\\.js",
2465
'searchExp': "-min\\.js",
2466
'replaceStr': "-debug.js"
2470
SKIN_PREFIX: "skin-",
2472
_config: function(o) {
2474
// apply config values
2477
if (lang.hasOwnProperty(o, i)) {
2478
if (i == "require") {
2488
var f = this.filter;
2490
if (lang.isString(f)) {
2491
f = f.toUpperCase();
2493
// the logger must be available in order to use the debug
2494
// versions of the library
2495
if (f === "DEBUG") {
2496
this.require("logger");
2499
// hack to handle a a bug where LogWriter is being instantiated
2500
// at load time, and the loader has no way to sort above it
2502
if (!Y.widget.LogWriter) {
2503
Y.widget.LogWriter = function() {
2508
this.filter = this.FILTERS[f];
2513
/** Add a new module to the component metadata.
2515
* <dt>name:</dt> <dd>required, the component name</dd>
2516
* <dt>type:</dt> <dd>required, the component type (js or css)</dd>
2517
* <dt>path:</dt> <dd>required, the path to the script from "base"</dd>
2518
* <dt>requires:</dt> <dd>array of modules required by this component</dd>
2519
* <dt>optional:</dt> <dd>array of optional modules for this component</dd>
2520
* <dt>supersedes:</dt> <dd>array of the modules this component replaces</dd>
2521
* <dt>after:</dt> <dd>array of modules the components which, if present, should be sorted above this one</dd>
2522
* <dt>rollup:</dt> <dd>the number of superseded modules required for automatic rollup</dd>
2523
* <dt>fullpath:</dt> <dd>If fullpath is specified, this is used instead of the configured base + path</dd>
2524
* <dt>skinnable:</dt> <dd>flag to determine if skin assets should automatically be pulled in</dd>
2527
* @param o An object containing the module data
2528
* @return {boolean} true if the module was added, false if
2529
* the object passed in did not provide all required attributes
2531
addModule: function(o) {
2533
if (!o || !o.name || !o.type || (!o.path && !o.fullpath)) {
2537
o.ext = ('ext' in o) ? o.ext : true;
2538
o.requires = o.requires || [];
2540
this.moduleInfo[o.name] = o;
2547
* Add a requirement for one or more module
2549
* @param what {string[] | string*} the modules to load
2551
require: function(what) {
2552
var a = (typeof what === "string") ? arguments : what;
2554
YUI.ObjectUtil.appendArray(this.required, a);
2558
* Adds the skin def to the module info
2560
* @param skin {string} the name of the skin
2561
* @param mod {string} the name of the module
2562
* @return {string} the module name for the skin
2565
_addSkin: function(skin, mod) {
2567
// Add a module definition for the skin rollup css
2568
var name = this.formatSkin(skin), info = this.moduleInfo,
2569
sinf = this.skin, ext = info[mod] && info[mod].ext;
2571
// Y.log('ext? ' + mod + ": " + ext);
2573
// Y.log('adding skin ' + name);
2577
'path': sinf.base + skin + '/' + sinf.path,
2578
//'supersedes': '*',
2579
'after': sinf.after,
2580
'rollup': sinf.rollup,
2585
// Add a module definition for the module-specific skin css
2587
name = this.formatSkin(skin, mod);
2589
var mdef = info[mod], pkg = mdef.pkg || mod;
2590
// Y.log('adding skin ' + name);
2594
'after': sinf.after,
2595
'path': pkg + '/' + sinf.base + skin + '/' + mod + '.css',
2605
* Returns an object containing properties for all modules required
2606
* in order to load the requested module
2607
* @method getRequires
2608
* @param mod The module definition from moduleInfo
2610
getRequires: function(mod) {
2615
if (!this.dirty && mod.expanded) {
2616
return mod.expanded;
2619
mod.requires=mod.requires || [];
2620
var i, d=[], r=mod.requires, o=mod.optional, info=this.moduleInfo, m;
2621
for (i=0; i<r.length; i=i+1) {
2624
YUI.ArrayUtil.appendArray(d, this.getRequires(m));
2626
// add existing skins for skinnable modules as well. The only
2627
// way to do this is go through the list of required items (this
2628
// assumes that _skin is called before getRequires is called on
2630
// if (m.skinnable) {
2631
// var req=this.required, l=req.length;
2632
// for (var j=0; j<l; j=j+1) {
2633
// // YAHOO.log('checking ' + r[j]);
2634
// if (req[j].indexOf(r[j]) > -1) {
2635
// // YAHOO.log('adding ' + r[j]);
2642
if (o && this.loadOptional) {
2643
for (i=0; i<o.length; i=i+1) {
2645
YUI.ArrayUtil.appendArray(d, this.getRequires(info[o[i]]));
2649
mod.expanded = YUI.ArrayUtil.uniq(d);
2651
return mod.expanded;
2656
* Returns an object literal of the modules the supplied module satisfies
2657
* @method getProvides
2658
* @param name{string} The name of the module
2659
* @param notMe {string} don't add this module name, only include superseded modules
2660
* @return what this module provides
2662
getProvides: function(name, notMe) {
2663
var addMe = !(notMe), ckey = (addMe) ? PROV : SUPER,
2664
m = this.moduleInfo[name], o = {};
2671
// Y.log('cached: ' + name + ' ' + ckey + ' ' + lang.dump(this.moduleInfo[name][ckey], 0));
2675
var s = m.supersedes, done={}, me = this;
2677
// use worker to break cycles
2678
var add = function(mm) {
2680
// Y.log(name + ' provides worker trying: ' + mm);
2682
// we always want the return value normal behavior
2683
// (provides) for superseded modules.
2684
lang.augmentObject(o, me.getProvides(mm));
2688
// Y.log(name + ' provides worker skipping done: ' + mm);
2692
// calculate superseded modules
2694
for (var i=0; i<s.length; i=i+1) {
2702
m[PROV] = lang.merge(o);
2703
m[PROV][name] = true;
2705
// Y.log(name + " supersedes " + lang.dump(m[SUPER], 0));
2706
// Y.log(name + " provides " + lang.dump(m[PROV], 0));
2713
* Calculates the dependency tree, the result is stored in the sorted
2716
* @param o optional options object
2718
calculate: function(o) {
2719
if (o || this.dirty) {
2723
// this._skin(); // deprecated
2724
if (this.allowRollup) {
2730
// Y.log("after calculate: " + lang.dump(this.required));
2737
* Investigates the current YUI configuration on the page. By default,
2738
* modules already detected will not be loaded again unless a force
2739
* option is encountered. Called by calculate()
2743
_setup: function() {
2745
var info = this.moduleInfo, name, i, j;
2747
// Create skin modules
2748
for (name in info) {
2750
if (lang.hasOwnProperty(info, name)) {
2752
if (m && m.skinnable) {
2753
// Y.log("skinning: " + name);
2754
var o=this.skin.overrides, smod;
2756
for (i=0; i<o[name].length; i=i+1) {
2757
smod = this._addSkin(o[name][i], name);
2760
smod = this._addSkin(this.skin.defaultSkin, name);
2763
m.requires.push(smod);
2769
var l = lang.merge(this.inserted); // shallow clone
2771
if (!this._sandbox) {
2772
l = lang.merge(l, env.modules);
2775
// Y.log("Already loaded stuff: " + lang.dump(l, 0));
2777
// add the ignore list to the list of loaded packages
2779
YUI.ObjectUtil.appendArray(l, this.ignore);
2782
// remove modules on the force list from the loaded list
2784
for (i=0; i<this.force.length; i=i+1) {
2785
if (this.force[i] in l) {
2786
delete l[this.force[i]];
2791
// expand the list to include superseded modules
2793
// Y.log("expanding: " + j);
2794
if (lang.hasOwnProperty(l, j)) {
2795
lang.augmentObject(l, this.getProvides(j));
2799
// Y.log("loaded expanded: " + lang.dump(l, 0));
2807
* Inspects the required modules list looking for additional
2808
* dependencies. Expands the required list to include all
2809
* required modules. Called by calculate()
2813
_explode: function() {
2815
var r=this.required, i, mod;
2818
if (lang.hasOwnProperty(r, i)) {
2819
mod = this.moduleInfo[i];
2822
var req = this.getRequires(mod);
2825
YUI.ObjectUtil.appendArray(r, req);
2833
* Sets up the requirements for the skin assets if any of the
2834
* requested modules are skinnable
2837
* @deprecated skin modules are generated for all skinnable
2838
* components during _setup(), and the components
2839
* are configured to require the skin.
2846
* Returns the skin module name for the specified skin name. If a
2847
* module name is supplied, the returned skin module name is
2848
* specific to the module passed in.
2849
* @method formatSkin
2850
* @param skin {string} the name of the skin
2851
* @param mod {string} optional: the name of a module to skin
2852
* @return {string} the full skin module name
2854
formatSkin: function(skin, mod) {
2855
var s = this.SKIN_PREFIX + skin;
2864
* Reverses <code>formatSkin</code>, providing the skin name and
2865
* module name if the string matches the pattern for skins.
2867
* @param mod {string} the module name to parse
2868
* @return {skin: string, module: string} the parsed skin name
2869
* and module name, or null if the supplied string does not match
2872
parseSkin: function(mod) {
2874
if (mod.indexOf(this.SKIN_PREFIX) === 0) {
2875
var a = mod.split("-");
2876
return {skin: a[1], module: a[2]};
2883
* Look for rollup packages to determine if all of the modules a
2884
* rollup supersedes are required. If so, include the rollup to
2885
* help reduce the total number of connections required. Called
2890
_rollup: function() {
2891
var i, j, m, s, rollups={}, r=this.required, roll,
2892
info = this.moduleInfo;
2894
// find and cache rollup modules
2895
if (this.dirty || !this.rollups) {
2897
if (lang.hasOwnProperty(info, i)) {
2899
//if (m && m.rollup && m.supersedes) {
2900
if (m && m.rollup) {
2906
this.rollups = rollups;
2909
// make as many passes as needed to pick up rollup rollups
2913
// go through the rollup candidates
2914
for (i in rollups) {
2916
// there can be only one
2917
if (!r[i] && !this.loaded[i]) {
2918
m =info[i]; s = m.supersedes; roll=false;
2924
var skin = (m.ext) ? false : this.parseSkin(i), c = 0;
2926
// Y.log('skin? ' + i + ": " + skin);
2929
if (lang.hasOwnProperty(r, j)) {
2930
if (i !== j && this.parseSkin(j)) {
2932
roll = (c >= m.rollup);
2934
// Y.log("skin rollup " + lang.dump(r));
2943
// check the threshold
2944
for (j=0;j<s.length;j=j+1) {
2946
// if the superseded module is loaded, we can't load the rollup
2947
if (this.loaded[s[j]] && (!YUI.dupsAllowed[s[j]])) {
2950
// increment the counter if this module is required. if we are
2951
// beyond the rollup threshold, we will use the rollup module
2952
} else if (r[s[j]]) {
2954
roll = (c >= m.rollup);
2956
// Y.log("over thresh " + c + ", " + lang.dump(r));
2964
// Y.log("rollup: " + i + ", " + lang.dump(this, 1));
2969
// expand the rollup's dependencies
2970
this.getRequires(m);
2975
// if we made it here w/o rolling up something, we are done
2983
* Remove superceded modules and loaded modules. Called by
2984
* calculate() after we have the mega list of all dependencies
2988
_reduce: function() {
2990
var i, j, s, m, r=this.required;
2993
// remove if already loaded
2994
if (i in this.loaded) {
2997
// remove anything this module supersedes
3000
var skinDef = this.parseSkin(i);
3003
//YAHOO.log("skin found in reduce: " + skinDef.skin + ", " + skinDef.module);
3004
// the skin rollup will not have a module name
3005
if (!skinDef.module) {
3006
var skin_pre = this.SKIN_PREFIX + skinDef.skin;
3007
//YAHOO.log("skin_pre: " + skin_pre);
3010
if (lang.hasOwnProperty(r, j)) {
3011
m = this.moduleInfo[j];
3012
var ext = m && m.ext;
3013
if (!ext && j !== i && j.indexOf(skin_pre) > -1) {
3014
// Y.log ("removing component skin: " + j);
3022
m = this.moduleInfo[i];
3023
s = m && m.supersedes;
3025
for (j=0; j<s.length; j=j+1) {
3036
_onFailure: function(msg) {
3037
YAHOO.log('Failure', 'info', 'loader');
3039
var f = this.onFailure;
3041
f.call(this.scope, {
3042
msg: 'failure: ' + msg,
3049
_onTimeout: function() {
3050
YAHOO.log('Timeout', 'info', 'loader');
3051
var f = this.onTimeout;
3053
f.call(this.scope, {
3062
* Sorts the dependency tree. The last step of calculate()
3067
// create an indexed list
3068
var s=[], info=this.moduleInfo, loaded=this.loaded,
3069
checkOptional=!this.loadOptional, me = this;
3071
// returns true if b is not loaded, and is required
3072
// directly or by means of modules it supersedes.
3073
var requires = function(aa, bb) {
3077
if (loaded[bb] || !mm) {
3085
optional = mm.optional;
3088
// check if this module requires the other directly
3089
if (rr && YUI.ArrayUtil.indexOf(rr, bb) > -1) {
3093
// check if this module should be sorted after the other
3094
if (after && YUI.ArrayUtil.indexOf(after, bb) > -1) {
3098
// if loadOptional is not specified, optional dependencies still
3099
// must be sorted correctly when present.
3100
if (checkOptional && optional && YUI.ArrayUtil.indexOf(optional, bb) > -1) {
3104
// check if this module requires one the other supersedes
3105
var ss=info[bb] && info[bb].supersedes;
3107
for (ii=0; ii<ss.length; ii=ii+1) {
3108
if (requires(aa, ss[ii])) {
3114
// var ss=me.getProvides(bb, true);
3117
// if (requires(aa, ii)) {
3123
// external css files should be sorted below yui css
3124
if (mm.ext && mm.type == 'css' && !other.ext && other.type == 'css') {
3131
// get the required items out of the obj into an array so we
3133
for (var i in this.required) {
3134
if (lang.hasOwnProperty(this.required, i)) {
3139
// pointer to the first unsorted item
3142
// keep going until we make a pass without moving anything
3145
var l=s.length, a, b, j, k, moved=false;
3147
// start the loop after items that are already sorted
3148
for (j=p; j<l; j=j+1) {
3150
// check the next module on the list to see if its
3151
// dependencies have been met
3154
// check everything below current item and move if we
3155
// find a requirement for the current item
3156
for (k=j+1; k<l; k=k+1) {
3157
if (requires(a, s[k])) {
3159
// extract the dependency so we can move it up
3162
// insert the dependency above the item that
3164
s.splice(j, 0, b[0]);
3171
// jump out of loop if we moved something
3174
// this item is sorted, move our pointer and keep going
3180
// when we make it here and moved is false, we are
3191
toString: function() {
3195
filter: this.filter,
3196
required: this.required,
3197
loaded: this.loaded,
3198
inserted: this.inserted
3204
_combine: function() {
3206
this._combining = [];
3211
js = this.comboBase,
3212
css = this.comboBase,
3214
startLen = js.length,
3215
i, m, type = this.loadType;
3217
YAHOO.log('type ' + type);
3219
for (i=0; i<len; i=i+1) {
3221
m = this.moduleInfo[s[i]];
3223
if (m && !m.ext && (!type || type === m.type)) {
3225
target = this.root + m.path;
3231
if (m.type == 'js') {
3237
// YAHOO.log(target);
3238
this._combining.push(s[i]);
3242
if (this._combining.length) {
3244
YAHOO.log('Attempting to combine: ' + this._combining, "info", "loader");
3246
var callback=function(o) {
3247
// YAHOO.log('Combo complete: ' + o.data, "info", "loader");
3248
// this._combineComplete = true;
3250
var c=this._combining, len=c.length, i, m;
3251
for (i=0; i<len; i=i+1) {
3252
this.inserted[c[i]] = true;
3255
this.loadNext(o.data);
3258
loadScript = function() {
3259
// YAHOO.log('combining js: ' + js);
3260
if (js.length > startLen) {
3261
YAHOO.util.Get.script(self._filter(js), {
3262
data: self._loading,
3263
onSuccess: callback,
3264
onFailure: self._onFailure,
3265
onTimeout: self._onTimeout,
3266
insertBefore: self.insertBefore,
3267
charset: self.charset,
3268
timeout: self.timeout,
3274
// load the css first
3275
// YAHOO.log('combining css: ' + css);
3276
if (css.length > startLen) {
3277
YAHOO.util.Get.css(this._filter(css), {
3278
data: this._loading,
3279
onSuccess: loadScript,
3280
onFailure: this._onFailure,
3281
onTimeout: this._onTimeout,
3282
insertBefore: this.insertBefore,
3283
charset: this.charset,
3284
timeout: this.timeout,
3294
// this._combineComplete = true;
3295
this.loadNext(this._loading);
3300
* inserts the requested modules and their dependencies.
3301
* <code>type</code> can be "js" or "css". Both script and
3302
* css are inserted if type is not provided.
3304
* @param o optional options object
3305
* @param type {string} the type of dependency to insert
3307
insert: function(o, type) {
3309
// Y.log("insert: " + lang.dump(o, 1) + ", " + type);
3311
// Y.log("insert: " + this.toString() + ", " + type);
3314
// build the dependency list
3318
// set a flag to indicate the load has started
3319
this._loading = true;
3321
// flag to indicate we are done with the combo service
3322
// and any additional files will need to be loaded
3324
// this._combineComplete = false;
3326
// keep the loadType (js, css or undefined) cached
3327
this.loadType = type;
3330
return this._combine();
3334
// Y.log("trying to load css first");
3336
this._internalCallback = function() {
3337
self._internalCallback = null;
3338
self.insert(null, "js");
3340
this.insert(null, "css");
3351
* Interns the script for the requested modules. The callback is
3352
* provided a reference to the sandboxed YAHOO object. This only
3353
* applies to the script: css can not be sandboxed; css will be
3354
* loaded into the page normally if specified.
3356
* @param callback {Function} the callback to exectued when the load is
3359
sandbox: function(o, type) {
3361
// YAHOO.log("sandbox: " + lang.dump(o, 1) + ", " + type);
3363
// YAHOO.log("sandbox: " + this.toString() + ", " + type);
3368
if (!this.onSuccess) {
3369
throw new Error("You must supply an onSuccess handler for your sandbox");
3372
this._sandbox = true;
3376
// take care of any css first (this can't be sandboxed)
3377
if (!type || type !== "js") {
3378
this._internalCallback = function() {
3379
self._internalCallback = null;
3380
self.sandbox(null, "js");
3382
this.insert(null, "css");
3386
// get the connection manager if not on the page
3387
if (!util.Connect) {
3388
// get a new loader instance to load connection.
3389
var ld = new YAHOO.util.YUILoader();
3392
filter: this.filter,
3393
require: "connection",
3394
insertBefore: this.insertBefore,
3395
charset: this.charset,
3396
onSuccess: function() {
3397
this.sandbox(null, "js");
3404
this._scriptText = [];
3405
this._loadCount = 0;
3406
this._stopCount = this.sorted.length;
3411
var s=this.sorted, l=s.length, i, m, url;
3413
for (i=0; i<l; i=i+1) {
3414
m = this.moduleInfo[s[i]];
3416
// undefined modules cause a failure
3418
this._onFailure("undefined module " + m);
3419
for (var j=0;j<this._xhr.length;j=j+1) {
3420
this._xhr[j].abort();
3425
// css files should be done
3426
if (m.type !== "js") {
3432
url = (url) ? this._filter(url) : this._url(m.path);
3434
// YAHOO.log("xhr request: " + url + ", " + i);
3438
success: function(o) {
3440
var idx=o.argument[0], name=o.argument[2];
3442
// store the response in the position it was requested
3443
this._scriptText[idx] = o.responseText;
3445
// YAHOO.log("received: " + o.responseText.substr(0, 100) + ", " + idx);
3447
if (this.onProgress) {
3448
this.onProgress.call(this.scope, {
3450
scriptText: o.responseText,
3456
// only generate the sandbox once everything is loaded
3459
if (this._loadCount >= this._stopCount) {
3461
// the variable to find
3462
var v = this.varName || "YAHOO";
3464
// wrap the contents of the requested modules in an anonymous function
3465
var t = "(function() {\n";
3467
// return the locally scoped reference.
3468
var b = "\nreturn " + v + ";\n})();";
3470
var ref = eval(t + this._scriptText.join("\n") + b);
3472
this._pushEvents(ref);
3475
this.onSuccess.call(this.scope, {
3480
this._onFailure.call(this.varName + " reference failure");
3485
failure: function(o) {
3486
this.onFailure.call(this.scope, {
3495
// module index, module name, sandbox name
3496
argument: [i, url, s[i]]
3500
this._xhr.push(util.Connect.asyncRequest('GET', url, xhrData));
3505
* Executed every time a module is loaded, and if we are in a load
3506
* cycle, we attempt to load the next script. Public so that it
3507
* is possible to call this if using a method other than
3508
* YAHOO.register to determine when scripts are fully loaded
3510
* @param mname {string} optional the name of the module that has
3511
* been loaded (which is usually why it is time to load the next
3514
loadNext: function(mname) {
3516
// It is possible that this function is executed due to something
3517
// else one the page loading a YUI module. Only react when we
3518
// are actively loading something
3519
if (!this._loading) {
3526
// if the module that was just loaded isn't what we were expecting,
3528
if (mname !== this._loading) {
3532
// YAHOO.log("loadNext executing, just loaded " + mname);
3534
// The global handler that is called when each module is loaded
3535
// will pass that module name to this function. Storing this
3536
// data to avoid loading the same module multiple times
3537
this.inserted[mname] = true;
3539
if (this.onProgress) {
3540
this.onProgress.call(this.scope, {
3545
//var o = this.getProvides(mname);
3546
//this.inserted = lang.merge(this.inserted, o);
3549
var s=this.sorted, len=s.length, i, m;
3551
for (i=0; i<len; i=i+1) {
3553
// This.inserted keeps track of what the loader has loaded
3554
if (s[i] in this.inserted) {
3555
// YAHOO.log(s[i] + " alread loaded ");
3559
// Because rollups will cause multiple load notifications
3560
// from YAHOO, loadNext may be called multiple times for
3561
// the same module when loading a rollup. We can safely
3562
// skip the subsequent requests
3563
if (s[i] === this._loading) {
3564
// YAHOO.log("still loading " + s[i] + ", waiting");
3568
// log("inserting " + s[i]);
3569
m = this.moduleInfo[s[i]];
3572
this.onFailure.call(this.scope, {
3573
msg: "undefined module " + m,
3579
// The load type is stored to offer the possibility to load
3580
// the css separately from the script.
3581
if (!this.loadType || this.loadType === m.type) {
3582
this._loading = s[i];
3583
//YAHOO.log("attempting to load " + s[i] + ", " + this.base);
3585
var fn=(m.type === "css") ? util.Get.css : util.Get.script,
3589
self.loadNext(o.data);
3592
url = (url) ? this._filter(url) : this._url(m.path);
3594
// safari 2.x or lower, script, and part of YUI
3595
if (env.ua.webkit && env.ua.webkit < 420 && m.type === "js" &&
3597
//YUI.info.moduleInfo[s[i]]) {
3598
//YAHOO.log("using YAHOO env " + s[i] + ", " + m.varName);
3600
this._useYahooListener = true;
3606
onFailure: this._onFailure,
3607
onTimeout: this._onTimeout,
3608
insertBefore: this.insertBefore,
3609
charset: this.charset,
3610
timeout: this.timeout,
3620
this._loading = null;
3622
// internal callback for loading css first
3623
if (this._internalCallback) {
3624
var f = this._internalCallback;
3625
this._internalCallback = null;
3627
} else if (this.onSuccess) {
3629
this.onSuccess.call(this.scope, {
3637
* In IE, the onAvailable/onDOMReady events need help when Event is
3638
* loaded dynamically
3639
* @method _pushEvents
3640
* @param {Function} optional function reference
3643
_pushEvents: function(ref) {
3644
var r = ref || YAHOO;
3645
if (r.util && r.util.Event) {
3646
r.util.Event._load();
3653
* @return {string} the filtered string
3656
_filter: function(str) {
3657
var f = this.filter;
3658
return (f) ? str.replace(new RegExp(f.searchExp), f.replaceStr) : str;
3662
* Generates the full url for a module
3664
* @param path {string} the path fragment
3665
* @return {string} the full url
3668
_url: function(path) {
3670
var u = this.base || "", f=this.filter;
3672
return this._filter(u);