3
Copyright 2011 Yahoo! Inc. All rights reserved.
4
Licensed under the BSD License.
5
http://yuilibrary.com/license/
8
* The YUI module contains the components required for building the YUI seed
9
* file. This includes the script loading mechanism, a simple queue, and
10
* the core utilities for the library.
15
if (typeof YUI != 'undefined') {
20
The YUI global namespace object. If YUI is already defined, the
21
existing YUI object will not be overwritten so that defined
22
namespaces are preserved. It is the constructor for the object
23
the end user interacts with. As indicated below, each instance
24
has full custom event support, but only if the event system
25
is available. This is a self-instantiable factory function. You
26
can invoke it directly like this:
28
YUI().use('*', function(Y) {
32
But it also works like this:
40
@param o* {Object} 0..n optional configuration objects. these values
41
are store in Y.config. See <a href="config.html">Config</a> for the list of supported
46
var YUI = function() {
51
instanceOf = function(o, type) {
52
return (o && o.hasOwnProperty && (o instanceof type));
54
gconf = (typeof YUI_config !== 'undefined') && YUI_config;
56
if (!(instanceOf(Y, YUI))) {
59
// set up the core environment
63
YUI.GlobalConfig is a master configuration that might span
64
multiple contexts in a non-browser environment. It is applied
65
first to all instances in all contexts.
66
@property GlobalConfig
77
YUI().use('node', function(Y) {
78
//debug files used here
83
}).use('node', function(Y) {
88
if (YUI.GlobalConfig) {
89
Y.applyConfig(YUI.GlobalConfig);
93
YUI_config is a page-level config. It is applied to all
94
instances created on the page. This is applied after
95
YUI.GlobalConfig, and before the instance level configuration
103
//Single global var to include before YUI seed file
108
YUI().use('node', function(Y) {
109
//debug files used here
114
}).use('node', function(Y) {
115
//min files used here
119
Y.applyConfig(gconf);
122
// bind the specified additional modules for this instance
129
// Each instance can accept one or more configuration objects.
130
// These are applied after YUI.GlobalConfig and YUI_Config,
131
// overriding values set in those config files if there is a '
132
// matching property.
134
Y.applyConfig(args[i]);
140
Y.instanceOf = instanceOf;
150
BASE = 'http://yui.yahooapis.com/',
151
DOC_LABEL = 'yui3-js-enabled',
152
NOOP = function() {},
153
SLICE = Array.prototype.slice,
154
APPLY_TO_AUTH = { 'io.xdrReady': 1, // the functions applyTo
155
'io.xdrResponse': 1, // can call. this should
156
'SWF.eventHandler': 1 }, // be done at build time
157
hasWin = (typeof window != 'undefined'),
158
win = (hasWin) ? window : null,
159
doc = (hasWin) ? win.document : null,
160
docEl = doc && doc.documentElement,
161
docClass = docEl && docEl.className,
163
time = new Date().getTime(),
164
add = function(el, type, fn, capture) {
165
if (el && el.addEventListener) {
166
el.addEventListener(type, fn, capture);
167
} else if (el && el.attachEvent) {
168
el.attachEvent('on' + type, fn);
171
remove = function(el, type, fn, capture) {
172
if (el && el.removeEventListener) {
173
// this can throw an uncaught exception in FF
175
el.removeEventListener(type, fn, capture);
177
} else if (el && el.detachEvent) {
178
el.detachEvent('on' + type, fn);
181
handleLoad = function() {
182
YUI.Env.windowLoaded = true;
183
YUI.Env.DOMReady = true;
185
remove(window, 'load', handleLoad);
188
getLoader = function(Y, o) {
189
var loader = Y.Env._loader;
191
//loader._config(Y.config);
192
loader.ignoreRegistered = false;
195
loader.required = [];
196
loader.loadType = null;
198
loader = new Y.Loader(Y.config);
199
Y.Env._loader = loader;
201
YUI.Env.core = Y.Array.dedupe([].concat(YUI.Env.core, [ 'loader-base', 'loader-rollup', 'loader-yui3' ]));
206
clobber = function(r, s) {
208
if (s.hasOwnProperty(i)) {
214
ALREADY_DONE = { success: true };
216
// Stamp the documentElement (HTML) with a class of "yui-loaded" to
217
// enable styles that need to key off of JS being enabled.
218
if (docEl && docClass.indexOf(DOC_LABEL) == -1) {
222
docClass += DOC_LABEL;
223
docEl.className = docClass;
226
if (VERSION.indexOf('@') > -1) {
227
VERSION = '3.3.0'; // dev time hack for cdn test
232
* Applies a new configuration object to the YUI instance config.
233
* This will merge new group/module definitions, and will also
234
* update the loader cache if necessary. Updating Y.config directly
235
* will not update the cache.
236
* @method applyConfig
237
* @param {Object} o the configuration object.
240
applyConfig: function(o) {
247
config = this.config,
248
mods = config.modules,
249
groups = config.groups,
251
loader = this.Env._loader;
254
if (o.hasOwnProperty(name)) {
256
if (mods && name == 'modules') {
258
} else if (groups && name == 'groups') {
259
clobber(groups, attr);
260
} else if (rls && name == 'rls') {
262
} else if (name == 'win') {
263
config[name] = attr.contentWindow || attr;
264
config.doc = config[name].document;
265
} else if (name == '_yuid') {
278
* Old way to apply a config to the instance (calls `applyConfig` under the hood)
281
* @param {Object} o The config to apply
283
_config: function(o) {
288
* Initialize this YUI instance
300
* The version number of the YUI instance.
308
core: ['get','features','intl-base','yui-log','yui-later','loader-base', 'loader-rollup', 'loader-yui3'],
309
mods: {}, // flat module map
310
versions: {}, // version module map
312
cdn: BASE + VERSION + '/build/',
313
// bootstrapped: false,
324
// I'll start at the \b(simpleyui).
325
// 1. Look in the test string for "simpleyui" or "yui" or
326
// "yui-base" or "yui-rls" or "yui-foobar" that comes after a word break. That is, it
327
// can't match "foyui" or "i_heart_simpleyui". This can be anywhere in the string.
328
// 2. After #1 must come a forward slash followed by the string matched in #1, so
329
// "yui-base/yui-base" or "simpleyui/simpleyui" or "yui-pants/yui-pants".
330
// 3. The second occurence of the #1 token can optionally be followed by "-debug" or "-min",
331
// so "yui/yui-min", "yui/yui-debug", "yui-base/yui-base-debug". NOT "yui/yui-tshirt".
332
// 4. This is followed by ".js", so "yui/yui.js", "simpleyui/simpleyui-min.js"
333
// 0. Going back to the beginning, now. If all that stuff in 1-4 comes after a "?" in the string,
334
// then capture the junk between the LAST "&" and the string in 1-4. So
335
// "blah?foo/yui/yui.js" will capture "foo/" and "blah?some/thing.js&3.3.0/build/yui-rls/yui-rls.js"
336
// will capture "3.3.0/build/"
340
// (?:[^&]*&) followed by 0..n characters followed by an &
341
// * in fact, find as many sets of characters followed by a & as you can
342
// ([^&]*) capture the stuff after the last & in \1
343
// )? but it's ok if all this ?junk&more_junk stuff isn't even there
344
// \b(simpleyui| after a word break find either the string "simpleyui" or
345
// yui(?:-\w+)? the string "yui" optionally followed by a -, then more characters
346
// ) and store the simpleyui or yui-* string in \2
347
// \/\2 then comes a / followed by the simpleyui or yui-* string in \2
348
// (?:-(min|debug))? optionally followed by "-min" or "-debug"
349
// .js and ending in ".js"
350
_BASE_RE: /(?:\?(?:[^&]*&)*([^&]*))?\b(simpleyui|yui(?:-\w+)?)\/\2(?:-(min|debug))?\.js/,
351
parseBasePath: function(src, pattern) {
352
var match = src.match(pattern),
356
path = RegExp.leftContext || src.slice(0, src.indexOf(match[0]));
358
// this is to set up the path to the loader. The file
359
// filter for loader should match the yui include.
362
// extract correct path for mixed combo urls
363
// http://yuilibrary.com/projects/yui3/ticket/2528423
365
path += '?' + match[1];
374
getBase: G_ENV && G_ENV.getBase ||
376
var nodes = (doc && doc.getElementsByTagName('script')) || [],
377
path = Env.cdn, parsed,
380
for (i = 0, len = nodes.length; i < len; ++i) {
383
parsed = Y.Env.parseBasePath(src, pattern);
385
filter = parsed.filter;
400
Env._loaded[VERSION] = {};
402
if (G_ENV && Y !== YUI) {
403
Env._yidx = ++G_ENV._yidx;
404
Env._guidp = ('yui_' + VERSION + '_' +
405
Env._yidx + '_' + time).replace(/\./g, '_');
406
} else if (YUI._YUI) {
408
G_ENV = YUI._YUI.Env;
409
Env._yidx += G_ENV._yidx;
410
Env._uidx += G_ENV._uidx;
412
for (prop in G_ENV) {
413
if (!(prop in Env)) {
414
Env[prop] = G_ENV[prop];
428
// configuration defaults
429
Y.config = Y.config || {
433
useBrowserConsole: true,
442
if (YUI.Env.rls_disabled) {
443
Y.config.use_rls = false;
446
Y.config.lang = Y.config.lang || 'en-US';
448
Y.config.base = YUI.config.base || Y.Env.getBase(Y.Env._BASE_RE);
450
if (!filter || (!('mindebug').indexOf(filter))) {
453
filter = (filter) ? '-' + filter : filter;
454
Y.config.loaderPath = YUI.config.loaderPath || 'loader/loader' + filter + '.js';
459
* Finishes the instance setup. Attaches whatever modules were defined
460
* when the yui modules was registered.
464
_setup: function(o) {
468
//extras = Y.config.core || ['get','features','intl-base','yui-log','yui-later','loader-base', 'loader-rollup', 'loader-yui3'];
469
extras = Y.config.core || [].concat(YUI.Env.core); //Clone it..
471
for (i = 0; i < extras.length; i++) {
472
if (mods[extras[i]]) {
473
core.push(extras[i]);
477
Y._attach(['yui-base']);
484
// Y.log(Y.id + ' initialized', 'info', 'yui');
488
* Executes a method on a YUI instance with
489
* the specified id if the specified method is whitelisted.
491
* @param id {String} the YUI instance id.
492
* @param method {String} the name of the method to exectute.
494
* @param args {Array} the arguments to apply to the method.
495
* @return {Object} the return value from the applied method or null.
497
applyTo: function(id, method, args) {
498
if (!(method in APPLY_TO_AUTH)) {
499
this.log(method + ': applyTo not allowed', 'warn', 'yui');
503
var instance = instances[id], nest, m, i;
505
nest = method.split('.');
507
for (i = 0; i < nest.length; i = i + 1) {
510
this.log('applyTo not found: ' + method, 'warn', 'yui');
513
return m.apply(instance, args);
520
Registers a module with the YUI global. The easiest way to create a
521
first-class YUI module is to use the YUI component build tool.
523
http://yuilibrary.com/projects/builder
525
The build system will produce the `YUI.add` wrapper for you module, along
526
with any configuration info required for the module.
528
@param name {String} module name.
529
@param fn {Function} entry point into the module that is used to bind module to the YUI instance.
530
@param {YUI} fn.Y The YUI instance this module is executed in.
531
@param {String} fn.name The name of the module
532
@param version {String} version string.
533
@param details {Object} optional config data:
534
@param details.requires {Array} features that must be present before this module can be attached.
535
@param details.optional {Array} optional features that should be present if loadOptional
536
is defined. Note: modules are not often loaded this way in YUI 3,
537
but this field is still useful to inform the user that certain
538
features in the component will require additional dependencies.
539
@param details.use {Array} features that are included within this module which need to
540
be attached automatically when this module is attached. This
541
supports the YUI 3 rollup system -- a module with submodules
542
defined will need to have the submodules listed in the 'use'
543
config. The YUI component build tool does this for you.
544
@return {YUI} the YUI instance.
547
YUI.add('davglass', function(Y, name) {
548
Y.davglass = function() {
549
alert('Dav was here!');
551
}, '3.4.0', { requires: ['yui-base', 'harley-davidson', 'mt-dew'] });
554
add: function(name, fn, version, details) {
555
details = details || {};
564
i, versions = env.versions;
566
env.mods[name] = mod;
567
versions[version] = versions[version] || {};
568
versions[version][name] = mod;
570
for (i in instances) {
571
if (instances.hasOwnProperty(i)) {
572
loader = instances[i].Env._loader;
574
if (!loader.moduleInfo[name]) {
575
loader.addModule(details, name);
585
* Executes the function associated with each required
586
* module, binding the module to the YUI instance.
587
* @param {Array} r The array of modules to attach
588
* @param {Boolean} [moot=false] Don't throw a warning if the module is not attached
592
_attach: function(r, moot) {
593
var i, name, mod, details, req, use, after,
595
aliases = YUI.Env.aliases,
597
loader = Y.Env._loader,
598
done = Y.Env._attached,
599
len = r.length, loader,
602
//Check for conditional modules (in a second+ instance) and add their requirements
603
//TODO I hate this entire method, it needs to be fixed ASAP (3.5.0) ^davglass
604
for (i = 0; i < len; i++) {
608
if (loader && loader.conditions[name]) {
609
Y.Object.each(loader.conditions[name], function(def) {
610
var go = def && ((def.ua && Y.UA[def.ua]) || (def.test && def.test(Y)));
620
for (i = 0; i < len; i++) {
625
if (aliases && aliases[name]) {
626
Y._attach(aliases[name]);
630
if (loader && loader.moduleInfo[name]) {
631
mod = loader.moduleInfo[name];
635
// Y.log('no js def for: ' + name, 'info', 'yui');
637
//if (!loader || !loader.moduleInfo[name]) {
638
//if ((!loader || !loader.moduleInfo[name]) && !moot) {
640
if ((name.indexOf('skin-') === -1) && (name.indexOf('css') === -1)) {
641
Y.Env._missed.push(name);
642
Y.Env._missed = Y.Array.dedupe(Y.Env._missed);
643
Y.message('NOT loaded: ' + name, 'warn', 'yui');
648
//Don't like this, but in case a mod was asked for once, then we fetch it
649
//We need to remove it from the missed list ^davglass
650
for (j = 0; j < Y.Env._missed.length; j++) {
651
if (Y.Env._missed[j] === name) {
652
Y.message('Found: ' + name + ' (was reported as missing earlier)', 'warn', 'yui');
653
Y.Env._missed.splice(j, 1);
656
details = mod.details;
657
req = details.requires;
659
after = details.after;
662
for (j = 0; j < req.length; j++) {
664
if (!Y._attach(req)) {
673
for (j = 0; j < after.length; j++) {
674
if (!done[after[j]]) {
675
if (!Y._attach(after, true)) {
687
Y.error('Attach error: ' + name, e, name);
693
for (j = 0; j < use.length; j++) {
695
if (!Y._attach(use)) {
713
* Attaches one or more modules to the YUI instance. When this
714
* is executed, the requirements are analyzed, and one of
715
* several things can happen:
717
* * All requirements are available on the page -- The modules
718
* are attached to the instance. If supplied, the use callback
719
* is executed synchronously.
721
* * Modules are missing, the Get utility is not available OR
722
* the 'bootstrap' config is false -- A warning is issued about
723
* the missing modules and all available modules are attached.
725
* * Modules are missing, the Loader is not available but the Get
726
* utility is and boostrap is not false -- The loader is bootstrapped
727
* before doing the following....
729
* * Modules are missing and the Loader is available -- The loader
730
* expands the dependency tree and fetches missing modules. When
731
* the loader is finshed the callback supplied to use is executed
735
* @param modules* {String} 1-n modules to bind (uses arguments array).
736
* @param *callback {Function} callback function executed when
737
* the instance has the required functionality. If included, it
738
* must be the last parameter.
741
* // loads and attaches dd and its dependencies
742
* YUI().use('dd', function(Y) {});
744
* // loads and attaches dd and node as well as all of their dependencies (since 3.4.0)
745
* YUI().use(['dd', 'node'], function(Y) {});
747
* // attaches all modules that are available on the page
748
* YUI().use('*', function(Y) {});
750
* // intrinsic YUI gallery support (since 3.1.0)
751
* YUI().use('gallery-yql', function(Y) {});
753
* // intrinsic YUI 2in3 support (since 3.1.0)
754
* YUI().use('yui2-datatable', function(Y) {});
756
* @return {YUI} the YUI instance.
759
var args = SLICE.call(arguments, 0),
760
callback = args[args.length - 1],
767
// The last argument supplied to use can be a load complete callback
768
if (Y.Lang.isFunction(callback)) {
773
if (Y.Lang.isArray(args[0])) {
777
if (Y.config.cacheUse) {
778
while ((name = args[i++])) {
779
if (!Env._attached[name]) {
787
Y.log('already provisioned: ' + args, 'info', 'yui');
789
Y._notify(callback, ALREADY_DONE, args);
795
Y._useQueue = Y._useQueue || new Y.Queue();
796
Y._useQueue.add([args, callback]);
798
Y._use(args, function(Y, response) {
799
Y._notify(callback, response, args);
806
* Notify handler from Loader for attachment/load errors
808
* @param callback {Function} The callback to pass to the `Y.config.loadErrorFn`
809
* @param response {Object} The response returned from Loader
810
* @param args {Array} The aruments passed from Loader
813
_notify: function(callback, response, args) {
814
if (!response.success && this.config.loadErrorFn) {
815
this.config.loadErrorFn.call(this, this, callback, response, args);
816
} else if (callback) {
818
callback(this, response);
820
this.error('use callback error', e, args);
826
* This private method is called from the `use` method queue. To ensure that only one set of loading
827
* logic is performed at a time.
830
* @param args* {String} 1-n modules to bind (uses arguments array).
831
* @param *callback {Function} callback function executed when
832
* the instance has the required functionality. If included, it
833
* must be the last parameter.
835
_use: function(args, callback) {
838
this._attach(['yui-base']);
841
var len, loader, handleBoot, handleRLS,
847
queue = G_ENV._loaderQueue,
851
boot = config.bootstrap,
855
fetchCSS = config.fetchCSS,
856
process = function(names, skip) {
862
YArray.each(names, function(name) {
864
// add this module to full list of things to attach
869
// only attach a module once
874
var m = mods[name], req, use;
878
req = m.details.requires;
881
// CSS files don't register themselves, see if it has
883
if (!G_ENV._loaded[VERSION][name]) {
886
used[name] = true; // probably css
890
// make sure requirements are attached
891
if (req && req.length) {
895
// make sure we grab the submodule dependencies too
896
if (use && use.length) {
902
handleLoader = function(fromLoader) {
903
var response = fromLoader || {
909
data = response.data;
915
origMissing = missing;
919
redo = missing.length;
921
if (missing.sort().join() ==
922
origMissing.sort().join()) {
930
Y._use(args, function() {
931
Y.log('Nested use callback: ' + data, 'info', 'yui');
932
if (Y._attach(data)) {
933
Y._notify(callback, response, data);
938
// Y.log('attaching from loader: ' + data, 'info', 'yui');
939
ret = Y._attach(data);
942
Y._notify(callback, response, args);
946
if (Y._useQueue && Y._useQueue.size() && !Y._loading) {
947
Y._use.apply(Y, Y._useQueue.next());
952
// Y.log(Y.id + ': use called: ' + a + ' :: ' + callback, 'info', 'yui');
954
// YUI().use('*'); // bind everything available
955
if (firstArg === '*') {
956
ret = Y._attach(Y.Object.keys(mods));
963
// Y.log('before loader requirements: ' + args, 'info', 'yui');
965
// use loader to expand dependencies and sort the
966
// requirements if it is available.
967
if (boot && Y.Loader && args.length) {
968
loader = getLoader(Y);
969
loader.require(args);
970
loader.ignoreRegistered = true;
971
loader.calculate(null, (fetchCSS) ? null : 'js');
972
args = loader.sorted;
975
// process each requirement and any additional requirements
976
// the module metadata specifies
979
len = missing.length;
982
missing = Y.Object.keys(YArray.hash(missing));
983
len = missing.length;
984
Y.log('Modules missing: ' + missing + ', ' + missing.length, 'info', 'yui');
989
if (boot && len && Y.Loader) {
990
// Y.log('Using loader to fetch missing deps: ' + missing, 'info', 'yui');
991
Y.log('Using Loader', 'info', 'yui');
993
loader = getLoader(Y);
994
loader.onEnd = handleLoader;
997
loader.ignoreRegistered = false;
998
loader.require(args);
999
loader.insert(null, (fetchCSS) ? null : 'js');
1000
// loader.partial(missing, (fetchCSS) ? null : 'js');
1002
} else if (len && Y.config.use_rls && !YUI.Env.rls_enabled) {
1004
G_ENV._rls_queue = G_ENV._rls_queue || new Y.Queue();
1006
// server side loader service
1007
handleRLS = function(instance, argz) {
1009
var rls_end = function(o) {
1011
instance.rls_advance();
1013
rls_url = instance._rls(argz);
1016
Y.log('Fetching RLS url', 'info', 'rls');
1017
instance.rls_oncomplete(function(o) {
1020
instance.Get.script(rls_url, {
1022
timeout: instance.config.rls_timeout,
1023
onFailure: instance.rls_handleFailure,
1024
onTimeout: instance.rls_handleTimeout
1034
G_ENV._rls_queue.add(function() {
1035
Y.log('executing queued rls request', 'info', 'rls');
1036
G_ENV._rls_in_progress = true;
1037
Y.rls_callback = callback;
1038
Y.rls_locals(Y, args, handleRLS);
1041
if (!G_ENV._rls_in_progress && G_ENV._rls_queue.size()) {
1042
G_ENV._rls_queue.next()();
1045
} else if (boot && len && Y.Get && !Env.bootstrapped) {
1049
handleBoot = function() {
1051
queue.running = false;
1052
Env.bootstrapped = true;
1053
G_ENV._bootstrapping = false;
1054
if (Y._attach(['loader'])) {
1055
Y._use(args, callback);
1059
if (G_ENV._bootstrapping) {
1060
Y.log('Waiting for loader', 'info', 'yui');
1061
queue.add(handleBoot);
1063
G_ENV._bootstrapping = true;
1064
Y.log('Fetching loader: ' + config.base + config.loaderPath, 'info', 'yui');
1065
Y.Get.script(config.base + config.loaderPath, {
1071
Y.log('Attaching available dependencies: ' + args, 'info', 'yui');
1072
ret = Y._attach(args);
1083
Adds a namespace object onto the YUI global if called statically.
1085
// creates YUI.your.namespace.here as nested objects
1086
YUI.namespace("your.namespace.here");
1088
If called as a method on a YUI <em>instance</em>, it creates the
1089
namespace on the instance.
1091
// creates Y.property.package
1092
Y.namespace("property.package");
1094
Dots in the input string cause `namespace` to create nested objects for
1095
each token. If any part of the requested namespace already exists, the
1096
current object will be left in place. This allows multiple calls to
1097
`namespace` to preserve existing namespaced properties.
1099
If the first token in the namespace string is "YAHOO", the token is
1102
Be careful with namespace tokens. Reserved words may work in some browsers
1103
and not others. For instance, the following will fail in some browsers
1104
because the supported version of JavaScript reserves the word "long":
1106
Y.namespace("really.long.nested.namespace");
1109
@param {String} namespace* namespaces to create.
1110
@return {Object} A reference to the last namespace object created.
1112
namespace: function() {
1113
var a = arguments, o = this, i = 0, j, d, arg;
1114
for (; i < a.length; i++) {
1115
// d = ('' + a[i]).split('.');
1117
if (arg.indexOf(PERIOD)) {
1118
d = arg.split(PERIOD);
1119
for (j = (d[0] == 'YAHOO') ? 1 : 0; j < d.length; j++) {
1120
o[d[j]] = o[d[j]] || {};
1124
o[arg] = o[arg] || {};
1130
// this is replaced if the log module is included
1133
// this is replaced if the dump module is included
1134
dump: function (o) { return ''+o; },
1137
* Report an error. The reporting mechanism is controled by
1138
* the `throwFail` configuration attribute. If throwFail is
1139
* not specified, the message is written to the Logger, otherwise
1140
* a JS error is thrown
1142
* @param msg {String} the error message.
1143
* @param e {Error|String} Optional JS error that was caught, or an error string.
1144
* @param data Optional additional info
1145
* and `throwFail` is specified, this error will be re-thrown.
1146
* @return {YUI} this YUI instance.
1148
error: function(msg, e, data) {
1152
if (Y.config.errorFn) {
1153
ret = Y.config.errorFn.apply(Y, arguments);
1156
if (Y.config.throwFail && !ret) {
1157
throw (e || new Error(msg));
1159
Y.message(msg, 'error'); // don't scrub this one
1166
* Generate an id that is unique among all YUI instances
1168
* @param pre {String} optional guid prefix.
1169
* @return {String} the guid.
1171
guid: function(pre) {
1172
var id = this.Env._guidp + '_' + (++this.Env._uidx);
1173
return (pre) ? (pre + id) : id;
1177
* Returns a `guid` associated with an object. If the object
1178
* does not have one, a new one is created unless `readOnly`
1181
* @param o {Object} The object to stamp.
1182
* @param readOnly {Boolean} if `true`, a valid guid will only
1183
* be returned if the object has one assigned to it.
1184
* @return {String} The object's guid or null.
1186
stamp: function(o, readOnly) {
1192
// IE generates its own unique ID for dom nodes
1193
// The uniqueID property of a document node returns a new ID
1194
if (o.uniqueID && o.nodeType && o.nodeType !== 9) {
1197
uid = (typeof o === 'string') ? o : o._yuid;
1214
* Destroys the YUI instance
1218
destroy: function() {
1223
delete instances[Y.id];
1229
* instanceof check for objects that works around
1230
* memory leak in IE when the item tested is
1232
* @method instanceOf
1239
YUI.prototype = proto;
1241
// inheritance utilities are not available yet
1242
for (prop in proto) {
1243
if (proto.hasOwnProperty(prop)) {
1244
YUI[prop] = proto[prop];
1248
// set up the environment
1252
// add a window load event at load time so we can capture
1253
// the case where it fires before dynamic loading is
1255
add(window, 'load', handleLoad);
1261
YUI.Env.remove = remove;
1264
// Support the CommonJS method for exporting our single global
1265
if (typeof exports == 'object') {
1273
* The config object contains all of the configuration options for
1274
* the `YUI` instance. This object is supplied by the implementer
1275
* when instantiating a `YUI` instance. Some properties have default
1276
* values if they are not supplied by the implementer. This should
1277
* not be updated directly because some values are cached. Use
1278
* `applyConfig()` to update the config object on a YUI instance that
1279
* has already been configured.
1286
* Allows the YUI seed file to fetch the loader component and library
1287
* metadata to dynamically load additional dependencies.
1289
* @property bootstrap
1295
* Log to the browser console if debug is on and the browser has a
1296
* supported console.
1298
* @property useBrowserConsole
1304
* A hash of log sources that should be logged. If specified, only
1305
* log messages from these sources will be logged.
1307
* @property logInclude
1312
* A hash of log sources that should be not be logged. If specified,
1313
* all sources are logged if not on this list.
1315
* @property logExclude
1320
* Set to true if the yui seed file was dynamically loaded in
1321
* order to bootstrap components relying on the window load event
1322
* and the `domready` custom event.
1324
* @property injected
1330
* If `throwFail` is set, `Y.error` will generate or re-throw a JS Error.
1331
* Otherwise the failure is logged.
1333
* @property throwFail
1339
* The window/frame that this instance should operate in.
1343
* @default the window hosting YUI
1347
* The document associated with the 'win' configuration.
1351
* @default the document hosting YUI
1355
* A list of modules that defines the YUI core (overrides the default).
1362
* A list of languages in order of preference. This list is matched against
1363
* the list of available languages in modules that the YUI instance uses to
1364
* determine the best possible localization of language sensitive modules.
1365
* Languages are represented using BCP 47 language tags, such as "en-GB" for
1366
* English as used in the United Kingdom, or "zh-Hans-CN" for simplified
1367
* Chinese as used in China. The list can be provided as a comma-separated
1368
* list or as an array.
1371
* @type string|string[]
1375
* The default date format
1376
* @property dateFormat
1378
* @deprecated use configuration in `DataType.Date.format()` instead.
1382
* The default locale
1385
* @deprecated use `config.lang` instead.
1389
* The default interval when polling in milliseconds.
1390
* @property pollInterval
1396
* The number of dynamic nodes to insert by default before
1397
* automatically removing them. This applies to script nodes
1398
* because removing the node will not make the evaluated script
1399
* unavailable. Dynamic CSS is not auto purged, because removing
1400
* a linked style sheet will also remove the style definitions.
1401
* @property purgethreshold
1407
* The default interval when polling in milliseconds.
1408
* @property windowResizeDelay
1414
* Base directory for dynamic loading
1420
* The secure base dir (not implemented)
1421
* For dynamic loading.
1422
* @property secureBase
1427
* The YUI combo service base dir. Ex: `http://yui.yahooapis.com/combo?`
1428
* For dynamic loading.
1429
* @property comboBase
1434
* The root path to prepend to module path for the combo service.
1435
* Ex: 3.0.0b1/build/
1436
* For dynamic loading.
1442
* A filter to apply to result urls. This filter will modify the default
1443
* path for all modules. The default path for the YUI library is the
1444
* minified version of the files (e.g., event-min.js). The filter property
1445
* can be a predefined filter or a custom filter. The valid predefined
1449
* <dd>Selects the debug versions of the library (e.g., event-debug.js).
1450
* This option will automatically include the Logger widget</dd>
1452
* <dd>Selects the non-minified version of the library (e.g., event.js).</dd>
1454
* You can also define a custom filter, which must be an object literal
1455
* containing a search expression and a replace string:
1458
* 'searchExp': "-min\\.js",
1459
* 'replaceStr': "-debug.js"
1462
* For dynamic loading.
1465
* @type string|object
1469
* The `skin` config let's you configure application level skin
1470
* customizations. It contains the following attributes which
1471
* can be specified to override the defaults:
1473
* // The default skin, which is automatically applied if not
1474
* // overriden by a component-specific skin definition.
1475
* // Change this in to apply a different skin globally
1476
* defaultSkin: 'sam',
1478
* // This is combined with the loader base property to get
1479
* // the default root directory for a skin.
1480
* base: 'assets/skins/',
1482
* // Any component-specific overrides can be specified here,
1483
* // making it possible to load different skins for different
1484
* // components. It is possible to load more than one skin
1485
* // for a given component as well.
1487
* slider: ['capsule', 'round']
1490
* For dynamic loading.
1496
* Hash of per-component filter specification. If specified for a given
1497
* component, this overrides the filter config.
1499
* For dynamic loading.
1505
* Use the YUI combo service to reduce the number of http connections
1506
* required to load your dependencies. Turning this off will
1507
* disable combo handling for YUI and all module groups configured
1508
* with a combo service.
1510
* For dynamic loading.
1514
* @default true if 'base' is not supplied, false if it is.
1518
* A list of modules that should never be dynamically loaded
1525
* A list of modules that should always be loaded when required, even if already
1526
* present on the page.
1533
* Node or id for a node that should be used as the insertion point for new
1534
* nodes. For dynamic loading.
1536
* @property insertBefore
1541
* Object literal containing attributes to add to dynamically loaded script
1543
* @property jsAttributes
1548
* Object literal containing attributes to add to dynamically loaded link
1550
* @property cssAttributes
1555
* Number of milliseconds before a timeout occurs when dynamically
1556
* loading nodes. If not set, there is no timeout.
1562
* Callback for the 'CSSComplete' event. When dynamically loading YUI
1563
* components with CSS, this property fires when the CSS is finished
1564
* loading but script loading is still ongoing. This provides an
1565
* opportunity to enhance the presentation of a loading page a little
1566
* bit before the entire loading process is done.
1573
* A hash of module definitions to add to the list of YUI components.
1574
* These components can then be dynamically loaded side by side with
1575
* YUI via the `use()` method. This is a hash, the key is the module
1576
* name, and the value is an object literal specifying the metdata
1577
* for the module. See `Loader.addModule` for the supported module
1578
* metadata fields. Also see groups, which provides a way to
1579
* configure the base and combo spec for a set of modules.
1583
* requires: ['node'],
1584
* fullpath: 'http://myserver.mydomain.com/mymod1/mymod1.js'
1587
* requires: ['mymod1'],
1588
* fullpath: 'http://myserver.mydomain.com/mymod2/mymod2.js'
1597
* A hash of module group definitions. It for each group you
1598
* can specify a list of modules and the base path and
1599
* combo spec to use when dynamically loading the modules.
1603
* // specify whether or not this group has a combo service
1606
* // the base path for non-combo paths
1607
* base: 'http://yui.yahooapis.com/2.8.0r4/build/',
1609
* // the path to the combo service
1610
* comboBase: 'http://yui.yahooapis.com/combo?',
1612
* // a fragment to prepend to the path attribute when
1613
* // when building combo urls
1614
* root: '2.8.0r4/build/',
1616
* // the module definitions
1619
* path: "yahoo-dom-event/yahoo-dom-event.js"
1622
* path: "animation/animation.js",
1623
* requires: ['yui2_yde']
1634
* The loader 'path' attribute to the loader itself. This is combined
1635
* with the 'base' attribute to dynamically load the loader component
1636
* when boostrapping with the get utility alone.
1638
* @property loaderPath
1640
* @default loader/loader-min.js
1644
* Specifies whether or not YUI().use(...) will attempt to load CSS
1645
* resources at all. Any truthy value will cause CSS dependencies
1646
* to load when fetching script. The special value 'force' will
1647
* cause CSS dependencies to be loaded even if no script is needed.
1649
* @property fetchCSS
1650
* @type boolean|string
1655
* The default gallery version to build gallery module urls
1662
* The default YUI 2 version to build yui2 module urls. This is for
1663
* intrinsic YUI 2 support via the 2in3 project. Also see the '2in3'
1664
* config for pulling different revisions of the wrapped YUI 2
1673
* The 2in3 project is a deployment of the various versions of YUI 2
1674
* deployed as first-class YUI 3 modules. Eventually, the wrapper
1675
* for the modules will change (but the underlying YUI 2 code will
1676
* be the same), and you can select a particular version of
1677
* the wrapper modules via this config.
1685
* Alternative console log function for use in environments without
1686
* a supported native console. The function is executed in the
1687
* YUI instance context.
1694
* A callback to execute when Y.error is called. It receives the
1695
* error message and an javascript error object if Y.error was
1696
* executed because a javascript error was caught. The function
1697
* is executed in the YUI instance context.
1705
* A callback to execute when the loader fails to load one or
1706
* more resource. This could be because of a script load
1707
* failure. It can also fail if a javascript module fails
1708
* to register itself, but only when the 'requireRegistration'
1709
* is true. If this function is defined, the use() callback will
1710
* only be called when the loader succeeds, otherwise it always
1711
* executes unless there was a javascript error when attaching
1715
* @property loadErrorFn
1720
* When set to true, the YUI loader will expect that all modules
1721
* it is responsible for loading will be first-class YUI modules
1722
* that register themselves with the YUI global. If this is
1723
* set to true, loader will fail if the module registration fails
1724
* to happen after the script is loaded.
1727
* @property requireRegistration
1733
* Cache serviced use() requests.
1735
* @property cacheUse
1738
* @deprecated no longer used
1742
* The parameter defaults for the remote loader service. **Requires the rls seed file.** The properties that are supported:
1744
* * `m`: comma separated list of module requirements. This
1745
* must be the param name even for custom implemetations.
1746
* * `v`: the version of YUI to load. Defaults to the version
1747
* of YUI that is being used.
1748
* * `gv`: the version of the gallery to load (see the gallery config)
1749
* * `env`: comma separated list of modules already on the page.
1750
* this must be the param name even for custom implemetations.
1751
* * `lang`: the languages supported on the page (see the lang config)
1752
* * `'2in3v'`: the version of the 2in3 wrapper to use (see the 2in3 config).
1753
* * `'2v'`: the version of yui2 to use in the yui 2in3 wrappers
1754
* * `filt`: a filter def to apply to the urls (see the filter config).
1755
* * `filts`: a list of custom filters to apply per module
1756
* * `tests`: this is a map of conditional module test function id keys
1757
* with the values of 1 if the test passes, 0 if not. This must be
1758
* the name of the querystring param in custom templates.
1766
* The base path to the remote loader service. **Requires the rls seed file.**
1769
* @property rls_base
1774
* The template to use for building the querystring portion
1775
* of the remote loader service url. The default is determined
1776
* by the rls config -- each property that has a value will be
1777
* represented. **Requires the rls seed file.**
1780
* @property rls_tmpl
1783
* m={m}&v={v}&env={env}&lang={lang}&filt={filt}&tests={tests}
1788
* Configure the instance to use a remote loader service instead of
1789
* the client loader. **Requires the rls seed file.**
1795
YUI.add('yui-base', function(Y) {
1800
* @submodule yui-base
1803
* The YUI module contains the components required for building the YUI
1804
* seed file. This includes the script loading mechanism, a simple queue,
1805
* and the core utilities for the library.
1807
* @submodule yui-base
1811
* Provides core language utilites and extensions used throughout YUI.
1817
var L = Y.Lang || (Y.Lang = {}),
1819
STRING_PROTO = String.prototype,
1820
TOSTRING = Object.prototype.toString,
1823
'undefined' : 'undefined',
1824
'number' : 'number',
1825
'boolean' : 'boolean',
1826
'string' : 'string',
1827
'[object Function]': 'function',
1828
'[object RegExp]' : 'regexp',
1829
'[object Array]' : 'array',
1830
'[object Date]' : 'date',
1831
'[object Error]' : 'error'
1834
SUBREGEX = /\{\s*([^|}]+?)\s*(?:\|([^}]*))?\s*\}/g,
1835
TRIMREGEX = /^\s+|\s+$/g,
1837
// If either MooTools or Prototype is on the page, then there's a chance that we
1838
// can't trust "native" language features to actually be native. When this is
1839
// the case, we take the safe route and fall back to our own non-native
1842
unsafeNatives = win && !!(win.MooTools || win.Prototype);
1845
* Determines whether or not the provided item is an array.
1847
* Returns `false` for array-like collections such as the function `arguments`
1848
* collection or `HTMLElement` collections. Use `Y.Array.test()` if you want to
1849
* test for an array-like collection.
1852
* @param o The object to test.
1853
* @return {boolean} true if o is an array.
1856
L.isArray = (!unsafeNatives && Array.isArray) || function (o) {
1857
return L.type(o) === 'array';
1861
* Determines whether or not the provided item is a boolean.
1864
* @param o The object to test.
1865
* @return {boolean} true if o is a boolean.
1867
L.isBoolean = function(o) {
1868
return typeof o === 'boolean';
1873
* Determines whether or not the provided item is a function.
1874
* Note: Internet Explorer thinks certain functions are objects:
1878
* var obj = document.createElement("object");
1879
* Y.Lang.isFunction(obj.getAttribute) // reports false in IE
1881
* var input = document.createElement("input"); // append to body
1882
* Y.Lang.isFunction(input.focus) // reports false in IE
1886
* You will have to implement additional tests if these functions
1890
* @method isFunction
1892
* @param o The object to test.
1893
* @return {boolean} true if o is a function.
1895
L.isFunction = function(o) {
1896
return L.type(o) === 'function';
1900
* Determines whether or not the supplied item is a date instance.
1903
* @param o The object to test.
1904
* @return {boolean} true if o is a date.
1906
L.isDate = function(o) {
1907
return L.type(o) === 'date' && o.toString() !== 'Invalid Date' && !isNaN(o);
1911
* Determines whether or not the provided item is null.
1914
* @param o The object to test.
1915
* @return {boolean} true if o is null.
1917
L.isNull = function(o) {
1922
* Determines whether or not the provided item is a legal number.
1925
* @param o The object to test.
1926
* @return {boolean} true if o is a number.
1928
L.isNumber = function(o) {
1929
return typeof o === 'number' && isFinite(o);
1933
* Determines whether or not the provided item is of type object
1934
* or function. Note that arrays are also objects, so
1935
* <code>Y.Lang.isObject([]) === true</code>.
1938
* @param o The object to test.
1939
* @param failfn {boolean} fail if the input is a function.
1940
* @return {boolean} true if o is an object.
1941
* @see isPlainObject
1943
L.isObject = function(o, failfn) {
1945
return (o && (t === 'object' ||
1946
(!failfn && (t === 'function' || L.isFunction(o))))) || false;
1950
* Determines whether or not the provided item is a string.
1953
* @param o The object to test.
1954
* @return {boolean} true if o is a string.
1956
L.isString = function(o) {
1957
return typeof o === 'string';
1961
* Determines whether or not the provided item is undefined.
1962
* @method isUndefined
1964
* @param o The object to test.
1965
* @return {boolean} true if o is undefined.
1967
L.isUndefined = function(o) {
1968
return typeof o === 'undefined';
1972
* Returns a string without any leading or trailing whitespace. If
1973
* the input is not a string, the input will be returned untouched.
1976
* @param s {string} the string to trim.
1977
* @return {string} the trimmed string.
1979
L.trim = STRING_PROTO.trim ? function(s) {
1980
return s && s.trim ? s.trim() : s;
1983
return s.replace(TRIMREGEX, '');
1990
* Returns a string without any leading whitespace.
1993
* @param s {string} the string to trim.
1994
* @return {string} the trimmed string.
1996
L.trimLeft = STRING_PROTO.trimLeft ? function (s) {
1997
return s.trimLeft();
1999
return s.replace(/^\s+/, '');
2003
* Returns a string without any trailing whitespace.
2006
* @param s {string} the string to trim.
2007
* @return {string} the trimmed string.
2009
L.trimRight = STRING_PROTO.trimRight ? function (s) {
2010
return s.trimRight();
2012
return s.replace(/\s+$/, '');
2016
* A convenience method for detecting a legitimate non-null value.
2017
* Returns false for null/undefined/NaN, true for other values,
2018
* including 0/false/''
2021
* @param o The item to test.
2022
* @return {boolean} true if it is not null/undefined/NaN || false.
2024
L.isValue = function(o) {
2031
case 'null': // fallthru
2042
* Returns a string representing the type of the item passed in.
2051
* <code>typeof HTMLElementCollection</code> returns function in Safari, but
2052
* <code>Y.type()</code> reports object, which could be a good thing --
2053
* but it actually caused the logic in <code>Y.Lang.isObject</code> to fail.
2058
* @param o the item to test.
2059
* @return {string} the detected type.
2062
L.type = function(o) {
2063
return TYPES[typeof o] || TYPES[TOSTRING.call(o)] || (o ? 'object' : 'null');
2067
* Lightweight version of <code>Y.substitute</code>. Uses the same template
2068
* structure as <code>Y.substitute</code>, but doesn't support recursion,
2069
* auto-object coersion, or formats.
2071
* @param {string} s String to be modified.
2072
* @param {object} o Object containing replacement values.
2073
* @return {string} the substitute result.
2077
L.sub = function(s, o) {
2078
return s.replace ? s.replace(SUBREGEX, function (match, key) {
2079
return L.isUndefined(o[key]) ? match : o[key];
2084
* Returns the current time in milliseconds.
2087
* @return {Number} Current time in milliseconds.
2091
L.now = Date.now || function () {
2092
return new Date().getTime();
2100
Native = Array.prototype,
2102
hasOwn = Object.prototype.hasOwnProperty;
2105
Provides utility methods for working with arrays. Additional array helpers can
2106
be found in the `collection` and `array-extras` modules.
2108
`Y.Array(thing)` returns a native array created from _thing_. Depending on
2109
_thing_'s type, one of the following will happen:
2111
* Arrays are returned unmodified unless a non-zero _startIndex_ is
2113
* Array-like collections (see `Array.test()`) are converted to arrays.
2114
* For everything else, a new array is created with _thing_ as the sole
2117
Note: elements that are also collections, such as `<form>` and `<select>`
2118
elements, are not automatically converted to arrays. To force a conversion,
2119
pass `true` as the value of the _force_ parameter.
2123
@param {Any} thing The thing to arrayify.
2124
@param {Number} [startIndex=0] If non-zero and _thing_ is an array or array-like
2125
collection, a subset of items starting at the specified index will be
2127
@param {Boolean} [force=false] If `true`, _thing_ will be treated as an
2128
array-like collection no matter what.
2129
@return {Array} A native array created from _thing_, according to the rules
2132
function YArray(thing, startIndex, force) {
2135
startIndex || (startIndex = 0);
2137
if (force || YArray.test(thing)) {
2138
// IE throws when trying to slice HTMLElement collections.
2140
return Native.slice.call(thing, startIndex);
2144
for (len = thing.length; startIndex < len; ++startIndex) {
2145
result.push(thing[startIndex]);
2158
Dedupes an array of strings, returning an array that's guaranteed to contain
2159
only one copy of a given string.
2161
This method differs from `Array.unique()` in that it's optimized for use only
2162
with strings, whereas `unique` may be used with other types (but is slower).
2163
Using `dedupe()` with non-string values may result in unexpected behavior.
2166
@param {String[]} array Array of strings to dedupe.
2167
@return {Array} Deduped copy of _array_.
2171
YArray.dedupe = function (array) {
2176
for (i = 0, len = array.length; i < len; ++i) {
2179
if (!hasOwn.call(hash, item)) {
2189
Executes the supplied function on each item in the array. This method wraps
2190
the native ES5 `Array.forEach()` method if available.
2193
@param {Array} array Array to iterate.
2194
@param {Function} fn Function to execute on each item in the array. The function
2195
will receive the following arguments:
2196
@param {Any} fn.item Current array item.
2197
@param {Number} fn.index Current array index.
2198
@param {Array} fn.array Array being iterated.
2199
@param {Object} [thisObj] `this` object to use when calling _fn_.
2200
@return {YUI} The YUI instance.
2203
YArray.each = YArray.forEach = Native.forEach ? function (array, fn, thisObj) {
2204
Native.forEach.call(array || [], fn, thisObj || Y);
2206
} : function (array, fn, thisObj) {
2207
for (var i = 0, len = (array && array.length) || 0; i < len; ++i) {
2209
fn.call(thisObj || Y, array[i], i, array);
2224
Returns an object using the first array as keys and the second as values. If
2225
the second array is not provided, or if it doesn't contain the same number of
2226
values as the first array, then `true` will be used in place of the missing
2231
Y.Array.hash(['a', 'b', 'c'], ['foo', 'bar']);
2232
// => {a: 'foo', b: 'bar', c: true}
2235
@param {String[]} keys Array of strings to use as keys.
2236
@param {Array} [values] Array to use as values.
2237
@return {Object} Hash using the first array as keys and the second as values.
2240
YArray.hash = function (keys, values) {
2242
vlen = (values && values.length) || 0,
2245
for (i = 0, len = keys.length; i < len; ++i) {
2247
hash[keys[i]] = vlen > i && i in values ? values[i] : true;
2255
Returns the index of the first item in the array that's equal (using a strict
2256
equality check) to the specified _value_, or `-1` if the value isn't found.
2258
This method wraps the native ES5 `Array.indexOf()` method if available.
2261
@param {Array} array Array to search.
2262
@param {Any} value Value to search for.
2263
@return {Number} Index of the item strictly equal to _value_, or `-1` if not
2267
YArray.indexOf = Native.indexOf ? function (array, value) {
2268
// TODO: support fromIndex
2269
return Native.indexOf.call(array, value);
2270
} : function (array, value) {
2271
for (var i = 0, len = array.length; i < len; ++i) {
2272
if (i in array && array[i] === value) {
2281
Numeric sort convenience function.
2283
The native `Array.prototype.sort()` function converts values to strings and
2284
sorts them in lexicographic order, which is unsuitable for sorting numeric
2285
values. Provide `Array.numericSort` as a custom sort function when you want
2286
to sort values in numeric order.
2290
[42, 23, 8, 16, 4, 15].sort(Y.Array.numericSort);
2291
// => [4, 8, 15, 16, 23, 42]
2294
@param {Number} a First value to compare.
2295
@param {Number} b Second value to compare.
2296
@return {Number} Difference between _a_ and _b_.
2299
YArray.numericSort = function (a, b) {
2304
Executes the supplied function on each item in the array. Returning a truthy
2305
value from the function will stop the processing of remaining items.
2308
@param {Array} array Array to iterate over.
2309
@param {Function} fn Function to execute on each item. The function will receive
2310
the following arguments:
2311
@param {Any} fn.value Current array item.
2312
@param {Number} fn.index Current array index.
2313
@param {Array} fn.array Array being iterated over.
2314
@param {Object} [thisObj] `this` object to use when calling _fn_.
2315
@return {Boolean} `true` if the function returns a truthy value on any of the
2316
items in the array; `false` otherwise.
2319
YArray.some = Native.some ? function (array, fn, thisObj) {
2320
return Native.some.call(array, fn, thisObj);
2321
} : function (array, fn, thisObj) {
2322
for (var i = 0, len = array.length; i < len; ++i) {
2323
if (i in array && fn.call(thisObj, array[i], i, array)) {
2332
Evaluates _obj_ to determine if it's an array, an array-like collection, or
2333
something else. This is useful when working with the function `arguments`
2334
collection and `HTMLElement` collections.
2336
Note: This implementation doesn't consider elements that are also
2337
collections, such as `<form>` and `<select>`, to be array-like.
2340
@param {Object} obj Object to test.
2341
@return {Number} A number indicating the results of the test:
2343
* 0: Neither an array nor an array-like collection.
2345
* 2: Array-like collection.
2349
YArray.test = function (obj) {
2352
if (Lang.isArray(obj)) {
2354
} else if (Lang.isObject(obj)) {
2356
// indexed, but no tagName (element) or alert (window),
2357
// or functions without apply/call (Safari
2358
// HTMLElementCollection bug).
2359
if ('length' in obj && !obj.tagName && !obj.alert && !obj.apply) {
2368
* The YUI module contains the components required for building the YUI
2369
* seed file. This includes the script loading mechanism, a simple queue,
2370
* and the core utilities for the library.
2372
* @submodule yui-base
2376
* A simple FIFO queue. Items are added to the Queue with add(1..n items) and
2377
* removed using next().
2381
* @param {MIXED} item* 0..n items to seed the queue.
2385
this.add.apply(this, arguments);
2390
* Initialize the queue
2397
* The collection of enqueued items
2407
* Get the next item in the queue. FIFO support
2410
* @return {MIXED} the next item in the queue.
2413
return this._q.shift();
2417
* Get the last in the queue. LIFO support.
2420
* @return {MIXED} the last item in the queue.
2423
return this._q.pop();
2427
* Add 0..n items to the end of the queue.
2430
* @param {MIXED} item* 0..n items.
2431
* @return {object} this queue.
2434
this._q.push.apply(this._q, arguments);
2440
* Returns the current number of queued items.
2443
* @return {Number} The size.
2446
return this._q.length;
2452
YUI.Env._loaderQueue = YUI.Env._loaderQueue || new Queue();
2455
The YUI module contains the components required for building the YUI seed file.
2456
This includes the script loading mechanism, a simple queue, and the core
2457
utilities for the library.
2463
var CACHED_DELIMITER = '__',
2465
hasOwn = Object.prototype.hasOwnProperty,
2466
isObject = Y.Lang.isObject;
2469
Returns a wrapper for a function which caches the return value of that function,
2470
keyed off of the combined string representation of the argument values provided
2471
when the wrapper is called.
2473
Calling this function again with the same arguments will return the cached value
2474
rather than executing the wrapped function.
2476
Note that since the cache is keyed off of the string representation of arguments
2477
passed to the wrapper function, arguments that aren't strings and don't provide
2478
a meaningful `toString()` method may result in unexpected caching behavior. For
2479
example, the objects `{}` and `{foo: 'bar'}` would both be converted to the
2480
string `[object Object]` when used as a cache key.
2483
@param {Function} source The function to memoize.
2484
@param {Object} [cache={}] Object in which to store cached values. You may seed
2485
this object with pre-existing cached values if desired.
2486
@param {any} [refetch] If supplied, this value is compared with the cached value
2487
using a `==` comparison. If the values are equal, the wrapped function is
2488
executed again even though a cached value exists.
2489
@return {Function} Wrapped function.
2492
Y.cached = function (source, cache, refetch) {
2493
cache || (cache = {});
2495
return function (arg) {
2496
var key = arguments.length > 1 ?
2497
Array.prototype.join.call(arguments, CACHED_DELIMITER) :
2500
if (!(key in cache) || (refetch && cache[key] == refetch)) {
2501
cache[key] = source.apply(source, arguments);
2509
Returns a new object containing all of the properties of all the supplied
2510
objects. The properties from later objects will overwrite those in earlier
2513
Passing in a single object will create a shallow copy of it. For a deep copy,
2517
@param {Object} objects* One or more objects to merge.
2518
@return {Object} A new merged object.
2520
Y.merge = function () {
2521
var args = arguments,
2526
for (; i < len; ++i) {
2527
Y.mix(result, args[i], true);
2534
Mixes _supplier_'s properties into _receiver_.
2536
Properties on _receiver_ or _receiver_'s prototype will not be overwritten or
2537
shadowed unless the _overwrite_ parameter is `true`, and will not be merged
2538
unless the _merge_ parameter is `true`.
2540
In the default mode (0), only properties the supplier owns are copied (prototype
2541
properties are not copied). The following copying modes are available:
2543
* `0`: _Default_. Object to object.
2544
* `1`: Prototype to prototype.
2545
* `2`: Prototype to prototype and object to object.
2546
* `3`: Prototype to object.
2547
* `4`: Object to prototype.
2550
@param {Function|Object} receiver The object or function to receive the mixed
2552
@param {Function|Object} supplier The object or function supplying the
2553
properties to be mixed.
2554
@param {Boolean} [overwrite=false] If `true`, properties that already exist
2555
on the receiver will be overwritten with properties from the supplier.
2556
@param {String[]} [whitelist] An array of property names to copy. If
2557
specified, only the whitelisted properties will be copied, and all others
2559
@param {Number} [mode=0] Mix mode to use. See above for available modes.
2560
@param {Boolean} [merge=false] If `true`, objects and arrays that already
2561
exist on the receiver will have the corresponding object/array from the
2562
supplier merged into them, rather than being skipped or overwritten. When
2563
both _overwrite_ and _merge_ are `true`, _merge_ takes precedence.
2564
@return {Function|Object|YUI} The receiver, or the YUI instance if the
2565
specified receiver is falsy.
2567
Y.mix = function(receiver, supplier, overwrite, whitelist, mode, merge) {
2568
var alwaysOverwrite, exists, from, i, key, len, to;
2570
// If no supplier is given, we return the receiver. If no receiver is given,
2571
// we return Y. Returning Y doesn't make much sense to me, but it's
2572
// grandfathered in for backcompat reasons.
2573
if (!receiver || !supplier) {
2574
return receiver || Y;
2578
// In mode 2 (prototype to prototype and object to object), we recurse
2579
// once to do the proto to proto mix. The object to object mix will be
2580
// handled later on.
2582
Y.mix(receiver.prototype, supplier.prototype, overwrite,
2583
whitelist, 0, merge);
2586
// Depending on which mode is specified, we may be copying from or to
2587
// the prototypes of the supplier and receiver.
2588
from = mode === 1 || mode === 3 ? supplier.prototype : supplier;
2589
to = mode === 1 || mode === 4 ? receiver.prototype : receiver;
2591
// If either the supplier or receiver doesn't actually have a
2592
// prototype property, then we could end up with an undefined `from`
2593
// or `to`. If that happens, we abort and return the receiver.
2602
// If `overwrite` is truthy and `merge` is falsy, then we can skip a
2603
// property existence check on each iteration and save some time.
2604
alwaysOverwrite = overwrite && !merge;
2607
for (i = 0, len = whitelist.length; i < len; ++i) {
2610
// We call `Object.prototype.hasOwnProperty` instead of calling
2611
// `hasOwnProperty` on the object itself, since the object's
2612
// `hasOwnProperty` method may have been overridden or removed.
2613
// Also, some native objects don't implement a `hasOwnProperty`
2615
if (!hasOwn.call(from, key)) {
2619
// The `key in to` check here is (sadly) intentional for backwards
2620
// compatibility reasons. It prevents undesired shadowing of
2621
// prototype members on `to`.
2622
exists = alwaysOverwrite ? false : key in to;
2624
if (merge && exists && isObject(to[key], true)
2625
&& isObject(from[key], true)) {
2626
// If we're in merge mode, and the key is present on both
2627
// objects, and the value on both objects is either an object or
2628
// an array (but not a function), then we recurse to merge the
2629
// `from` value into the `to` value instead of overwriting it.
2631
// Note: It's intentional that the whitelist isn't passed to the
2632
// recursive call here. This is legacy behavior that lots of
2633
// code still depends on.
2634
Y.mix(to[key], from[key], overwrite, null, 0, merge);
2635
} else if (overwrite || !exists) {
2636
// We're not in merge mode, so we'll only copy the `from` value
2637
// to the `to` value if we're in overwrite mode or if the
2638
// current key doesn't exist on the `to` object.
2639
to[key] = from[key];
2644
// The code duplication here is for runtime performance reasons.
2645
// Combining whitelist and non-whitelist operations into a single
2646
// loop or breaking the shared logic out into a function both result
2647
// in worse performance, and Y.mix is critical enough that the byte
2648
// tradeoff is worth it.
2649
if (!hasOwn.call(from, key)) {
2653
// The `key in to` check here is (sadly) intentional for backwards
2654
// compatibility reasons. It prevents undesired shadowing of
2655
// prototype members on `to`.
2656
exists = alwaysOverwrite ? false : key in to;
2658
if (merge && exists && isObject(to[key], true)
2659
&& isObject(from[key], true)) {
2660
Y.mix(to[key], from[key], overwrite, null, 0, merge);
2661
} else if (overwrite || !exists) {
2662
to[key] = from[key];
2666
// If this is an IE browser with the JScript enumeration bug, force
2667
// enumeration of the buggy properties by making a recursive call with
2668
// the buggy properties as the whitelist.
2669
if (Y.Object._hasEnumBug) {
2670
Y.mix(to, from, overwrite, Y.Object._forceEnum, mode, merge);
2677
* The YUI module contains the components required for building the YUI
2678
* seed file. This includes the script loading mechanism, a simple queue,
2679
* and the core utilities for the library.
2681
* @submodule yui-base
2685
* Adds utilities to the YUI instance for working with objects.
2690
var hasOwn = Object.prototype.hasOwnProperty,
2692
// If either MooTools or Prototype is on the page, then there's a chance that we
2693
// can't trust "native" language features to actually be native. When this is
2694
// the case, we take the safe route and fall back to our own non-native
2697
unsafeNatives = win && !!(win.MooTools || win.Prototype),
2699
UNDEFINED, // <-- Note the comma. We're still declaring vars.
2702
* Returns a new object that uses _obj_ as its prototype. This method wraps the
2703
* native ES5 `Object.create()` method if available, but doesn't currently
2704
* pass through `Object.create()`'s second argument (properties) in order to
2705
* ensure compatibility with older browsers.
2708
* @param {Object} obj Prototype object.
2709
* @return {Object} New object using _obj_ as its prototype.
2712
O = Y.Object = (!unsafeNatives && Object.create) ? function (obj) {
2713
// We currently wrap the native Object.create instead of simply aliasing it
2714
// to ensure consistency with our fallback shim, which currently doesn't
2715
// support Object.create()'s second argument (properties). Once we have a
2716
// safe fallback for the properties arg, we can stop wrapping
2718
return Object.create(obj);
2720
// Reusable constructor function for the Object.create() shim.
2724
return function (obj) {
2731
* Property names that IE doesn't enumerate in for..in loops, even when they
2732
* should be enumerable. When `_hasEnumBug` is `true`, it's necessary to
2733
* manually enumerate these properties.
2735
* @property _forceEnum
2740
forceEnum = O._forceEnum = [
2743
'propertyIsEnumerable',
2750
* `true` if this browser has the JScript enumeration bug that prevents
2751
* enumeration of the properties named in the `_forceEnum` array, `false`
2755
* - <https://developer.mozilla.org/en/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug>
2756
* - <http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation>
2758
* @property _hasEnumBug
2763
hasEnumBug = O._hasEnumBug = !{valueOf: 0}.propertyIsEnumerable('valueOf'),
2766
* `true` if this browser incorrectly considers the `prototype` property of
2767
* functions to be enumerable. Currently known to affect Opera 11.50.
2769
* @property _hasProtoEnumBug
2774
hasProtoEnumBug = O._hasProtoEnumBug = (function () {}).propertyIsEnumerable('prototype'),
2777
* Returns `true` if _key_ exists on _obj_, `false` if _key_ doesn't exist or
2778
* exists only on _obj_'s prototype. This is essentially a safer version of
2779
* `obj.hasOwnProperty()`.
2782
* @param {Object} obj Object to test.
2783
* @param {String} key Property name to look for.
2784
* @return {Boolean} `true` if _key_ exists on _obj_, `false` otherwise.
2787
owns = O.owns = function (obj, key) {
2788
return !!obj && hasOwn.call(obj, key);
2789
}; // <-- End of var declarations.
2792
* Alias for `owns()`.
2795
* @param {Object} obj Object to test.
2796
* @param {String} key Property name to look for.
2797
* @return {Boolean} `true` if _key_ exists on _obj_, `false` otherwise.
2803
* Returns an array containing the object's enumerable keys. Does not include
2804
* prototype keys or non-enumerable keys.
2806
* Note that keys are returned in enumeration order (that is, in the same order
2807
* that they would be enumerated by a `for-in` loop), which may not be the same
2808
* as the order in which they were defined.
2810
* This method is an alias for the native ES5 `Object.keys()` method if
2815
* Y.Object.keys({a: 'foo', b: 'bar', c: 'baz'});
2816
* // => ['a', 'b', 'c']
2819
* @param {Object} obj An object.
2820
* @return {String[]} Array of keys.
2823
O.keys = (!unsafeNatives && Object.keys) || function (obj) {
2824
if (!Y.Lang.isObject(obj)) {
2825
throw new TypeError('Object.keys called on a non-object');
2831
if (hasProtoEnumBug && typeof obj === 'function') {
2833
if (owns(obj, key) && key !== 'prototype') {
2839
if (owns(obj, key)) {
2846
for (i = 0, len = forceEnum.length; i < len; ++i) {
2849
if (owns(obj, key)) {
2859
* Returns an array containing the values of the object's enumerable keys.
2861
* Note that values are returned in enumeration order (that is, in the same
2862
* order that they would be enumerated by a `for-in` loop), which may not be the
2863
* same as the order in which they were defined.
2867
* Y.Object.values({a: 'foo', b: 'bar', c: 'baz'});
2868
* // => ['foo', 'bar', 'baz']
2871
* @param {Object} obj An object.
2872
* @return {Array} Array of values.
2875
O.values = function (obj) {
2876
var keys = O.keys(obj),
2881
for (; i < len; ++i) {
2882
values.push(obj[keys[i]]);
2889
* Returns the number of enumerable keys owned by an object.
2892
* @param {Object} obj An object.
2893
* @return {Number} The object's size.
2896
O.size = function (obj) {
2898
return O.keys(obj).length;
2900
return 0; // Legacy behavior for non-objects.
2905
* Returns `true` if the object owns an enumerable property with the specified
2909
* @param {Object} obj An object.
2910
* @param {any} value The value to search for.
2911
* @return {Boolean} `true` if _obj_ contains _value_, `false` otherwise.
2914
O.hasValue = function (obj, value) {
2915
return Y.Array.indexOf(O.values(obj), value) > -1;
2919
* Executes a function on each enumerable property in _obj_. The function
2920
* receives the value, the key, and the object itself as parameters (in that
2923
* By default, only properties owned by _obj_ are enumerated. To include
2924
* prototype properties, set the _proto_ parameter to `true`.
2927
* @param {Object} obj Object to enumerate.
2928
* @param {Function} fn Function to execute on each enumerable property.
2929
* @param {mixed} fn.value Value of the current property.
2930
* @param {String} fn.key Key of the current property.
2931
* @param {Object} fn.obj Object being enumerated.
2932
* @param {Object} [thisObj] `this` object to use when calling _fn_.
2933
* @param {Boolean} [proto=false] Include prototype properties.
2934
* @return {YUI} the YUI instance.
2938
O.each = function (obj, fn, thisObj, proto) {
2942
if (proto || owns(obj, key)) {
2943
fn.call(thisObj || Y, obj[key], key, obj);
2951
* Executes a function on each enumerable property in _obj_, but halts if the
2952
* function returns a truthy value. The function receives the value, the key,
2953
* and the object itself as paramters (in that order).
2955
* By default, only properties owned by _obj_ are enumerated. To include
2956
* prototype properties, set the _proto_ parameter to `true`.
2959
* @param {Object} obj Object to enumerate.
2960
* @param {Function} fn Function to execute on each enumerable property.
2961
* @param {mixed} fn.value Value of the current property.
2962
* @param {String} fn.key Key of the current property.
2963
* @param {Object} fn.obj Object being enumerated.
2964
* @param {Object} [thisObj] `this` object to use when calling _fn_.
2965
* @param {Boolean} [proto=false] Include prototype properties.
2966
* @return {Boolean} `true` if any execution of _fn_ returns a truthy value,
2967
* `false` otherwise.
2970
O.some = function (obj, fn, thisObj, proto) {
2974
if (proto || owns(obj, key)) {
2975
if (fn.call(thisObj || Y, obj[key], key, obj)) {
2985
* Retrieves the sub value at the provided path,
2986
* from the value object provided.
2990
* @param o The object from which to extract the property value.
2991
* @param path {Array} A path array, specifying the object traversal path
2992
* from which to obtain the sub value.
2993
* @return {Any} The value stored in the path, undefined if not found,
2994
* undefined if the source is not an object. Returns the source object
2995
* if an empty path is provided.
2997
O.getValue = function(o, path) {
2998
if (!Y.Lang.isObject(o)) {
3006
for (i = 0; o !== UNDEFINED && i < l; i++) {
3014
* Sets the sub-attribute value at the provided path on the
3015
* value object. Returns the modified value object, or
3016
* undefined if the path is invalid.
3020
* @param o The object on which to set the sub value.
3021
* @param path {Array} A path array, specifying the object traversal path
3022
* at which to set the sub value.
3023
* @param val {Any} The new value for the sub-attribute.
3024
* @return {Object} The modified object, with the new sub value set, or
3025
* undefined, if the path was invalid.
3027
O.setValue = function(o, path, val) {
3030
leafIdx = p.length - 1,
3034
for (i = 0; ref !== UNDEFINED && i < leafIdx; i++) {
3038
if (ref !== UNDEFINED) {
3049
* Returns `true` if the object has no enumerable properties of its own.
3052
* @param {Object} obj An object.
3053
* @return {Boolean} `true` if the object is empty.
3057
O.isEmpty = function (obj) {
3058
return !O.keys(obj).length;
3061
* The YUI module contains the components required for building the YUI seed
3062
* file. This includes the script loading mechanism, a simple queue, and the
3063
* core utilities for the library.
3065
* @submodule yui-base
3069
* YUI user agent detection.
3070
* Do not fork for a browser if it can be avoided. Use feature detection when
3071
* you can. Use the user agent as a last resort. For all fields listed
3072
* as @type float, UA stores a version number for the browser engine,
3073
* 0 otherwise. This value may or may not map to the version number of
3074
* the browser using the engine. The value is presented as a float so
3075
* that it can easily be used for boolean evaluation as well as for
3076
* looking for a particular range of versions. Because of this,
3077
* some of the granularity of the version info may be lost. The fields that
3078
* are @type string default to null. The API docs list the values that
3079
* these fields can have.
3085
* Static method on `YUI.Env` for parsing a UA string. Called at instantiation
3086
* to populate `Y.UA`.
3090
* @param {String} [subUA=navigator.userAgent] UA string to parse
3091
* @returns {Object} The Y.UA object
3093
YUI.Env.parseUA = function(subUA) {
3095
var numberify = function(s) {
3097
return parseFloat(s.replace(/\./g, function() {
3098
return (c++ == 1) ? '' : '.';
3104
nav = win && win.navigator,
3109
* Internet Explorer version number or 0. Example: 6
3117
* Opera version number or 0. Example: 9.2
3125
* Gecko engine revision number. Will evaluate to 1 if Gecko
3126
* is detected but the revision could not be found. Other browsers
3127
* will be 0. Example: 1.8
3129
* Firefox 1.0.0.4: 1.7.8 <-- Reports 1.7
3130
* Firefox 1.5.0.9: 1.8.0.9 <-- 1.8
3131
* Firefox 2.0.0.3: 1.8.1.3 <-- 1.81
3132
* Firefox 3.0 <-- 1.9
3133
* Firefox 3.5 <-- 1.91
3142
* AppleWebKit version. KHTML browsers that are not WebKit browsers
3143
* will evaluate to 1, other browsers 0. Example: 418.9
3145
* Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the
3146
* latest available for Mac OSX 10.3.
3147
* Safari 2.0.2: 416 <-- hasOwnProperty introduced
3148
* Safari 2.0.4: 418 <-- preventDefault fixed
3149
* Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run
3150
* different versions of webkit
3151
* Safari 2.0.4 (419.3): 419 <-- Tiger installations that have been
3152
* updated, but not updated
3153
* to the latest patch.
3154
* Webkit 212 nightly: 522+ <-- Safari 3.0 precursor (with native
3155
* SVG and many major issues fixed).
3156
* Safari 3.0.4 (523.12) 523.12 <-- First Tiger release - automatic
3157
* update from 2.x via the 10.4.11 OS patch.
3158
* Webkit nightly 1/2008:525+ <-- Supports DOMContentLoaded event.
3159
* yahoo.com user agent hack removed.
3161
* http://en.wikipedia.org/wiki/Safari_version_history
3169
* Safari will be detected as webkit, but this property will also
3170
* be populated with the Safari version number
3178
* Chrome will be detected as webkit, but this property will also
3179
* be populated with the Chrome version number
3187
* The mobile property will be set to a string containing any relevant
3188
* user agent information when a modern mobile browser is detected.
3189
* Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series
3190
* devices with the WebKit-based browser, and Opera Mini.
3199
* Adobe AIR version number or 0. Only populated if webkit is detected.
3206
* Detects Apple iPad's OS version
3213
* Detects Apple iPhone's OS version
3220
* Detects Apples iPod's OS version
3227
* General truthy check for iPad, iPhone or iPod
3235
* Detects Googles Android OS version
3242
* Detects Palms WebOS version
3250
* Google Caja version number or 0.
3254
caja: nav && nav.cajaVersion,
3257
* Set to true if the page appears to be in SSL
3265
* The operating system. Currently only detecting windows or macintosh
3275
ua = subUA || nav && nav.userAgent,
3277
loc = win && win.location,
3279
href = loc && loc.href,
3284
* The User Agent string that was parsed
3285
* @property userAgent
3292
o.secure = href && (href.toLowerCase().indexOf('https') === 0);
3296
if ((/windows|win32/i).test(ua)) {
3298
} else if ((/macintosh/i).test(ua)) {
3300
} else if ((/rhino/i).test(ua)) {
3304
// Modern KHTML browsers should qualify as Safari X-Grade
3305
if ((/KHTML/).test(ua)) {
3308
// Modern WebKit browsers are at least X-Grade
3309
m = ua.match(/AppleWebKit\/([^\s]*)/);
3311
o.webkit = numberify(m[1]);
3312
o.safari = o.webkit;
3314
// Mobile browser check
3315
if (/ Mobile\//.test(ua)) {
3316
o.mobile = 'Apple'; // iPhone or iPod Touch
3318
m = ua.match(/OS ([^\s]*)/);
3320
m = numberify(m[1].replace('_', '.'));
3323
o.ipad = o.ipod = o.iphone = 0;
3325
m = ua.match(/iPad|iPod|iPhone/);
3327
o[m[0].toLowerCase()] = o.ios;
3330
m = ua.match(/NokiaN[^\/]*|webOS\/\d\.\d/);
3332
// Nokia N-series, webOS, ex: NokiaN95
3335
if (/webOS/.test(ua)) {
3337
m = ua.match(/webOS\/([^\s]*);/);
3339
o.webos = numberify(m[1]);
3342
if (/ Android/.test(ua)) {
3343
if (/Mobile/.test(ua)) {
3344
o.mobile = 'Android';
3346
m = ua.match(/Android ([^\s]*);/);
3348
o.android = numberify(m[1]);
3354
m = ua.match(/Chrome\/([^\s]*)/);
3356
o.chrome = numberify(m[1]); // Chrome
3357
o.safari = 0; //Reset safari back to 0
3359
m = ua.match(/AdobeAIR\/([^\s]*)/);
3361
o.air = m[0]; // Adobe AIR 1.0 or better
3366
if (!o.webkit) { // not webkit
3367
// @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr)
3368
m = ua.match(/Opera[\s\/]([^\s]*)/);
3370
o.opera = numberify(m[1]);
3371
m = ua.match(/Version\/([^\s]*)/);
3373
o.opera = numberify(m[1]); // opera 10+
3376
m = ua.match(/Opera Mini[^;]*/);
3379
o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316
3381
} else { // not opera or webkit
3382
m = ua.match(/MSIE\s([^;]*)/);
3384
o.ie = numberify(m[1]);
3385
} else { // not opera, webkit, or ie
3386
m = ua.match(/Gecko\/([^\s]*)/);
3388
o.gecko = 1; // Gecko detected, look for revision
3389
m = ua.match(/rv:([^\s\)]*)/);
3391
o.gecko = numberify(m[1]);
3399
//It was a parsed UA, do not assign the global value.
3408
Y.UA = YUI.Env.UA || YUI.Env.parseUA();
3410
"anim": ["anim-base","anim-color","anim-curve","anim-easing","anim-node-plugin","anim-scroll","anim-xy"],
3411
"app": ["controller","model","model-list","view"],
3412
"attribute": ["attribute-base","attribute-complex"],
3413
"autocomplete": ["autocomplete-base","autocomplete-sources","autocomplete-list","autocomplete-plugin"],
3414
"base": ["base-base","base-pluginhost","base-build"],
3415
"cache": ["cache-base","cache-offline","cache-plugin"],
3416
"collection": ["array-extras","arraylist","arraylist-add","arraylist-filter","array-invoke"],
3417
"dataschema": ["dataschema-base","dataschema-json","dataschema-xml","dataschema-array","dataschema-text"],
3418
"datasource": ["datasource-local","datasource-io","datasource-get","datasource-function","datasource-cache","datasource-jsonschema","datasource-xmlschema","datasource-arrayschema","datasource-textschema","datasource-polling"],
3419
"datatable": ["datatable-base","datatable-datasource","datatable-sort","datatable-scroll"],
3420
"datatype": ["datatype-number","datatype-date","datatype-xml"],
3421
"datatype-date": ["datatype-date-parse","datatype-date-format"],
3422
"datatype-number": ["datatype-number-parse","datatype-number-format"],
3423
"datatype-xml": ["datatype-xml-parse","datatype-xml-format"],
3424
"dd": ["dd-ddm-base","dd-ddm","dd-ddm-drop","dd-drag","dd-proxy","dd-constrain","dd-drop","dd-scroll","dd-delegate"],
3425
"dom": ["dom-base","dom-screen","dom-style","selector-native","selector"],
3426
"editor": ["frame","selection","exec-command","editor-base","editor-para","editor-br","editor-bidi","editor-tab","createlink-base"],
3427
"event": ["event-base","event-delegate","event-synthetic","event-mousewheel","event-mouseenter","event-key","event-focus","event-resize","event-hover","event-outside"],
3428
"event-custom": ["event-custom-base","event-custom-complex"],
3429
"event-gestures": ["event-flick","event-move"],
3430
"highlight": ["highlight-base","highlight-accentfold"],
3431
"history": ["history-base","history-hash","history-hash-ie","history-html5"],
3432
"io": ["io-base","io-xdr","io-form","io-upload-iframe","io-queue"],
3433
"json": ["json-parse","json-stringify"],
3434
"loader": ["loader-base","loader-rollup","loader-yui3"],
3435
"node": ["node-base","node-event-delegate","node-pluginhost","node-screen","node-style"],
3436
"pluginhost": ["pluginhost-base","pluginhost-config"],
3437
"querystring": ["querystring-parse","querystring-stringify"],
3438
"recordset": ["recordset-base","recordset-sort","recordset-filter","recordset-indexer"],
3439
"resize": ["resize-base","resize-proxy","resize-constrain"],
3440
"slider": ["slider-base","slider-value-range","clickable-rail","range-slider"],
3441
"text": ["text-accentfold","text-wordbreak"],
3442
"widget": ["widget-base","widget-htmlparser","widget-uievents","widget-skin"]
3447
YUI.add('get', function(Y) {
3450
* Provides a mechanism to fetch remote resources and
3451
* insert them into a document.
3457
* Fetches and inserts one or more script or link nodes into the document
3464
TYPE_JS = 'text/javascript',
3465
TYPE_CSS = 'text/css',
3466
STYLESHEET = 'stylesheet',
3468
AUTOPURGE = 'autopurge',
3474
// FireFox does not support the onload event for link nodes, so
3475
// there is no way to make the css requests synchronous. This means
3476
// that the css rules in multiple files could be applied out of order
3477
// in this browser if a later request returns before an earlier one.
3481
ONLOAD_SUPPORTED = {
3483
css: !(ua.webkit || ua.gecko)
3487
* hash of queues to manage multiple requests
3494
* queue index used to generate transaction ids
3502
* interal property used to prevent multiple simultaneous purge
3511
* Clear timeout state
3513
* @method _clearTimeout
3514
* @param {Object} q Queue data
3517
_clearTimeout = function(q) {
3518
var timer = q.timer;
3520
clearTimeout(timer);
3526
* Generates an HTML element, this is not appended to a document
3528
* @param {string} type the type of element.
3529
* @param {Object} attr the fixed set of attribute for the type.
3530
* @param {Object} custAttrs optional Any custom attributes provided by the user.
3531
* @param {Window} win optional window to create the element in.
3532
* @return {HTMLElement} the generated node.
3535
_node = function(type, attr, custAttrs, win) {
3536
var w = win || Y.config.win,
3538
n = d.createElement(type),
3542
Y.mix(attr, custAttrs);
3546
if (attr[i] && attr.hasOwnProperty(i)) {
3547
n.setAttribute(i, attr[i]);
3555
* Generates a link node
3557
* @param {string} url the url for the css file.
3558
* @param {Window} win optional window to create the node in.
3559
* @param {object} attributes optional attributes collection to apply to the
3561
* @return {HTMLElement} the generated node.
3564
_linkNode = function(url, win, attributes) {
3565
return _node(LINK, {
3570
}, attributes, win);
3574
* Generates a script node
3575
* @method _scriptNode
3576
* @param {string} url the url for the script file.
3577
* @param {Window} win optional window to create the node in.
3578
* @param {object} attributes optional attributes collection to apply to the
3580
* @return {HTMLElement} the generated node.
3583
_scriptNode = function(url, win, attributes) {
3584
return _node(SCRIPT, {
3588
}, attributes, win);
3592
* Returns the data payload for callback functions.
3593
* @method _returnData
3594
* @param {object} q the queue.
3595
* @param {string} msg the result message.
3596
* @param {string} result the status message from the request.
3597
* @return {object} the state data from the request.
3600
_returnData = function(q, msg, result) {
3616
* The transaction is finished
3618
* @param {string} id the id of the request.
3619
* @param {string} msg the result message.
3620
* @param {string} result the status message from the request.
3623
_end = function(id, msg, result) {
3625
onEnd = q && q.onEnd;
3630
onEnd.call(q.context, _returnData(q, msg, result));
3635
* The request failed, execute fail handler with whatever
3636
* was accomplished. There isn't a failure case at the
3637
* moment unless you count aborted transactions
3639
* @param {string} id the id of the request
3642
_fail = function(id, msg) {
3643
Y.log('get failure: ' + msg, 'warn', 'get');
3646
onFailure = q.onFailure;
3651
onFailure.call(q.context, _returnData(q, msg));
3654
_end(id, msg, 'failure');
3659
* Abort the transaction
3662
* @param {Object} id
3665
_abort = function(id) {
3666
_fail(id, 'transaction ' + id + ' was aborted');
3670
* The request is complete, so executing the requester's callback
3672
* @param {string} id the id of the request.
3675
_complete = function(id) {
3676
Y.log("Finishing transaction " + id, "info", "get");
3679
onSuccess = q.onSuccess;
3688
onSuccess.call(q.context, _returnData(q));
3691
// 3.3.0 had undefined msg for this path.
3692
_end(id, undefined, 'OK');
3697
* Get node reference, from string
3699
* @method _getNodeRef
3700
* @param {String|HTMLElement} nId The node id to find. If an HTMLElement is passed in, it will be returned.
3701
* @param {String} tId Queue id, used to determine document for queue
3704
_getNodeRef = function(nId, tId) {
3705
var q = queues[tId],
3706
n = (L.isString(nId)) ? q.win.document.getElementById(nId) : nId;
3708
_fail(tId, 'target node not found: ' + nId);
3715
* Removes the nodes for the specified queue
3717
* @param {string} tId the transaction id.
3720
_purge = function(tId) {
3721
var nodes, doc, parent, sibling, node, attr, insertBefore,
3729
// TODO: Why is node.parentNode undefined? Which forces us to do this...
3731
doc = q.win.document;
3732
parent = doc.getElementsByTagName('head')[0];
3733
insertBefore = q.insertBefore || doc.getElementsByTagName('base')[0];
3736
sibling = _getNodeRef(insertBefore, tId);
3738
parent = sibling.parentNode;
3743
for (i = 0; i < l; i++) {
3745
parent = node.parentNode;
3747
if (node.clearAttributes) {
3748
node.clearAttributes();
3750
// This destroys parentNode ref, so we hold onto it above first.
3751
for (attr in node) {
3752
if (node.hasOwnProperty(attr)) {
3758
parent.removeChild(node);
3769
* @param {string} id The id of the request.
3770
* @param {string} The url which just completed.
3773
_progress = function(id, url) {
3775
onProgress = q.onProgress,
3781
onProgress.call(q.context, o);
3788
* @param {string} id the id of the request.
3791
_timeout = function(id) {
3792
Y.log('Timeout ' + id, 'info', 'get');
3795
onTimeout = q.onTimeout;
3798
onTimeout.call(q.context, _returnData(q));
3801
_end(id, 'timeout', 'timeout');
3807
* @param {string} id the id of the request.
3808
* @return {string} the result.
3811
_loaded = function(id, url) {
3814
sync = (q && !q.async);
3826
// TODO: Cleaning up flow to have a consistent end point
3828
// !q.finished check is for the async case,
3829
// where scripts may still be loading when we've
3830
// already aborted. Ideally there should be a single path
3837
if ((--q.remaining) === 0) {
3847
* Detects when a node has been loaded. In the case of
3848
* script nodes, this does not guarantee that contained
3849
* script is ready to use.
3850
* @method _trackLoad
3851
* @param {string} type the type of node to track.
3852
* @param {HTMLElement} n the node to track.
3853
* @param {string} id the id of the request.
3854
* @param {string} url the url that is being loaded.
3857
_trackLoad = function(type, n, id, url) {
3859
// TODO: Can we massage this to use ONLOAD_SUPPORTED[type]?
3861
// IE supports the readystatechange event for script and css nodes
3862
// Opera only for script nodes. Opera support onload for script
3863
// nodes, but this doesn't fire when there is a load failure.
3864
// The onreadystatechange appears to be a better way to respond
3865
// to both success and failure.
3869
n.onreadystatechange = function() {
3870
var rs = this.readyState;
3871
if ('loaded' === rs || 'complete' === rs) {
3872
// Y.log(id + " onreadstatechange " + url, "info", "get");
3873
n.onreadystatechange = null;
3878
} else if (ua.webkit) {
3880
// webkit prior to 3.x is no longer supported
3881
if (type === SCRIPT) {
3882
// Safari 3.x supports the load event for script nodes (DOM2)
3883
n.addEventListener('load', function() {
3890
// FireFox and Opera support onload (but not DOM2 in FF) handlers for
3891
// script nodes. Opera, but not FF, supports the onload event for link nodes.
3893
n.onload = function() {
3894
// Y.log(id + " onload " + url, "info", "get");
3898
n.onerror = function(e) {
3899
_fail(id, e + ': ' + url);
3904
_insertInDoc = function(node, id, win) {
3906
// Add it to the head or insert it before 'insertBefore'.
3907
// Work around IE bug if there is a base tag.
3910
insertBefore = q.insertBefore || doc.getElementsByTagName('base')[0],
3914
sibling = _getNodeRef(insertBefore, id);
3916
Y.log('inserting before: ' + insertBefore, 'info', 'get');
3917
sibling.parentNode.insertBefore(node, sibling);
3920
// 3.3.0 assumed head is always around.
3921
doc.getElementsByTagName('head')[0].appendChild(node);
3926
* Loads the next item for a given request
3928
* @param {string} id the id of the request.
3929
* @return {string} the result.
3932
_next = function(id) {
3934
// Assigning out here for readability
3937
attrs = q.attributes,
3939
timeout = q.timeout,
3943
if (q.url.length > 0) {
3945
url = q.url.shift();
3947
Y.log('attempting to load ' + url, 'info', 'get');
3949
// !q.timer ensures that this only happens once for async
3950
if (timeout && !q.timer) {
3951
q.timer = setTimeout(function() {
3956
if (type === SCRIPT) {
3957
node = _scriptNode(url, win, attrs);
3959
node = _linkNode(url, win, attrs);
3962
// add the node to the queue so we can return it in the callback
3965
_trackLoad(type, node, id, url);
3966
_insertInDoc(node, id, win);
3968
if (!ONLOAD_SUPPORTED[type]) {
3973
// For sync, the _next call is chained in _loaded
3980
* Removes processed queues and corresponding nodes
3981
* @method _autoPurge
3984
_autoPurge = function() {
3993
if (queues.hasOwnProperty(i)) {
3995
if (q.autopurge && q.finished) {
4006
* Saves the state for the request and begins loading
4007
* the requested urls
4009
* @param {string} type the type of node to insert.
4010
* @param {string} url the url to load.
4011
* @param {object} opts the hash of options for this request.
4012
* @return {object} transaction object.
4015
_queue = function(type, url, opts) {
4019
var id = 'q' + (qidx++),
4020
thresh = opts.purgethreshold || Y.Get.PURGE_THRESH,
4023
if (qidx % thresh === 0) {
4027
// Merge to protect opts (grandfathered in).
4028
q = queues[id] = Y.merge(opts);
4030
// Avoid mix, merge overhead. Known set of props.
4037
q.win = q.win || Y.config.win;
4038
q.context = q.context || q;
4039
q.autopurge = (AUTOPURGE in q) ? q.autopurge : (type === SCRIPT) ? true : false;
4040
q.attributes = q.attributes || {};
4041
q.attributes.charset = opts.charset || q.attributes.charset || UTF8;
4043
if (ASYNC in q && type === SCRIPT) {
4044
q.attributes.async = q.async;
4047
q.url = (L.isString(q.url)) ? [q.url] : q.url;
4049
// TODO: Do we really need to account for this developer error?
4050
// If the url is undefined, this is probably a trailing comma problem in IE.
4053
Y.log('skipping empty url');
4056
q.remaining = q.url.length;
4069
* The number of request required before an automatic purge.
4070
* Can be configured via the 'purgethreshold' config
4071
* @property PURGE_THRESH
4080
* Abort a transaction
4083
* @param {string|object} o Either the tId or the object returned from
4084
* script() or css().
4086
abort : function(o) {
4087
var id = (L.isString(o)) ? o : o.tId,
4091
Y.log('Aborting ' + id, 'info', 'get');
4097
* Fetches and inserts one or more script nodes into the head
4098
* of the current document or the document in a specified window.
4102
* @param {string|string[]} url the url or urls to the script(s).
4103
* @param {object} opts Options:
4105
* <dt>onSuccess</dt>
4107
* callback to execute when the script(s) are finished loading
4108
* The callback receives an object back with the following
4112
* <dd>the window the script(s) were inserted into</dd>
4114
* <dd>the data object passed in when the request was made</dd>
4116
* <dd>An array containing references to the nodes that were
4119
* <dd>A function that, when executed, will remove the nodes
4120
* that were inserted</dd>
4124
* <dt>onTimeout</dt>
4126
* callback to execute when a timeout occurs.
4127
* The callback receives an object back with the following
4131
* <dd>the window the script(s) were inserted into</dd>
4133
* <dd>the data object passed in when the request was made</dd>
4135
* <dd>An array containing references to the nodes that were
4138
* <dd>A function that, when executed, will remove the nodes
4139
* that were inserted</dd>
4144
* <dd>a function that executes when the transaction finishes,
4145
* regardless of the exit path</dd>
4146
* <dt>onFailure</dt>
4148
* callback to execute when the script load operation fails
4149
* The callback receives an object back with the following
4153
* <dd>the window the script(s) were inserted into</dd>
4155
* <dd>the data object passed in when the request was made</dd>
4157
* <dd>An array containing references to the nodes that were
4158
* inserted successfully</dd>
4160
* <dd>A function that, when executed, will remove any nodes
4161
* that were inserted</dd>
4165
* <dt>onProgress</dt>
4166
* <dd>callback to execute when each individual file is done loading
4167
* (useful when passing in an array of js files). Receives the same
4168
* payload as onSuccess, with the addition of a <code>url</code>
4169
* property, which identifies the file which was loaded.</dd>
4172
* <p>When passing in an array of JS files, setting this flag to true
4173
* will insert them into the document in parallel, as opposed to the
4174
* default behavior, which is to chain load them serially. It will also
4175
* set the async attribute on the script node to true.</p>
4176
* <p>Setting async:true
4177
* will lead to optimal file download performance allowing the browser to
4178
* download multiple scripts in parallel, and execute them as soon as they
4179
* are available.</p>
4180
* <p>Note that async:true does not guarantee execution order of the
4181
* scripts being downloaded. They are executed in whichever order they
4185
* <dd>the execution context for the callbacks</dd>
4187
* <dd>a window other than the one the utility occupies</dd>
4188
* <dt>autopurge</dt>
4190
* setting to true will let the utilities cleanup routine purge
4191
* the script once loaded
4193
* <dt>purgethreshold</dt>
4195
* The number of transaction before autopurge should be initiated
4199
* data that is supplied to the callback when the script(s) are
4202
* <dt>insertBefore</dt>
4203
* <dd>node or node id that will become the new node's nextSibling.
4204
* If this is not specified, nodes will be inserted before a base
4205
* tag should it exist. Otherwise, the nodes will be appended to the
4206
* end of the document head.</dd>
4209
* <dd>Node charset, default utf-8 (deprecated, use the attributes
4211
* <dt>attributes</dt>
4212
* <dd>An object literal containing additional attributes to add to
4213
* the link tags</dd>
4215
* <dd>Number of milliseconds to wait before aborting and firing
4216
* the timeout event</dd>
4218
* Y.Get.script(
4219
* ["http://yui.yahooapis.com/2.5.2/build/yahoo/yahoo-min.js",
4220
* "http://yui.yahooapis.com/2.5.2/build/event/event-min.js"],
4222
* onSuccess: function(o) {
4223
* this.log("won't cause error because Y is the context");
4224
* Y.log(o.data); // foo
4225
* Y.log(o.nodes.length === 2) // true
4226
* // o.purge(); // optionally remove the script nodes
4227
* // immediately
4229
* onFailure: function(o) {
4230
* Y.log("transaction failed");
4232
* onTimeout: function(o) {
4233
* Y.log("transaction timed out");
4235
* data: "foo",
4236
* timeout: 10000, // 10 second timeout
4237
* context: Y, // make the YUI instance
4238
* // win: otherframe // target another window/frame
4239
* autopurge: true // allow the utility to choose when to
4240
* // remove the nodes
4241
* purgetheshold: 1 // purge previous transaction before
4242
* // next transaction
4245
* @return {tId: string} an object containing info about the
4248
script: function(url, opts) {
4249
return _queue(SCRIPT, url, opts);
4253
* Fetches and inserts one or more css link nodes into the
4254
* head of the current document or the document in a specified
4258
* @param {string} url the url or urls to the css file(s).
4259
* @param {object} opts Options:
4261
* <dt>onSuccess</dt>
4263
* callback to execute when the css file(s) are finished loading
4264
* The callback receives an object back with the following
4267
* <dd>the window the link nodes(s) were inserted into</dd>
4269
* <dd>the data object passed in when the request was made</dd>
4271
* <dd>An array containing references to the nodes that were
4274
* <dd>A function that, when executed, will remove the nodes
4275
* that were inserted</dd>
4279
* <dt>onProgress</dt>
4280
* <dd>callback to execute when each individual file is done loading (useful when passing in an array of css files). Receives the same
4281
* payload as onSuccess, with the addition of a <code>url</code> property, which identifies the file which was loaded. Currently only useful for non Webkit/Gecko browsers,
4282
* where onload for css is detected accurately.</dd>
4284
* <dd>When passing in an array of css files, setting this flag to true will insert them
4285
* into the document in parallel, as oppposed to the default behavior, which is to chain load them (where possible).
4286
* This flag is more useful for scripts currently, since for css Get only chains if not Webkit/Gecko.</dd>
4288
* <dd>the execution context for the callbacks</dd>
4290
* <dd>a window other than the one the utility occupies</dd>
4293
* data that is supplied to the callbacks when the nodes(s) are
4296
* <dt>insertBefore</dt>
4297
* <dd>node or node id that will become the new node's nextSibling</dd>
4299
* <dd>Node charset, default utf-8 (deprecated, use the attributes
4301
* <dt>attributes</dt>
4302
* <dd>An object literal containing additional attributes to add to
4303
* the link tags</dd>
4306
* Y.Get.css("http://localhost/css/menu.css");
4310
* ["http://localhost/css/menu.css",
4311
* "http://localhost/css/logger.css"], {
4312
* insertBefore: 'custom-styles' // nodes will be inserted
4313
* // before the specified node
4316
* @return {tId: string} an object containing info about the
4319
css: function(url, opts) {
4320
return _queue('css', url, opts);
4325
}, '3.4.1' ,{requires:['yui-base']});
4326
YUI.add('features', function(Y) {
4328
var feature_tests = {};
4331
Contains the core of YUI's feature test architecture.
4341
Y.mix(Y.namespace('Features'), {
4344
* Object hash of all registered feature tests
4348
tests: feature_tests,
4351
* Add a test to the system
4354
* Y.Features.add("load", "1", {});
4358
* @param {String} cat The category, right now only 'load' is supported
4359
* @param {String} name The number sequence of the test, how it's reported in the URL or config: 1, 2, 3
4360
* @param {Object} o Object containing test properties
4361
* @param {String} o.name The name of the test
4362
* @param {Function} o.test The test function to execute, the only argument to the function is the `Y` instance
4363
* @param {String} o.trigger The module that triggers this test.
4365
add: function(cat, name, o) {
4366
feature_tests[cat] = feature_tests[cat] || {};
4367
feature_tests[cat][name] = o;
4370
* Execute all tests of a given category and return the serialized results
4376
* @param {String} cat The category to execute
4377
* @param {Array} args The arguments to pass to the test function
4378
* @return {String} A semi-colon separated string of tests and their success/failure: 1:1;2:1;3:0
4380
all: function(cat, args) {
4381
var cat_o = feature_tests[cat],
4385
Y.Object.each(cat_o, function(v, k) {
4386
result.push(k + ':' + (Y.Features.test(cat, k, args) ? 1 : 0));
4390
return (result.length) ? result.join(';') : '';
4393
* Run a sepecific test and return a Boolean response.
4396
* Y.Features.test("load", "1");
4400
* @param {String} cat The category of the test to run
4401
* @param {String} name The name of the test to run
4402
* @param {Array} args The arguments to pass to the test function
4403
* @return {Boolean} True or false if the test passed/failed.
4405
test: function(cat, name, args) {
4407
var result, ua, test,
4408
cat_o = feature_tests[cat],
4409
feature = cat_o && cat_o[name];
4412
Y.log('Feature test ' + cat + ', ' + name + ' not found');
4415
result = feature.result;
4417
if (Y.Lang.isUndefined(result)) {
4421
result = (Y.UA[ua]);
4424
test = feature.test;
4425
if (test && ((!ua) || result)) {
4426
result = test.apply(Y, args);
4429
feature.result = result;
4437
// Y.Features.add("load", "1", {});
4438
// Y.Features.test("load", "1");
4439
// caps=1:1;2:0;3:1;
4441
/* This file is auto-generated by src/loader/scripts/meta_join.py */
4442
var add = Y.Features.add;
4443
// graphics-canvas-default
4445
"name": "graphics-canvas-default",
4446
"test": function(Y) {
4447
var DOCUMENT = Y.config.doc,
4448
canvas = DOCUMENT && DOCUMENT.createElement("canvas");
4449
return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (canvas && canvas.getContext && canvas.getContext("2d")));
4451
"trigger": "graphics"
4453
// autocomplete-list-keys
4455
"name": "autocomplete-list-keys",
4456
"test": function (Y) {
4457
// Only add keyboard support to autocomplete-list if this doesn't appear to
4458
// be an iOS or Android-based mobile device.
4460
// There's currently no feasible way to actually detect whether a device has
4461
// a hardware keyboard, so this sniff will have to do. It can easily be
4462
// overridden by manually loading the autocomplete-list-keys module.
4464
// Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari
4465
// doesn't fire the keyboard events used by AutoCompleteList, so there's
4466
// no point loading the -keys module even when a bluetooth keyboard may be
4468
return !(Y.UA.ios || Y.UA.android);
4470
"trigger": "autocomplete-list"
4474
"name": "graphics-svg",
4475
"test": function(Y) {
4476
var DOCUMENT = Y.config.doc;
4477
return (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
4479
"trigger": "graphics"
4483
"name": "history-hash-ie",
4484
"test": function (Y) {
4485
var docMode = Y.config.doc && Y.config.doc.documentMode;
4487
return Y.UA.ie && (!('onhashchange' in Y.config.win) ||
4488
!docMode || docMode < 8);
4490
"trigger": "history-hash"
4492
// graphics-vml-default
4494
"name": "graphics-vml-default",
4495
"test": function(Y) {
4496
var DOCUMENT = Y.config.doc,
4497
canvas = DOCUMENT && DOCUMENT.createElement("canvas");
4498
return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
4500
"trigger": "graphics"
4502
// graphics-svg-default
4504
"name": "graphics-svg-default",
4505
"test": function(Y) {
4506
var DOCUMENT = Y.config.doc;
4507
return (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
4509
"trigger": "graphics"
4513
"name": "widget-base-ie",
4514
"trigger": "widget-base",
4519
"name": "transition-timer",
4520
"test": function (Y) {
4521
var DOCUMENT = Y.config.doc,
4522
node = (DOCUMENT) ? DOCUMENT.documentElement: null,
4525
if (node && node.style) {
4526
ret = !('MozTransition' in node.style || 'WebkitTransition' in node.style);
4531
"trigger": "transition"
4535
"name": "dom-style-ie",
4536
"test": function (Y) {
4538
var testFeature = Y.Features.test,
4539
addFeature = Y.Features.add,
4540
WINDOW = Y.config.win,
4541
DOCUMENT = Y.config.doc,
4542
DOCUMENT_ELEMENT = 'documentElement',
4545
addFeature('style', 'computedStyle', {
4547
return WINDOW && 'getComputedStyle' in WINDOW;
4551
addFeature('style', 'opacity', {
4553
return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style;
4557
ret = (!testFeature('style', 'opacity') &&
4558
!testFeature('style', 'computedStyle'));
4562
"trigger": "dom-style"
4566
"name": "selector-css2",
4567
"test": function (Y) {
4568
var DOCUMENT = Y.config.doc,
4569
ret = DOCUMENT && !('querySelectorAll' in DOCUMENT);
4573
"trigger": "selector"
4577
"name": "event-base-ie",
4578
"test": function(Y) {
4579
var imp = Y.config.doc && Y.config.doc.implementation;
4580
return (imp && (!imp.hasFeature('Events', '2.0')));
4582
"trigger": "node-base"
4586
"name": "dd-gestures",
4587
"test": function(Y) {
4588
return (Y.config.win && ('ontouchstart' in Y.config.win && !Y.UA.chrome));
4590
"trigger": "dd-drag"
4592
// scrollview-base-ie
4594
"name": "scrollview-base-ie",
4595
"trigger": "scrollview-base",
4600
"name": "graphics-canvas",
4601
"test": function(Y) {
4602
var DOCUMENT = Y.config.doc,
4603
canvas = DOCUMENT && DOCUMENT.createElement("canvas");
4604
return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (canvas && canvas.getContext && canvas.getContext("2d")));
4606
"trigger": "graphics"
4610
"name": "graphics-vml",
4611
"test": function(Y) {
4612
var DOCUMENT = Y.config.doc,
4613
canvas = DOCUMENT && DOCUMENT.createElement("canvas");
4614
return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
4616
"trigger": "graphics"
4620
}, '3.4.1' ,{requires:['yui-base']});
4621
YUI.add('intl-base', function(Y) {
4624
* The Intl utility provides a central location for managing sets of
4625
* localized resources (strings and formatting patterns).
4632
var SPLIT_REGEX = /[, ]/;
4634
Y.mix(Y.namespace('Intl'), {
4637
* Returns the language among those available that
4638
* best matches the preferred language list, using the Lookup
4639
* algorithm of BCP 47.
4640
* If none of the available languages meets the user's preferences,
4641
* then "" is returned.
4642
* Extended language ranges are not supported.
4644
* @method lookupBestLang
4645
* @param {String[] | String} preferredLanguages The list of preferred
4646
* languages in descending preference order, represented as BCP 47
4647
* language tags. A string array or a comma-separated list.
4648
* @param {String[]} availableLanguages The list of languages
4649
* that the application supports, represented as BCP 47 language
4652
* @return {String} The available language that best matches the
4653
* preferred language list, or "".
4656
lookupBestLang: function(preferredLanguages, availableLanguages) {
4658
var i, language, result, index;
4660
// check whether the list of available languages contains language;
4662
function scan(language) {
4664
for (i = 0; i < availableLanguages.length; i += 1) {
4665
if (language.toLowerCase() ===
4666
availableLanguages[i].toLowerCase()) {
4667
return availableLanguages[i];
4672
if (Y.Lang.isString(preferredLanguages)) {
4673
preferredLanguages = preferredLanguages.split(SPLIT_REGEX);
4676
for (i = 0; i < preferredLanguages.length; i += 1) {
4677
language = preferredLanguages[i];
4678
if (!language || language === '*') {
4681
// check the fallback sequence for one language
4682
while (language.length > 0) {
4683
result = scan(language);
4687
index = language.lastIndexOf('-');
4689
language = language.substring(0, index);
4690
// one-character subtags get cut along with the
4692
if (index >= 2 && language.charAt(index - 2) === '-') {
4693
language = language.substring(0, index - 2);
4696
// nothing available for this language
4708
}, '3.4.1' ,{requires:['yui-base']});
4709
YUI.add('yui-log', function(Y) {
4712
* Provides console log capability and exposes a custom event for
4713
* console implementations. This module is a `core` YUI module, <a href="../classes/YUI.html#method_log">it's documentation is located under the YUI class</a>.
4716
* @submodule yui-log
4720
LOGEVENT = 'yui:log',
4721
UNDEFINED = 'undefined',
4722
LEVELS = { debug: 1,
4728
* If the 'debug' config is true, a 'yui:log' event will be
4729
* dispatched, which the Console widget and anything else
4730
* can consume. If the 'useBrowserConsole' config is true, it will
4731
* write to the browser console if available. YUI-specific log
4732
* messages will only be present in the -debug versions of the
4733
* JS files. The build system is supposed to remove log statements
4734
* from the raw and minified versions of the files.
4738
* @param {String} msg The message to log.
4739
* @param {String} cat The log category for the message. Default
4740
* categories are "info", "warn", "error", time".
4741
* Custom categories can be used as well. (opt).
4742
* @param {String} src The source of the the message (opt).
4743
* @param {boolean} silent If true, the log event won't fire.
4744
* @return {YUI} YUI instance.
4746
INSTANCE.log = function(msg, cat, src, silent) {
4747
var bail, excl, incl, m, f,
4750
publisher = (Y.fire) ? Y : YUI.Env.globalEvents;
4751
// suppress log message if the config is off or the event stack
4752
// or the event call stack contains a consumer of the yui:log event
4754
// apply source filters
4756
excl = c.logExclude;
4757
incl = c.logInclude;
4758
if (incl && !(src in incl)) {
4760
} else if (incl && (src in incl)) {
4762
} else if (excl && (src in excl)) {
4767
if (c.useBrowserConsole) {
4768
m = (src) ? src + ': ' + msg : msg;
4769
if (Y.Lang.isFunction(c.logFn)) {
4770
c.logFn.call(Y, msg, cat, src);
4771
} else if (typeof console != UNDEFINED && console.log) {
4772
f = (cat && console[cat] && (cat in LEVELS)) ? cat : 'log';
4774
} else if (typeof opera != UNDEFINED) {
4779
if (publisher && !silent) {
4781
if (publisher == Y && (!publisher.getEvent(LOGEVENT))) {
4782
publisher.publish(LOGEVENT, {
4787
publisher.fire(LOGEVENT, {
4800
* Write a system message. This message will be preserved in the
4801
* minified and raw versions of the YUI files, unlike log statements.
4804
* @param {String} msg The message to log.
4805
* @param {String} cat The log category for the message. Default
4806
* categories are "info", "warn", "error", time".
4807
* Custom categories can be used as well. (opt).
4808
* @param {String} src The source of the the message (opt).
4809
* @param {boolean} silent If true, the log event won't fire.
4810
* @return {YUI} YUI instance.
4812
INSTANCE.message = function() {
4813
return INSTANCE.log.apply(INSTANCE, arguments);
4817
}, '3.4.1' ,{requires:['yui-base']});
4818
YUI.add('yui-later', function(Y) {
4821
* Provides a setTimeout/setInterval wrapper. This module is a `core` YUI module, <a href="../classes/YUI.html#method_later">it's documentation is located under the YUI class</a>.
4824
* @submodule yui-later
4830
* Executes the supplied function in the context of the supplied
4831
* object 'when' milliseconds later. Executes the function a
4832
* single time unless periodic is set to true.
4835
* @param when {int} the number of milliseconds to wait until the fn
4837
* @param o the context object.
4838
* @param fn {Function|String} the function to execute or the name of
4839
* the method in the 'o' object to execute.
4840
* @param data [Array] data that is provided to the function. This
4841
* accepts either a single item or an array. If an array is provided,
4842
* the function is executed with one parameter for each array item.
4843
* If you need to pass a single array parameter, it needs to be wrapped
4844
* in an array [myarray].
4846
* Note: native methods in IE may not have the call and apply methods.
4847
* In this case, it will work, but you are limited to four arguments.
4849
* @param periodic {boolean} if true, executes continuously at supplied
4850
* interval until canceled.
4851
* @return {object} a timer object. Call the cancel() method on this
4852
* object to stop the timer.
4854
Y.later = function(when, o, fn, data, periodic) {
4856
data = (!Y.Lang.isUndefined(data)) ? Y.Array(data) : NO_ARGS;
4857
o = o || Y.config.win || Y;
4859
var cancelled = false,
4860
method = (o && Y.Lang.isString(fn)) ? o[fn] : fn,
4861
wrapper = function() {
4862
// IE 8- may execute a setInterval callback one last time
4863
// after clearInterval was called, so in order to preserve
4864
// the cancel() === no more runny-run, we have to jump through
4867
if (!method.apply) {
4868
method(data[0], data[1], data[2], data[3]);
4870
method.apply(o, data || NO_ARGS);
4874
id = (periodic) ? setInterval(wrapper, when) : setTimeout(wrapper, when);
4879
cancel: function() {
4881
if (this.interval) {
4890
Y.Lang.later = Y.later;
4894
}, '3.4.1' ,{requires:['yui-base']});
4895
YUI.add('loader-base', function(Y) {
4898
* The YUI loader core
4900
* @submodule loader-base
4903
if (!YUI.Env[Y.version]) {
4906
var VERSION = Y.version,
4908
ROOT = VERSION + BUILD,
4909
CDN_BASE = Y.Env.base,
4910
GALLERY_VERSION = 'gallery-2011.09.14-20-40',
4913
YUI2_VERSION = '2.9.0',
4914
COMBO_BASE = CDN_BASE + 'combo?',
4915
META = { version: VERSION,
4918
comboBase: COMBO_BASE,
4919
skin: { defaultSkin: 'sam',
4920
base: 'assets/skins/',
4927
'cssfonts-context']},
4930
groups = META.groups,
4931
yui2Update = function(tnt, yui2) {
4932
var root = TNT + '.' +
4933
(tnt || TNT_VERSION) + '/' +
4934
(yui2 || YUI2_VERSION) + BUILD;
4935
groups.yui2.base = CDN_BASE + root;
4936
groups.yui2.root = root;
4938
galleryUpdate = function(tag) {
4939
var root = (tag || GALLERY_VERSION) + BUILD;
4940
groups.gallery.base = CDN_BASE + root;
4941
groups.gallery.root = root;
4944
groups[VERSION] = {};
4949
comboBase: COMBO_BASE,
4950
update: galleryUpdate,
4951
patterns: { 'gallery-': { },
4952
'lang/gallery-': {},
4953
'gallerycss-': { type: 'css' } }
4959
comboBase: COMBO_BASE,
4963
configFn: function(me) {
4964
if (/-skin|reset|fonts|grids|base/.test(me.name)) {
4966
me.path = me.path.replace(/\.js/, '.css');
4967
// this makes skins in builds earlier than
4968
// 2.6.0 work as long as combine is false
4969
me.path = me.path.replace(/\/yui2-skin/,
4970
'/assets/skins/sam/yui2-skin');
4980
YUI.Env[VERSION] = META;
4986
* Loader dynamically loads script and css files. It includes the dependency
4987
* info for the version of the library in use, and will automatically pull in
4988
* dependencies for the modules requested. It supports rollup files and will
4989
* automatically use these when appropriate in order to minimize the number of
4990
* http connections required to load all of the dependencies. It can load the
4991
* files from the Yahoo! CDN, and it can utilize the combo service provided on
4992
* this network to reduce the number of http connections required to download
4997
* @submodule loader-base
5001
NO_REQUIREMENTS = [],
5002
MAX_URL_LENGTH = 2048,
5003
GLOBAL_ENV = YUI.Env,
5004
GLOBAL_LOADED = GLOBAL_ENV._loaded,
5008
VERSION = Y.version,
5011
oeach = YObject.each,
5013
_queue = GLOBAL_ENV._loaderQueue,
5014
META = GLOBAL_ENV[VERSION],
5015
SKIN_PREFIX = 'skin-',
5017
ON_PAGE = GLOBAL_ENV.mods,
5020
_path = function(dir, file, type, nomin) {
5021
var path = dir + '/' + file;
5025
path += '.' + (type || CSS);
5030
if (YUI.Env.aliases) {
5031
YUI.Env.aliases = {}; //Don't need aliases if Loader is present
5035
* The component metadata is stored in Y.Env.meta.
5036
* Part of the loader module.
5043
* Loader dynamically loads script and css files. It includes the dependency
5044
* info for the version of the library in use, and will automatically pull in
5045
* dependencies for the modules requested. It supports rollup files and will
5046
* automatically use these when appropriate in order to minimize the number of
5047
* http connections required to load all of the dependencies. It can load the
5048
* files from the Yahoo! CDN, and it can utilize the combo service provided on
5049
* this network to reduce the number of http connections required to download
5052
* While the loader can be instantiated by the end user, it normally is not.
5053
* @see YUI.use for the normal use case. The use function automatically will
5054
* pull in missing dependencies.
5058
* @param {object} o an optional set of configuration options. Valid options:
5063
* The YUI combo service base dir. Ex: http://yui.yahooapis.com/combo?</li>
5065
* The root path to prepend to module names for the combo service.
5066
* Ex: 2.5.2/build/</li>
5069
* A filter to apply to result urls. This filter will modify the default
5070
* path for all modules. The default path for the YUI library is the
5071
* minified version of the files (e.g., event-min.js). The filter property
5072
* can be a predefined filter or a custom filter. The valid predefined
5076
* <dd>Selects the debug versions of the library (e.g., event-debug.js).
5077
* This option will automatically include the Logger widget</dd>
5079
* <dd>Selects the non-minified version of the library (e.g., event.js).
5082
* You can also define a custom filter, which must be an object literal
5083
* containing a search expression and a replace string:
5086
* 'searchExp': "-min\\.js",
5087
* 'replaceStr': "-debug.js"
5092
* <li>filters: per-component filter specification. If specified
5093
* for a given component, this overrides the filter config. _Note:_ This does not work on combo urls, use the filter property instead.</li>
5095
* Use the YUI combo service to reduce the number of http connections
5096
* required to load your dependencies</li>
5098
* A list of modules that should never be dynamically loaded</li>
5100
* A list of modules that should always be loaded when required, even if
5101
* already present on the page</li>
5103
* Node or id for a node that should be used as the insertion point for
5106
* charset for dynamic nodes (deprecated, use jsAttributes or cssAttributes)
5108
* <li>jsAttributes: object literal containing attributes to add to script
5110
* <li>cssAttributes: object literal containing attributes to add to link
5113
* The number of milliseconds before a timeout occurs when dynamically
5114
* loading nodes. If not set, there is no timeout</li>
5116
* execution context for all callbacks</li>
5118
* callback for the 'success' event</li>
5119
* <li>onFailure: callback for the 'failure' event</li>
5120
* <li>onCSS: callback for the 'CSSComplete' event. When loading YUI
5121
* components with CSS the CSS is loaded first, then the script. This
5122
* provides a moment you can tie into to improve
5123
* the presentation of the page while the script is loading.</li>
5125
* callback for the 'timeout' event</li>
5127
* callback executed each time a script or css file is loaded</li>
5129
* A list of module definitions. See Loader.addModule for the supported
5130
* module metadata</li>
5132
* A list of group definitions. Each group can contain specific definitions
5133
* for base, comboBase, combine, and accepts a list of modules. See above
5134
* for the description of these properties.</li>
5135
* <li>2in3: the version of the YUI 2 in 3 wrapper to use. The intrinsic
5136
* support for YUI 2 modules in YUI 3 relies on versions of the YUI 2
5137
* components inside YUI 3 module wrappers. These wrappers
5138
* change over time to accomodate the issues that arise from running YUI 2
5139
* in a YUI 3 sandbox.</li>
5140
* <li>yui2: when using the 2in3 project, you can select the version of
5141
* YUI 2 to use. Valid values * are 2.2.2, 2.3.1, 2.4.1, 2.5.2, 2.6.0,
5142
* 2.7.0, 2.8.0, and 2.8.1 [default] -- plus all versions of YUI 2
5143
* going forward.</li>
5146
Y.Loader = function(o) {
5148
var defaults = META.modules,
5151
modulekey = META.md5;
5154
* Internal callback to handle multiple internal insert() calls
5155
* so that css is inserted prior to js
5156
* @property _internalCallback
5159
// self._internalCallback = null;
5162
* Callback that will be executed when the loader is finished
5167
// self.onSuccess = null;
5170
* Callback that will be executed if there is a failure
5174
// self.onFailure = null;
5177
* Callback for the 'CSSComplete' event. When loading YUI components
5178
* with CSS the CSS is loaded first, then the script. This provides
5179
* a moment you can tie into to improve the presentation of the page
5180
* while the script is loading.
5184
// self.onCSS = null;
5187
* Callback executed each time a script or css file is loaded
5188
* @method onProgress
5191
// self.onProgress = null;
5194
* Callback that will be executed if a timeout occurs
5198
// self.onTimeout = null;
5201
* The execution context for all callbacks
5203
* @default {YUI} the YUI instance
5208
* Data that is passed to all callbacks
5211
// self.data = null;
5214
* Node reference or id where new nodes should be inserted before
5215
* @property insertBefore
5216
* @type string|HTMLElement
5218
// self.insertBefore = null;
5221
* The charset attribute for inserted nodes
5224
* @deprecated , use cssAttributes or jsAttributes.
5226
// self.charset = null;
5229
* An object literal containing attributes to add to link nodes
5230
* @property cssAttributes
5233
// self.cssAttributes = null;
5236
* An object literal containing attributes to add to script nodes
5237
* @property jsAttributes
5240
// self.jsAttributes = null;
5243
* The base directory.
5246
* @default http://yui.yahooapis.com/[YUI VERSION]/build/
5248
self.base = Y.Env.meta.base + Y.Env.meta.root;
5251
* Base path for the combo service
5252
* @property comboBase
5254
* @default http://yui.yahooapis.com/combo?
5256
self.comboBase = Y.Env.meta.comboBase;
5259
* Base path for language packs.
5261
// self.langBase = Y.Env.meta.langBase;
5265
* If configured, the loader will attempt to use the combo
5266
* service for YUI resources and configured external resources.
5269
* @default true if a base dir isn't in the config
5271
self.combine = o.base &&
5272
(o.base.indexOf(self.comboBase.substr(0, 20)) > -1);
5275
* The default seperator to use between files in a combo URL
5276
* @property comboSep
5278
* @default Ampersand
5280
self.comboSep = '&';
5282
* Max url length for combo urls. The default is 2048. This is the URL
5283
* limit for the Yahoo! hosted combo servers. If consuming
5284
* a different combo service that has a different URL limit
5285
* it is possible to override this default by supplying
5286
* the maxURLLength config option. The config option will
5287
* only take effect if lower than the default.
5289
* @property maxURLLength
5292
self.maxURLLength = MAX_URL_LENGTH;
5295
* Ignore modules registered on the YUI global
5296
* @property ignoreRegistered
5299
// self.ignoreRegistered = false;
5302
* Root path to prepend to module path for the combo
5306
* @default [YUI VERSION]/build/
5308
self.root = Y.Env.meta.root;
5311
* Timeout value in milliseconds. If set, self value will be used by
5312
* the get utility. the timeout event will fire if
5320
* A list of modules that should not be loaded, even if
5321
* they turn up in the dependency tree
5325
// self.ignore = null;
5328
* A list of modules that should always be loaded, even
5329
* if they have already been inserted into the page.
5333
// self.force = null;
5338
* Should we allow rollups
5339
* @property allowRollup
5343
self.allowRollup = false;
5346
* A filter to apply to result urls. This filter will modify the default
5347
* path for all modules. The default path for the YUI library is the
5348
* minified version of the files (e.g., event-min.js). The filter property
5349
* can be a predefined filter or a custom filter. The valid predefined
5353
* <dd>Selects the debug versions of the library (e.g., event-debug.js).
5354
* This option will automatically include the Logger widget</dd>
5356
* <dd>Selects the non-minified version of the library (e.g., event.js).
5359
* You can also define a custom filter, which must be an object literal
5360
* containing a search expression and a replace string:
5363
* 'searchExp': "-min\\.js",
5364
* 'replaceStr': "-debug.js"
5368
* @type string| {searchExp: string, replaceStr: string}
5370
// self.filter = null;
5373
* per-component filter specification. If specified for a given
5374
* component, this overrides the filter config.
5381
* The list of requested modules
5382
* @property required
5383
* @type {string: boolean}
5388
* If a module name is predefined when requested, it is checked againsts
5389
* the patterns provided in this property. If there is a match, the
5390
* module is added with the default configuration.
5392
* At the moment only supporting module prefixes, but anticipate
5393
* supporting at least regular expressions.
5394
* @property patterns
5397
// self.patterns = Y.merge(Y.Env.meta.patterns);
5401
* The library metadata
5402
* @property moduleInfo
5404
// self.moduleInfo = Y.merge(Y.Env.meta.moduleInfo);
5405
self.moduleInfo = {};
5407
self.groups = Y.merge(Y.Env.meta.groups);
5410
* Provides the information used to skin the skinnable components.
5411
* The following skin definition would result in 'skin1' and 'skin2'
5412
* being loaded for calendar (if calendar was requested), and
5413
* 'sam' for all other skinnable components:
5418
* // The default skin, which is automatically applied if not
5419
* // overriden by a component-specific skin definition.
5420
* // Change this in to apply a different skin globally
5421
* defaultSkin: 'sam',
5423
* // This is combined with the loader base property to get
5424
* // the default root directory for a skin. ex:
5425
* // http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/
5426
* base: 'assets/skins/',
5428
* // Any component-specific overrides can be specified here,
5429
* // making it possible to load different skins for different
5430
* // components. It is possible to load more than one skin
5431
* // for a given component as well.
5433
* calendar: ['skin1', 'skin2']
5439
self.skin = Y.merge(Y.Env.meta.skin);
5442
* Map of conditional modules
5445
self.conditions = {};
5447
// map of modules with a hash of modules that meet the requirement
5448
// self.provides = {};
5451
self._internal = true;
5454
cache = GLOBAL_ENV._renderedMods;
5457
oeach(cache, function modCache(v, k) {
5458
//self.moduleInfo[k] = Y.merge(v);
5459
self.moduleInfo[k] = v;
5462
cache = GLOBAL_ENV._conditions;
5464
oeach(cache, function condCache(v, k) {
5465
//self.conditions[k] = Y.merge(v);
5466
self.conditions[k] = v;
5470
oeach(defaults, self.addModule, self);
5473
if (!GLOBAL_ENV._renderedMods) {
5474
//GLOBAL_ENV._renderedMods = Y.merge(self.moduleInfo);
5475
//GLOBAL_ENV._conditions = Y.merge(self.conditions);
5476
GLOBAL_ENV._renderedMods = self.moduleInfo;
5477
GLOBAL_ENV._conditions = self.conditions;
5480
self._inspectPage();
5482
self._internal = false;
5486
self.testresults = null;
5488
if (Y.config.tests) {
5489
self.testresults = Y.config.tests;
5493
* List of rollup files found in the library metadata
5496
// self.rollups = null;
5499
* Whether or not to load optional dependencies for
5500
* the requested modules
5501
* @property loadOptional
5505
// self.loadOptional = false;
5508
* All of the derived dependencies in sorted order, which
5509
* will be populated when either calculate() or insert()
5517
* Set when beginning to compute the dependency tree.
5518
* Composed of what YUI reports to be loaded combined
5519
* with what has been loaded by any instance on the page
5520
* with the version number specified in the metadata.
5522
* @type {string: boolean}
5524
self.loaded = GLOBAL_LOADED[VERSION];
5527
* A list of modules to attach to the YUI instance when complete.
5528
* If not supplied, the sorted list of dependencies are applied.
5529
* @property attaching
5531
// self.attaching = null;
5534
* Flag to indicate the dependency tree needs to be recomputed
5535
* if insert is called again.
5543
* List of modules inserted by the utility
5544
* @property inserted
5545
* @type {string: boolean}
5550
* List of skipped modules during insert() because the module
5556
// Y.on('yui:load', self.loadNext, self);
5561
* Cached sorted calculate results
5565
//self.results = {};
5569
Y.Loader.prototype = {
5573
'searchExp': '-min\\.js',
5577
'searchExp': '-min\\.js',
5578
'replaceStr': '-debug.js'
5582
* Check the pages meta-data and cache the result.
5583
* @method _inspectPage
5586
_inspectPage: function() {
5587
oeach(ON_PAGE, function(v, k) {
5589
var m = this.moduleInfo[k],
5590
req = v.details.requires,
5591
mr = m && m.requires;
5593
if (!m._inspected && req && mr.length != req.length) {
5594
// console.log('deleting ' + m.name);
5595
// m.requres = YObject.keys(Y.merge(YArray.hash(req), YArray.hash(mr)));
5597
// delete m.expanded_map;
5600
m = this.addModule(v.details, k);
5602
m._inspected = true;
5607
* returns true if b is not loaded, and is required directly or by means of modules it supersedes.
5610
* @param {String} mod1 The first module to compare
5611
* @param {String} mod2 The second module to compare
5613
_requires: function(mod1, mod2) {
5615
var i, rm, after_map, s,
5616
info = this.moduleInfo,
5624
rm = m.expanded_map;
5625
after_map = m.after_map;
5627
// check if this module should be sorted after the other
5628
// do this first to short circut circular deps
5629
if (after_map && (mod2 in after_map)) {
5633
after_map = other.after_map;
5636
if (after_map && (mod1 in after_map)) {
5640
// check if this module requires one the other supersedes
5641
s = info[mod2] && info[mod2].supersedes;
5643
for (i = 0; i < s.length; i++) {
5644
if (this._requires(mod1, s[i])) {
5650
s = info[mod1] && info[mod1].supersedes;
5652
for (i = 0; i < s.length; i++) {
5653
if (this._requires(mod2, s[i])) {
5659
// check if this module requires the other directly
5660
// if (r && YArray.indexOf(r, mod2) > -1) {
5661
if (rm && (mod2 in rm)) {
5665
// external css files should be sorted below yui css
5666
if (m.ext && m.type == CSS && !other.ext && other.type == CSS) {
5673
* Apply a new config to the Loader instance
5675
* @param {Object} o The new configuration
5677
_config: function(o) {
5678
var i, j, val, f, group, groupName, self = this;
5679
// apply config values
5682
if (o.hasOwnProperty(i)) {
5684
if (i == 'require') {
5686
} else if (i == 'skin') {
5687
Y.mix(self.skin, o[i], true);
5688
} else if (i == 'groups') {
5690
if (val.hasOwnProperty(j)) {
5691
// Y.log('group: ' + j);
5694
self.addGroup(group, groupName);
5698
} else if (i == 'modules') {
5699
// add a hash of module definitions
5700
oeach(val, self.addModule, self);
5701
} else if (i == 'gallery') {
5702
this.groups.gallery.update(val);
5703
} else if (i == 'yui2' || i == '2in3') {
5704
this.groups.yui2.update(o['2in3'], o.yui2);
5705
} else if (i == 'maxURLLength') {
5706
self[i] = Math.min(MAX_URL_LENGTH, val);
5717
if (L.isString(f)) {
5718
f = f.toUpperCase();
5719
self.filterName = f;
5720
self.filter = self.FILTER_DEFS[f];
5722
self.require('yui-log', 'dump');
5727
self.require('intl-base', 'intl');
5733
* Returns the skin module name for the specified skin name. If a
5734
* module name is supplied, the returned skin module name is
5735
* specific to the module passed in.
5736
* @method formatSkin
5737
* @param {string} skin the name of the skin.
5738
* @param {string} mod optional: the name of a module to skin.
5739
* @return {string} the full skin module name.
5741
formatSkin: function(skin, mod) {
5742
var s = SKIN_PREFIX + skin;
5751
* Adds the skin def to the module info
5753
* @param {string} skin the name of the skin.
5754
* @param {string} mod the name of the module.
5755
* @param {string} parent parent module if this is a skin of a
5756
* submodule or plugin.
5757
* @return {string} the module name for the skin.
5760
_addSkin: function(skin, mod, parent) {
5761
var mdef, pkg, name, nmod,
5762
info = this.moduleInfo,
5764
ext = info[mod] && info[mod].ext;
5766
// Add a module definition for the module-specific skin css
5768
name = this.formatSkin(skin, mod);
5771
pkg = mdef.pkg || mod;
5777
path: (parent || pkg) + '/' + sinf.base + skin +
5782
nmod.base = mdef.base;
5784
if (mdef.configFn) {
5785
nmod.configFn = mdef.configFn;
5787
this.addModule(nmod, name);
5789
Y.log('adding skin ' + name + ', ' + parent + ', ' + pkg + ', ' + info[name].path);
5797
* Add a new module group
5799
* <dt>name:</dt> <dd>required, the group name</dd>
5800
* <dt>base:</dt> <dd>The base dir for this module group</dd>
5801
* <dt>root:</dt> <dd>The root path to add to each combo
5802
* resource path</dd>
5803
* <dt>combine:</dt> <dd>combo handle</dd>
5804
* <dt>comboBase:</dt> <dd>combo service base path</dd>
5805
* <dt>modules:</dt> <dd>the group of modules</dd>
5808
* @param {object} o An object containing the module data.
5809
* @param {string} name the group name.
5811
addGroup: function(o, name) {
5812
var mods = o.modules,
5814
name = name || o.name;
5816
self.groups[name] = o;
5819
oeach(o.patterns, function(v, k) {
5821
self.patterns[k] = v;
5826
oeach(mods, function(v, k) {
5828
self.addModule(v, k);
5834
* Add a new module to the component metadata.
5836
* <dt>name:</dt> <dd>required, the component name</dd>
5837
* <dt>type:</dt> <dd>required, the component type (js or css)
5839
* <dt>path:</dt> <dd>required, the path to the script from
5841
* <dt>requires:</dt> <dd>array of modules required by this
5843
* <dt>optional:</dt> <dd>array of optional modules for this
5845
* <dt>supersedes:</dt> <dd>array of the modules this component
5847
* <dt>after:</dt> <dd>array of modules the components which, if
5848
* present, should be sorted above this one</dd>
5849
* <dt>after_map:</dt> <dd>faster alternative to 'after' -- supply
5850
* a hash instead of an array</dd>
5851
* <dt>rollup:</dt> <dd>the number of superseded modules required
5852
* for automatic rollup</dd>
5853
* <dt>fullpath:</dt> <dd>If fullpath is specified, this is used
5854
* instead of the configured base + path</dd>
5855
* <dt>skinnable:</dt> <dd>flag to determine if skin assets should
5856
* automatically be pulled in</dd>
5857
* <dt>submodules:</dt> <dd>a hash of submodules</dd>
5858
* <dt>group:</dt> <dd>The group the module belongs to -- this
5859
* is set automatically when it is added as part of a group
5860
* configuration.</dd>
5862
* <dd>array of BCP 47 language tags of languages for which this
5863
* module has localized resource bundles,
5864
* e.g., ["en-GB","zh-Hans-CN"]</dd>
5865
* <dt>condition:</dt>
5866
* <dd>Specifies that the module should be loaded automatically if
5867
* a condition is met. This is an object with up to three fields:
5868
* [trigger] - the name of a module that can trigger the auto-load
5869
* [test] - a function that returns true when the module is to be
5871
* [when] - specifies the load order of the conditional module
5872
* with regard to the position of the trigger module.
5873
* This should be one of three values: 'before', 'after', or
5874
* 'instead'. The default is 'after'.
5876
* <dt>testresults:</dt><dd>a hash of test results from Y.Features.all()</dd>
5879
* @param {object} o An object containing the module data.
5880
* @param {string} name the module name (optional), required if not
5881
* in the module data.
5882
* @return {object} the module definition or null if
5883
* the object passed in did not provide all required attributes.
5885
addModule: function(o, name) {
5886
name = name || o.name;
5888
//Only merge this data if the temp flag is set
5889
//from an earlier pass from a pattern or else
5890
//an override module (YUI_config) can not be used to
5891
//replace a default module.
5892
if (this.moduleInfo[name] && this.moduleInfo[name].temp) {
5893
//This catches temp modules loaded via a pattern
5894
// The module will be added twice, once from the pattern and
5895
// Once from the actual add call, this ensures that properties
5896
// that were added to the module the first time around (group: gallery)
5897
// are also added the second time around too.
5898
o = Y.merge(this.moduleInfo[name], o);
5903
if (!o || !o.name) {
5911
if (!o.path && !o.fullpath) {
5912
o.path = _path(name, name, o.type);
5914
o.supersedes = o.supersedes || o.use;
5916
o.ext = ('ext' in o) ? o.ext : (this._internal) ? false : true;
5917
o.requires = this.filterRequires(o.requires) || [];
5919
// Handle submodule logic
5920
var subs = o.submodules, i, l, t, sup, s, smod, plugins, plug,
5921
j, langs, packName, supName, flatSup, flatLang, lang, ret,
5922
overrides, skinname, when,
5923
conditions = this.conditions, trigger;
5924
// , existing = this.moduleInfo[name], newr;
5926
this.moduleInfo[name] = o;
5928
if (!o.langPack && o.lang) {
5929
langs = YArray(o.lang);
5930
for (j = 0; j < langs.length; j++) {
5932
packName = this.getLangPackName(lang, name);
5933
smod = this.moduleInfo[packName];
5935
smod = this._addLangPack(lang, o, packName);
5941
sup = o.supersedes || [];
5945
if (subs.hasOwnProperty(i)) {
5948
s.path = s.path || _path(name, i, o.type);
5953
sup = sup.concat(s.supersedes);
5956
smod = this.addModule(s, i);
5959
if (smod.skinnable) {
5961
overrides = this.skin.overrides;
5962
if (overrides && overrides[i]) {
5963
for (j = 0; j < overrides[i].length; j++) {
5964
skinname = this._addSkin(overrides[i][j],
5969
skinname = this._addSkin(this.skin.defaultSkin,
5974
// looks like we are expected to work out the metadata
5975
// for the parent module language packs from what is
5976
// specified in the child modules.
5977
if (s.lang && s.lang.length) {
5979
langs = YArray(s.lang);
5980
for (j = 0; j < langs.length; j++) {
5982
packName = this.getLangPackName(lang, name);
5983
supName = this.getLangPackName(lang, i);
5984
smod = this.moduleInfo[packName];
5987
smod = this._addLangPack(lang, o, packName);
5990
flatSup = flatSup || YArray.hash(smod.supersedes);
5992
if (!(supName in flatSup)) {
5993
smod.supersedes.push(supName);
5996
o.lang = o.lang || [];
5998
flatLang = flatLang || YArray.hash(o.lang);
6000
if (!(lang in flatLang)) {
6004
// Y.log('pack ' + packName + ' should supersede ' + supName);
6005
// Add rollup file, need to add to supersedes list too
6008
packName = this.getLangPackName(ROOT_LANG, name);
6009
supName = this.getLangPackName(ROOT_LANG, i);
6011
smod = this.moduleInfo[packName];
6014
smod = this._addLangPack(lang, o, packName);
6017
if (!(supName in flatSup)) {
6018
smod.supersedes.push(supName);
6021
// Y.log('pack ' + packName + ' should supersede ' + supName);
6022
// Add rollup file, need to add to supersedes list too
6030
//o.supersedes = YObject.keys(YArray.hash(sup));
6031
o.supersedes = YArray.dedupe(sup);
6032
if (this.allowRollup) {
6033
o.rollup = (l < 4) ? l : Math.min(l - 1, 4);
6037
plugins = o.plugins;
6039
for (i in plugins) {
6040
if (plugins.hasOwnProperty(i)) {
6043
plug.path = plug.path || _path(name, i, o.type);
6044
plug.requires = plug.requires || [];
6045
plug.group = o.group;
6046
this.addModule(plug, i);
6048
this._addSkin(this.skin.defaultSkin, i, name);
6056
t = o.condition.trigger;
6057
if (YUI.Env.aliases[t]) {
6058
t = YUI.Env.aliases[t];
6060
if (!Y.Lang.isArray(t)) {
6064
for (i = 0; i < t.length; i++) {
6066
when = o.condition.when;
6067
conditions[trigger] = conditions[trigger] || {};
6068
conditions[trigger][name] = o.condition;
6069
// the 'when' attribute can be 'before', 'after', or 'instead'
6070
// the default is after.
6071
if (when && when != 'after') {
6072
if (when == 'instead') { // replace the trigger
6073
o.supersedes = o.supersedes || [];
6074
o.supersedes.push(trigger);
6075
} else { // before the trigger
6076
// the trigger requires the conditional mod,
6077
// so it should appear before the conditional
6078
// mod if we do not intersede.
6080
} else { // after the trigger
6081
o.after = o.after || [];
6082
o.after.push(trigger);
6088
o.after_map = YArray.hash(o.after);
6091
// this.dirty = true;
6094
ret = o.configFn(o);
6095
if (ret === false) {
6096
delete this.moduleInfo[name];
6105
* Add a requirement for one or more module
6107
* @param {string[] | string*} what the modules to load.
6109
require: function(what) {
6110
var a = (typeof what === 'string') ? YArray(arguments) : what;
6112
this.required = Y.merge(this.required, YArray.hash(this.filterRequires(a)));
6114
this._explodeRollups();
6117
* Grab all the items that were asked for, check to see if the Loader
6118
* meta-data contains a "use" array. If it doesm remove the asked item and replace it with
6119
* the content of the "use".
6120
* This will make asking for: "dd"
6121
* Actually ask for: "dd-ddm-base,dd-ddm,dd-ddm-drop,dd-drag,dd-proxy,dd-constrain,dd-drop,dd-scroll,dd-drop-plugin"
6123
* @method _explodeRollups
6125
_explodeRollups: function() {
6128
if (!self.allowRollup) {
6129
oeach(r, function(v, name) {
6130
m = self.getModule(name);
6133
YArray.each(m.use, function(v) {
6134
m = self.getModule(v);
6137
YArray.each(m.use, function(v) {
6151
* Explodes the required array to remove aliases and replace them with real modules
6152
* @method filterRequires
6153
* @param {Array} r The original requires array
6154
* @return {Array} The new array of exploded requirements
6156
filterRequires: function(r) {
6158
if (!Y.Lang.isArray(r)) {
6162
var c = [], i, mod, o, m;
6164
for (i = 0; i < r.length; i++) {
6165
mod = this.getModule(r[i]);
6166
if (mod && mod.use) {
6167
for (o = 0; o < mod.use.length; o++) {
6168
//Must walk the other modules in case a module is a rollup of rollups (datatype)
6169
m = this.getModule(mod.use[o]);
6171
c = Y.Array.dedupe([].concat(c, this.filterRequires(m.use)));
6185
* Returns an object containing properties for all modules required
6186
* in order to load the requested module
6187
* @method getRequires
6188
* @param {object} mod The module definition from moduleInfo.
6189
* @return {array} the expanded requirement list.
6191
getRequires: function(mod) {
6193
if (!mod || mod._parsed) {
6194
// Y.log('returning no reqs for ' + mod.name);
6195
return NO_REQUIREMENTS;
6198
var i, m, j, add, packName, lang, testresults = this.testresults,
6199
name = mod.name, cond, go,
6200
adddef = ON_PAGE[name] && ON_PAGE[name].details,
6203
o, skinmod, skindef, skinpar, skinname,
6204
intl = mod.lang || mod.intl,
6205
info = this.moduleInfo,
6206
ftests = Y.Features && Y.Features.tests.load,
6209
// console.log(name);
6211
// pattern match leaves module stub that needs to be filled out
6212
if (mod.temp && adddef) {
6214
mod = this.addModule(adddef, name);
6215
mod.group = old_mod.group;
6216
mod.pkg = old_mod.pkg;
6217
delete mod.expanded;
6220
// console.log('cache: ' + mod.langCache + ' == ' + this.lang);
6222
// if (mod.expanded && (!mod.langCache || mod.langCache == this.lang)) {
6223
if (mod.expanded && (!this.lang || mod.langCache === this.lang)) {
6224
//Y.log('Already expanded ' + name + ', ' + mod.expanded);
6225
return mod.expanded;
6232
r = this.filterRequires(mod.requires);
6234
//If a module has a lang attribute, auto add the intl requirement.
6239
o = this.filterRequires(mod.optional);
6241
// Y.log("getRequires: " + name + " (dirty:" + this.dirty +
6242
// ", expanded:" + mod.expanded + ")");
6245
mod.langCache = this.lang;
6247
for (i = 0; i < r.length; i++) {
6248
//Y.log(name + ' requiring ' + r[i], 'info', 'loader');
6252
m = this.getModule(r[i]);
6254
add = this.getRequires(m);
6255
intl = intl || (m.expanded_map &&
6256
(INTL in m.expanded_map));
6257
for (j = 0; j < add.length; j++) {
6264
// get the requirements from superseded modules, if any
6265
r = this.filterRequires(mod.supersedes);
6267
for (i = 0; i < r.length; i++) {
6269
// if this module has submodules, the requirements list is
6270
// expanded to include the submodules. This is so we can
6271
// prevent dups when a submodule is already loaded and the
6272
// parent is requested.
6273
if (mod.submodules) {
6278
m = this.getModule(r[i]);
6281
add = this.getRequires(m);
6282
intl = intl || (m.expanded_map &&
6283
(INTL in m.expanded_map));
6284
for (j = 0; j < add.length; j++) {
6292
if (o && this.loadOptional) {
6293
for (i = 0; i < o.length; i++) {
6299
add = this.getRequires(m);
6300
intl = intl || (m.expanded_map &&
6301
(INTL in m.expanded_map));
6302
for (j = 0; j < add.length; j++) {
6310
cond = this.conditions[name];
6313
if (testresults && ftests) {
6314
oeach(testresults, function(result, id) {
6315
var condmod = ftests[id].name;
6316
if (!hash[condmod] && ftests[id].trigger == name) {
6317
if (result && ftests[id]) {
6318
hash[condmod] = true;
6324
oeach(cond, function(def, condmod) {
6325
if (!hash[condmod]) {
6326
go = def && ((def.ua && Y.UA[def.ua]) ||
6327
(def.test && def.test(Y, r)));
6329
hash[condmod] = true;
6331
m = this.getModule(condmod);
6332
// Y.log('conditional', m);
6334
add = this.getRequires(m);
6335
for (j = 0; j < add.length; j++) {
6345
// Create skin modules
6346
if (mod.skinnable) {
6347
skindef = this.skin.overrides;
6348
oeach(YUI.Env.aliases, function(o, n) {
6349
if (Y.Array.indexOf(o, name) > -1) {
6353
if (skindef && (skindef[name] || (skinpar && skindef[skinpar]))) {
6355
if (skindef[skinpar]) {
6358
for (i = 0; i < skindef[skinname].length; i++) {
6359
skinmod = this._addSkin(skindef[skinname][i], name);
6363
skinmod = this._addSkin(this.skin.defaultSkin, name);
6368
mod._parsed = false;
6372
if (mod.lang && !mod.langPack && Y.Intl) {
6373
lang = Y.Intl.lookupBestLang(this.lang || ROOT_LANG, mod.lang);
6374
//Y.log('Best lang: ' + lang + ', this.lang: ' + this.lang + ', mod.lang: ' + mod.lang);
6375
packName = this.getLangPackName(lang, name);
6377
d.unshift(packName);
6383
mod.expanded_map = YArray.hash(d);
6385
mod.expanded = YObject.keys(mod.expanded_map);
6387
return mod.expanded;
6392
* Returns a hash of module names the supplied module satisfies.
6393
* @method getProvides
6394
* @param {string} name The name of the module.
6395
* @return {object} what this module provides.
6397
getProvides: function(name) {
6398
var m = this.getModule(name), o, s;
6399
// supmap = this.provides;
6405
if (m && !m.provides) {
6410
YArray.each(s, function(v) {
6411
Y.mix(o, this.getProvides(v));
6424
* Calculates the dependency tree, the result is stored in the sorted
6427
* @param {object} o optional options object.
6428
* @param {string} type optional argument to prune modules.
6430
calculate: function(o, type) {
6431
if (o || type || this.dirty) {
6443
if (this.allowRollup) {
6446
this._explodeRollups();
6453
* Creates a "psuedo" package for languages provided in the lang array
6454
* @method _addLangPack
6455
* @param {String} lang The language to create
6456
* @param {Object} m The module definition to create the language pack around
6457
* @param {String} packName The name of the package (e.g: lang/datatype-date-en-US)
6458
* @return {Object} The module definition
6460
_addLangPack: function(lang, m, packName) {
6463
existing = this.moduleInfo[packName];
6467
packPath = _path((m.pkg || name), packName, JS, true);
6469
this.addModule({ path: packPath,
6474
supersedes: [] }, packName);
6477
Y.Env.lang = Y.Env.lang || {};
6478
Y.Env.lang[lang] = Y.Env.lang[lang] || {};
6479
Y.Env.lang[lang][name] = true;
6483
return this.moduleInfo[packName];
6487
* Investigates the current YUI configuration on the page. By default,
6488
* modules already detected will not be loaded again unless a force
6489
* option is encountered. Called by calculate()
6493
_setup: function() {
6494
var info = this.moduleInfo, name, i, j, m, l,
6497
for (name in info) {
6498
if (info.hasOwnProperty(name)) {
6503
//m.requires = YObject.keys(YArray.hash(m.requires));
6504
m.requires = YArray.dedupe(m.requires);
6506
// Create lang pack modules
6507
if (m.lang && m.lang.length) {
6508
// Setup root package if the module has lang defined,
6509
// it needs to provide a root language pack
6510
packName = this.getLangPackName(ROOT_LANG, name);
6511
this._addLangPack(null, m, packName);
6519
//l = Y.merge(this.inserted);
6522
// available modules
6523
if (!this.ignoreRegistered) {
6524
Y.mix(l, GLOBAL_ENV.mods);
6527
// add the ignore list to the list of loaded packages
6529
Y.mix(l, YArray.hash(this.ignore));
6532
// expand the list to include superseded modules
6534
if (l.hasOwnProperty(j)) {
6535
Y.mix(l, this.getProvides(j));
6539
// remove modules on the force list from the loaded list
6541
for (i = 0; i < this.force.length; i++) {
6542
if (this.force[i] in l) {
6543
delete l[this.force[i]];
6548
Y.mix(this.loaded, l);
6554
* Builds a module name for a language pack
6555
* @method getLangPackName
6556
* @param {string} lang the language code.
6557
* @param {string} mname the module to build it for.
6558
* @return {string} the language pack module name.
6560
getLangPackName: function(lang, mname) {
6561
return ('lang/' + mname + ((lang) ? '_' + lang : ''));
6564
* Inspects the required modules list looking for additional
6565
* dependencies. Expands the required list to include all
6566
* required modules. Called by calculate()
6570
_explode: function() {
6571
var r = this.required, m, reqs, done = {},
6574
// the setup phase is over, all modules have been created
6577
self._explodeRollups();
6580
oeach(r, function(v, name) {
6583
m = self.getModule(name);
6585
var expound = m.expound;
6588
r[expound] = self.getModule(expound);
6589
reqs = self.getRequires(r[expound]);
6590
Y.mix(r, YArray.hash(reqs));
6593
reqs = self.getRequires(m);
6594
Y.mix(r, YArray.hash(reqs));
6599
// Y.log('After explode: ' + YObject.keys(r));
6602
* Get's the loader meta data for the requested module
6604
* @param {String} mname The module name to get
6605
* @return {Object} The module metadata
6607
getModule: function(mname) {
6608
//TODO: Remove name check - it's a quick hack to fix pattern WIP
6613
var p, found, pname,
6614
m = this.moduleInfo[mname],
6615
patterns = this.patterns;
6617
// check the patterns library to see if we should automatically add
6618
// the module with defaults
6620
// Y.log('testing patterns ' + YObject.keys(patterns));
6621
for (pname in patterns) {
6622
if (patterns.hasOwnProperty(pname)) {
6623
// Y.log('testing pattern ' + i);
6624
p = patterns[pname];
6626
// use the metadata supplied for the pattern
6627
// as the module definition.
6628
if (mname.indexOf(pname) > -1) {
6637
// Y.log('executing pattern action: ' + pname);
6638
p.action.call(this, mname, pname);
6640
Y.log('Undefined module: ' + mname + ', matched a pattern: ' +
6641
pname, 'info', 'loader');
6642
// ext true or false?
6643
m = this.addModule(Y.merge(found), mname);
6652
// impl in rollup submodule
6653
_rollup: function() { },
6656
* Remove superceded modules and loaded modules. Called by
6657
* calculate() after we have the mega list of all dependencies
6659
* @return {object} the reduced dependency hash.
6662
_reduce: function(r) {
6664
r = r || this.required;
6666
var i, j, s, m, type = this.loadType,
6667
ignore = this.ignore ? YArray.hash(this.ignore) : false;
6670
if (r.hasOwnProperty(i)) {
6671
m = this.getModule(i);
6672
// remove if already loaded
6673
if (((this.loaded[i] || ON_PAGE[i]) &&
6674
!this.forceMap[i] && !this.ignoreRegistered) ||
6675
(type && m && m.type != type)) {
6678
if (ignore && ignore[i]) {
6681
// remove anything this module supersedes
6682
s = m && m.supersedes;
6684
for (j = 0; j < s.length; j++) {
6696
* Handles the queue when a module has been loaded for all cases
6699
* @param {String} msg The message from Loader
6700
* @param {Boolean} success A boolean denoting success or failure
6702
_finish: function(msg, success) {
6703
Y.log('loader finishing: ' + msg + ', ' + Y.id + ', ' +
6704
this.data, 'info', 'loader');
6706
_queue.running = false;
6708
var onEnd = this.onEnd;
6710
onEnd.call(this.context, {
6719
* The default Loader onSuccess handler, calls this.onSuccess with a payload
6720
* @method _onSuccess
6723
_onSuccess: function() {
6724
var self = this, skipped = Y.merge(self.skipped), fn,
6725
failed = [], rreg = self.requireRegistration,
6728
oeach(skipped, function(k) {
6729
delete self.inserted[k];
6734
oeach(self.inserted, function(v, k) {
6735
var mod = self.getModule(k);
6736
if (mod && rreg && mod.type == JS && !(k in YUI.Env.mods)) {
6739
Y.mix(self.loaded, self.getProvides(k));
6743
fn = self.onSuccess;
6744
msg = (failed.length) ? 'notregistered' : 'success';
6745
success = !(failed.length);
6747
fn.call(self.context, {
6755
self._finish(msg, success);
6758
* The default Loader onFailure handler, calls this.onFailure with a payload
6759
* @method _onFailure
6762
_onFailure: function(o) {
6763
Y.log('load error: ' + o.msg + ', ' + Y.id, 'error', 'loader');
6764
var f = this.onFailure, msg = 'failure: ' + o.msg;
6766
f.call(this.context, {
6772
this._finish(msg, false);
6776
* The default Loader onTimeout handler, calls this.onTimeout with a payload
6777
* @method _onTimeout
6780
_onTimeout: function() {
6781
Y.log('loader timeout: ' + Y.id, 'error', 'loader');
6782
var f = this.onTimeout;
6784
f.call(this.context, {
6790
this._finish('timeout', false);
6794
* Sorts the dependency tree. The last step of calculate()
6800
// create an indexed list
6801
var s = YObject.keys(this.required),
6802
// loaded = this.loaded,
6804
p = 0, l, a, b, j, k, moved, doneKey;
6806
// keep going until we make a pass without moving anything
6812
// start the loop after items that are already sorted
6813
for (j = p; j < l; j++) {
6815
// check the next module on the list to see if its
6816
// dependencies have been met
6819
// check everything below current item and move if we
6820
// find a requirement for the current item
6821
for (k = j + 1; k < l; k++) {
6824
if (!done[doneKey] && this._requires(a, s[k])) {
6826
// extract the dependency so we can move it up
6829
// insert the dependency above the item that
6831
s.splice(j, 0, b[0]);
6833
// only swap two dependencies once to short circut
6834
// circular dependencies
6835
done[doneKey] = true;
6844
// jump out of loop if we moved something
6847
// this item is sorted, move our pointer and keep going
6853
// when we make it here and moved is false, we are
6868
partial: function(partial, o, type) {
6869
this.sorted = partial;
6870
this.insert(o, type, true);
6873
* Handles the actual insertion of script/link tags
6875
* @param {Object} source The YUI instance the request came from
6876
* @param {Object} o The metadata to include
6877
* @param {String} type JS or CSS
6878
* @param {Boolean} [skipcalc=false] Do a Loader.calculate on the meta
6880
_insert: function(source, o, type, skipcalc) {
6882
// Y.log('private _insert() ' + (type || '') + ', ' + Y.id, "info", "loader");
6884
// restore the state at the time of the request
6886
this._config(source);
6889
// build the dependency list
6890
// don't include type so we can process CSS and script in
6891
// one pass when the type is not specified.
6896
this.loadType = type;
6902
// Y.log("trying to load css first");
6903
this._internalCallback = function() {
6905
var f = self.onCSS, n, p, sib;
6907
// IE hack for style overrides that are not being applied
6908
if (this.insertBefore && Y.UA.ie) {
6909
n = Y.config.doc.getElementById(this.insertBefore);
6911
sib = n.nextSibling;
6914
p.insertBefore(n, sib);
6921
f.call(self.context, Y);
6923
self._internalCallback = null;
6925
self._insert(null, null, JS);
6928
this._insert(null, null, CSS);
6933
// set a flag to indicate the load has started
6934
this._loading = true;
6936
// flag to indicate we are done with the combo service
6937
// and any additional files will need to be loaded
6939
this._combineComplete = {};
6946
* Once a loader operation is completely finished, process any additional queued items.
6950
_continue: function() {
6951
if (!(_queue.running) && _queue.size() > 0) {
6952
_queue.running = true;
6958
* inserts the requested modules and their dependencies.
6959
* <code>type</code> can be "js" or "css". Both script and
6960
* css are inserted if type is not provided.
6962
* @param {object} o optional options object.
6963
* @param {string} type the type of dependency to insert.
6965
insert: function(o, type, skipsort) {
6966
// Y.log('public insert() ' + (type || '') + ', ' +
6967
// Y.Object.keys(this.required), "info", "loader");
6968
var self = this, copy = Y.merge(this);
6969
delete copy.require;
6971
_queue.add(function() {
6972
self._insert(copy, o, type, skipsort);
6978
* Executed every time a module is loaded, and if we are in a load
6979
* cycle, we attempt to load the next script. Public so that it
6980
* is possible to call this if using a method other than
6981
* Y.register to determine when scripts are fully loaded
6983
* @param {string} mname optional the name of the module that has
6984
* been loaded (which is usually why it is time to load the next
6987
loadNext: function(mname) {
6988
// It is possible that this function is executed due to something
6989
// else on the page loading a YUI module. Only react when we
6990
// are actively loading something
6991
if (!this._loading) {
6995
var s, len, i, m, url, fn, msg, attr, group, groupName, j, frag,
6996
comboSource, comboSources, mods, combining, urls, comboBase,
6998
type = self.loadType,
6999
handleSuccess = function(o) {
7000
self.loadNext(o.data);
7002
handleCombo = function(o) {
7003
self._combineComplete[type] = true;
7004
var i, len = combining.length;
7006
for (i = 0; i < len; i++) {
7007
self.inserted[combining[i]] = true;
7013
if (self.combine && (!self._combineComplete[type])) {
7017
self._combining = combining;
7021
// the default combo base
7022
comboBase = self.comboBase;
7029
for (i = 0; i < len; i++) {
7030
comboSource = comboBase;
7031
m = self.getModule(s[i]);
7032
groupName = m && m.group;
7035
group = self.groups[groupName];
7037
if (!group.combine) {
7042
if (group.comboBase) {
7043
comboSource = group.comboBase;
7046
if ("root" in group && L.isValue(group.root)) {
7047
m.root = group.root;
7052
comboSources[comboSource] = comboSources[comboSource] || [];
7053
comboSources[comboSource].push(m);
7056
for (j in comboSources) {
7057
if (comboSources.hasOwnProperty(j)) {
7059
mods = comboSources[j];
7062
for (i = 0; i < len; i++) {
7063
// m = self.getModule(s[i]);
7066
// Do not try to combine non-yui JS unless combo def
7068
if (m && (m.type === type) && (m.combine || !m.ext)) {
7070
frag = ((L.isValue(m.root)) ? m.root : self.root) + m.path;
7071
frag = self._filter(frag, m.name);
7072
if ((url !== j) && (i <= (len - 1)) &&
7073
((frag.length + url.length) > self.maxURLLength)) {
7074
//Hack until this is rewritten to use an array and not string concat:
7075
if (url.substr(url.length - 1, 1) === self.comboSep) {
7076
url = url.substr(0, (url.length - 1));
7078
urls.push(self._filter(url));
7083
if (i < (len - 1)) {
7084
url += self.comboSep;
7087
combining.push(m.name);
7092
if (combining.length && (url != j)) {
7093
//Hack until this is rewritten to use an array and not string concat:
7094
if (url.substr(url.length - 1, 1) === self.comboSep) {
7095
url = url.substr(0, (url.length - 1));
7097
urls.push(self._filter(url));
7102
if (combining.length) {
7104
Y.log('Attempting to use combo: ' + combining, 'info', 'loader');
7106
// if (m.type === CSS) {
7109
attr = self.cssAttributes;
7112
attr = self.jsAttributes;
7116
data: self._loading,
7117
onSuccess: handleCombo,
7118
onFailure: self._onFailure,
7119
onTimeout: self._onTimeout,
7120
insertBefore: self.insertBefore,
7121
charset: self.charset,
7123
timeout: self.timeout,
7131
self._combineComplete[type] = true;
7137
// if the module that was just loaded isn't what we were expecting,
7139
if (mname !== self._loading) {
7143
// Y.log("loadNext executing, just loaded " + mname + ", " +
7144
// Y.id, "info", "loader");
7146
// The global handler that is called when each module is loaded
7147
// will pass that module name to this function. Storing this
7148
// data to avoid loading the same module multiple times
7149
// centralize this in the callback
7150
self.inserted[mname] = true;
7151
// self.loaded[mname] = true;
7153
// provided = self.getProvides(mname);
7154
// Y.mix(self.loaded, provided);
7155
// Y.mix(self.inserted, provided);
7157
if (self.onProgress) {
7158
self.onProgress.call(self.context, {
7168
for (i = 0; i < len; i = i + 1) {
7169
// this.inserted keeps track of what the loader has loaded.
7170
// move on if this item is done.
7171
if (s[i] in self.inserted) {
7175
// Because rollups will cause multiple load notifications
7176
// from Y, loadNext may be called multiple times for
7177
// the same module when loading a rollup. We can safely
7178
// skip the subsequent requests
7179
if (s[i] === self._loading) {
7180
Y.log('still loading ' + s[i] + ', waiting', 'info', 'loader');
7184
// log("inserting " + s[i]);
7185
m = self.getModule(s[i]);
7188
if (!self.skipped[s[i]]) {
7189
msg = 'Undefined module ' + s[i] + ' skipped';
7190
Y.log(msg, 'warn', 'loader');
7191
// self.inserted[s[i]] = true;
7192
self.skipped[s[i]] = true;
7198
group = (m.group && self.groups[m.group]) || NOT_FOUND;
7200
// The load type is stored to offer the possibility to load
7201
// the css separately from the script.
7202
if (!type || type === m.type) {
7203
self._loading = s[i];
7204
Y.log('attempting to load ' + s[i] + ', ' + self.base, 'info', 'loader');
7206
if (m.type === CSS) {
7208
attr = self.cssAttributes;
7211
attr = self.jsAttributes;
7214
url = (m.fullpath) ? self._filter(m.fullpath, s[i]) :
7215
self._url(m.path, s[i], group.base || m.base);
7219
onSuccess: handleSuccess,
7220
insertBefore: self.insertBefore,
7221
charset: self.charset,
7223
onFailure: self._onFailure,
7224
onTimeout: self._onTimeout,
7225
timeout: self.timeout,
7235
self._loading = null;
7237
fn = self._internalCallback;
7239
// internal callback for loading css first
7241
// Y.log('loader internal');
7242
self._internalCallback = null;
7245
// Y.log('loader complete');
7251
* Apply filter defined for this instance to a url/path
7253
* @param {string} u the string to filter.
7254
* @param {string} name the name of the module, if we are processing
7255
* a single module as opposed to a combined url.
7256
* @return {string} the filtered string.
7259
_filter: function(u, name) {
7260
var f = this.filter,
7261
hasFilter = name && (name in this.filters),
7262
modFilter = hasFilter && this.filters[name],
7263
groupName = this.moduleInfo[name] ? this.moduleInfo[name].group:null;
7264
if (groupName && this.groups[groupName].filter) {
7265
modFilter = this.groups[groupName].filter;
7271
f = (L.isString(modFilter)) ?
7272
this.FILTER_DEFS[modFilter.toUpperCase()] || null :
7276
u = u.replace(new RegExp(f.searchExp, 'g'), f.replaceStr);
7284
* Generates the full url for a module
7286
* @param {string} path the path fragment.
7287
* @param {String} name The name of the module
7288
* @pamra {String} [base=self.base] The base url to use
7289
* @return {string} the full url.
7292
_url: function(path, name, base) {
7293
return this._filter((base || this.base || '') + path, name);
7296
* Returns an Object hash of file arrays built from `loader.sorted` or from an arbitrary list of sorted modules.
7298
* @param {Boolean} [calc=false] Perform a loader.calculate() before anything else
7299
* @param {Array} [s=loader.sorted] An override for the loader.sorted array
7300
* @return {Object} Object hash (js and css) of two arrays of file lists
7301
* @example This method can be used as an off-line dep calculator
7304
* var loader = new Y.Loader({
7309
* require: ['node', 'dd', 'console']
7311
* var out = loader.resolve(true);
7314
resolve: function(calc, s) {
7315
var self = this, i, m, url, out = { js: [], css: [] };
7320
s = s || self.sorted;
7322
for (i = 0; i < s.length; i++) {
7323
m = self.getModule(s[i]);
7326
url = self._filter((self.root + m.path), m.name, self.root);
7328
url = self._filter(m.fullpath, m.name, '') || self._url(m.path, m.name);
7330
out[m.type].push(url);
7334
out.js = [self.comboBase + out.js.join(self.comboSep)];
7335
out.css = [self.comboBase + out.css.join(self.comboSep)];
7341
* Returns an Object hash of hashes built from `loader.sorted` or from an arbitrary list of sorted modules.
7344
* @param {Boolean} [calc=false] Perform a loader.calculate() before anything else
7345
* @param {Array} [s=loader.sorted] An override for the loader.sorted array
7346
* @return {Object} Object hash (js and css) of two object hashes of file lists, with the module name as the key
7347
* @example This method can be used as an off-line dep calculator
7350
* var loader = new Y.Loader({
7355
* require: ['node', 'dd', 'console']
7357
* var out = loader.hash(true);
7360
hash: function(calc, s) {
7361
var self = this, i, m, url, out = { js: {}, css: {} };
7366
s = s || self.sorted;
7368
for (i = 0; i < s.length; i++) {
7369
m = self.getModule(s[i]);
7371
url = self._filter(m.fullpath, m.name, '') || self._url(m.path, m.name);
7372
out[m.type][m.name] = url;
7382
}, '3.4.1' ,{requires:['get']});
7383
YUI.add('loader-rollup', function(Y) {
7386
* Optional automatic rollup logic for reducing http connections
7387
* when not using a combo service.
7393
* Look for rollup packages to determine if all of the modules a
7394
* rollup supersedes are required. If so, include the rollup to
7395
* help reduce the total number of connections required. Called
7396
* by calculate(). This is an optional feature, and requires the
7397
* appropriate submodule to function.
7402
Y.Loader.prototype._rollup = function() {
7403
var i, j, m, s, r = this.required, roll,
7404
info = this.moduleInfo, rolled, c, smod;
7406
// find and cache rollup modules
7407
if (this.dirty || !this.rollups) {
7410
if (info.hasOwnProperty(i)) {
7411
m = this.getModule(i);
7412
// if (m && m.rollup && m.supersedes) {
7413
if (m && m.rollup) {
7414
this.rollups[i] = m;
7419
this.forceMap = (this.force) ? Y.Array.hash(this.force) : {};
7422
// make as many passes as needed to pick up rollup rollups
7426
// go through the rollup candidates
7427
for (i in this.rollups) {
7428
if (this.rollups.hasOwnProperty(i)) {
7429
// there can be only one, unless forced
7430
if (!r[i] && ((!this.loaded[i]) || this.forceMap[i])) {
7431
m = this.getModule(i);
7432
s = m.supersedes || [];
7435
// @TODO remove continue
7442
// check the threshold
7443
for (j = 0; j < s.length; j++) {
7446
// if the superseded module is loaded, we can't
7447
// load the rollup unless it has been forced.
7448
if (this.loaded[s[j]] && !this.forceMap[s[j]]) {
7451
// increment the counter if this module is required.
7452
// if we are beyond the rollup threshold, we will
7453
// use the rollup module
7454
} else if (r[s[j]] && m.type == smod.type) {
7456
// Y.log("adding to thresh: " + c + ", " + s[j]);
7457
roll = (c >= m.rollup);
7459
// Y.log("over thresh " + c + ", " + s[j]);
7466
// Y.log("adding rollup: " + i);
7471
// expand the rollup's dependencies
7472
this.getRequires(m);
7478
// if we made it here w/o rolling up something, we are done
7486
}, '3.4.1' ,{requires:['loader-base']});
7487
YUI.add('loader-yui3', function(Y) {
7489
/* This file is auto-generated by src/loader/scripts/meta_join.py */
7492
* YUI 3 module metadata
7496
YUI.Env[Y.version].modules = YUI.Env[Y.version].modules || {
7535
"anim-node-plugin": {
7580
"arraylist-filter": {
7606
"attribute-complex": {
7613
"autocomplete-base",
7614
"autocomplete-sources",
7615
"autocomplete-list",
7616
"autocomplete-plugin"
7619
"autocomplete-base": {
7621
"autocomplete-sources"
7627
"event-valuechange",
7631
"autocomplete-filters": {
7637
"autocomplete-filters-accentfold": {
7644
"autocomplete-highlighters": {
7650
"autocomplete-highlighters-accentfold": {
7653
"highlight-accentfold"
7656
"autocomplete-list": {
7658
"autocomplete-sources"
7664
"autocomplete-base",
7671
"widget-position-align"
7675
"autocomplete-list-keys": {
7677
"name": "autocomplete-list-keys",
7678
"test": function (Y) {
7679
// Only add keyboard support to autocomplete-list if this doesn't appear to
7680
// be an iOS or Android-based mobile device.
7682
// There's currently no feasible way to actually detect whether a device has
7683
// a hardware keyboard, so this sniff will have to do. It can easily be
7684
// overridden by manually loading the autocomplete-list-keys module.
7686
// Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari
7687
// doesn't fire the keyboard events used by AutoCompleteList, so there's
7688
// no point loading the -keys module even when a bluetooth keyboard may be
7690
return !(Y.UA.ios || Y.UA.android);
7692
"trigger": "autocomplete-list"
7695
"autocomplete-list",
7699
"autocomplete-plugin": {
7701
"autocomplete-list",
7705
"autocomplete-sources": {
7736
"base-pluginhost": {
7788
"datatype-date-math",
7793
"calendarnavigator": {
7816
"classnamemanager": {
7848
"console-filters": {
7870
"createlink-base": {
7886
"cssbase-context": {
7900
"cssfonts-context": {
7913
"cssreset-context": {
7925
"dataschema-array": {
7930
"dataschema-base": {
7935
"dataschema-json": {
7941
"dataschema-text": {
7956
"datasource-function",
7958
"datasource-jsonschema",
7959
"datasource-xmlschema",
7960
"datasource-arrayschema",
7961
"datasource-textschema",
7962
"datasource-polling"
7965
"datasource-arrayschema": {
7972
"datasource-cache": {
7979
"datasource-function": {
7996
"datasource-jsonschema": {
8003
"datasource-local": {
8008
"datasource-polling": {
8013
"datasource-textschema": {
8020
"datasource-xmlschema": {
8030
"datatable-datasource",
8044
"datatable-datasource": {
8051
"datatable-scroll": {
8076
"datatype-date-format"
8079
"datatype-date-parse",
8080
"datatype-date-format"
8083
"datatype-date-format": {
8167
"datatype-date-math": {
8172
"datatype-date-parse": {},
8173
"datatype-number": {
8175
"datatype-number-parse",
8176
"datatype-number-format"
8179
"datatype-number-format": {},
8180
"datatype-number-parse": {},
8183
"datatype-xml-parse",
8184
"datatype-xml-format"
8187
"datatype-xml-format": {},
8188
"datatype-xml-parse": {},
8251
"name": "dd-gestures",
8252
"test": function(Y) {
8253
return (Y.config.win && ('ontouchstart' in Y.config.win && !Y.UA.chrome));
8255
"trigger": "dd-drag"
8337
"name": "dom-style-ie",
8338
"test": function (Y) {
8340
var testFeature = Y.Features.test,
8341
addFeature = Y.Features.add,
8342
WINDOW = Y.config.win,
8343
DOCUMENT = Y.config.doc,
8344
DOCUMENT_ELEMENT = 'documentElement',
8347
addFeature('style', 'computedStyle', {
8349
return WINDOW && 'getComputedStyle' in WINDOW;
8353
addFeature('style', 'opacity', {
8355
return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style;
8359
ret = (!testFeature('style', 'opacity') &&
8360
!testFeature('style', 'computedStyle'));
8364
"trigger": "dom-style"
8457
"name": "event-base-ie",
8458
"test": function(Y) {
8459
var imp = Y.config.doc && Y.config.doc.implementation;
8460
return (imp && (!imp.hasFeature('Events', '2.0')));
8462
"trigger": "node-base"
8470
"event-custom-base",
8471
"event-custom-complex"
8474
"event-custom-base": {
8479
"event-custom-complex": {
8517
"event-mouseenter": {
8522
"event-mousewheel": {
8550
"event-synthetic": {
8553
"event-custom-complex"
8561
"event-valuechange": {
8598
"graphics-canvas": {
8600
"name": "graphics-canvas",
8601
"test": function(Y) {
8602
var DOCUMENT = Y.config.doc,
8603
canvas = DOCUMENT && DOCUMENT.createElement("canvas");
8604
return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (canvas && canvas.getContext && canvas.getContext("2d")));
8606
"trigger": "graphics"
8612
"graphics-canvas-default": {
8614
"name": "graphics-canvas-default",
8615
"test": function(Y) {
8616
var DOCUMENT = Y.config.doc,
8617
canvas = DOCUMENT && DOCUMENT.createElement("canvas");
8618
return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (canvas && canvas.getContext && canvas.getContext("2d")));
8620
"trigger": "graphics"
8625
"name": "graphics-svg",
8626
"test": function(Y) {
8627
var DOCUMENT = Y.config.doc;
8628
return (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
8630
"trigger": "graphics"
8636
"graphics-svg-default": {
8638
"name": "graphics-svg-default",
8639
"test": function(Y) {
8640
var DOCUMENT = Y.config.doc;
8641
return (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
8643
"trigger": "graphics"
8648
"name": "graphics-vml",
8649
"test": function(Y) {
8650
var DOCUMENT = Y.config.doc,
8651
canvas = DOCUMENT && DOCUMENT.createElement("canvas");
8652
return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
8654
"trigger": "graphics"
8660
"graphics-vml-default": {
8662
"name": "graphics-vml-default",
8663
"test": function(Y) {
8664
var DOCUMENT = Y.config.doc,
8665
canvas = DOCUMENT && DOCUMENT.createElement("canvas");
8666
return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
8668
"trigger": "graphics"
8674
"highlight-accentfold"
8677
"highlight-accentfold": {
8701
"event-custom-complex"
8714
"history-hash-ie": {
8716
"name": "history-hash-ie",
8717
"test": function (Y) {
8718
var docMode = Y.config.doc && Y.config.doc.documentMode;
8720
return Y.UA.ie && (!('onhashchange' in Y.config.win) ||
8721
!docMode || docMode < 8);
8723
"trigger": "history-hash"
8769
"event-custom-base",
8770
"querystring-stringify-simple"
8785
"io-upload-iframe": {
8794
"datatype-xml-parse"
8867
"node-event-delegate",
8886
"node-deprecated": {
8891
"node-event-delegate": {
8897
"node-event-html5": {
8902
"node-event-simulate": {
8917
"node-focusmanager": {
8922
"node-event-simulate",
8942
"node-pluginhost": {
8970
"widget-position-align",
8972
"widget-position-constrain"
8981
"widget-position-align",
8983
"widget-position-constrain",
9001
"pluginhost-base": {
9006
"pluginhost-config": {
9018
"querystring-parse",
9019
"querystring-stringify"
9022
"querystring-parse": {
9028
"querystring-parse-simple": {
9033
"querystring-stringify": {
9038
"querystring-stringify-simple": {
9051
"slider-value-range",
9069
"recordset-filter": {
9076
"recordset-indexer": {
9109
"resize-constrain": {
9139
"scrollview-scrollbars"
9142
"scrollview-base": {
9150
"scrollview-base-ie": {
9152
"name": "scrollview-base-ie",
9153
"trigger": "scrollview-base",
9160
"scrollview-list": {
9167
"scrollview-paginator": {
9172
"scrollview-scrollbars": {
9192
"name": "selector-css2",
9193
"test": function (Y) {
9194
var DOCUMENT = Y.config.doc,
9195
ret = DOCUMENT && !('querySelectorAll' in DOCUMENT);
9199
"trigger": "selector"
9211
"selector-native": {
9225
"slider-value-range",
9238
"slider-value-range": {
9250
"sortable-scroll": {
9295
"node-event-delegate",
9320
"text-accentfold": {
9323
"text-data-accentfold"
9326
"text-data-accentfold": {
9331
"text-data-wordbreak": {
9339
"text-data-wordbreak"
9347
"transition-timer": {
9349
"name": "transition-timer",
9350
"test": function (Y) {
9351
var DOCUMENT = Y.config.doc,
9352
node = (DOCUMENT) ? DOCUMENT.documentElement: null,
9355
if (node && node.style) {
9356
ret = !('MozTransition' in node.style || 'WebkitTransition' in node.style);
9361
"trigger": "transition"
9378
"node-event-delegate"
9384
"widget-htmlparser",
9396
"widget-autohide": {
9419
"name": "widget-base-ie",
9420
"trigger": "widget-base",
9441
"widget-htmlparser": {
9451
"widget-modality": {
9466
"widget-position": {
9473
"widget-position-align": {
9478
"widget-position-constrain": {
9501
"widget-uievents": {
9504
"node-event-delegate"
9532
YUI.Env[Y.version].md5 = '105ebffae27a0e3d7331f8cf5c0bb282';
9535
}, '3.4.1' ,{requires:['loader-base']});
9538
YUI.add('yui', function(Y){}, '3.4.1' ,{use:['yui-base','get','features','intl-base','yui-log','yui-later','loader-base', 'loader-rollup', 'loader-yui3' ]});