yui-base.js revision d1f171a81a8b50c0f694f3dd1ea7ccc08e86cf55
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * The YUI module contains the components required for building the YUI seed file.
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * This includes the script loading mechanism, a simple queue, and the core utilities for the library.
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * @module yui
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * @submodule yui-base
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * The YUI global namespace object. If YUI is already defined, the
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * existing YUI object will not be overwritten so that defined
87a49173dbc22a145cb87e605cca83fd42524377Tripp * namespaces are preserved. It is the constructor for the object
87a49173dbc22a145cb87e605cca83fd42524377Tripp * the end user interacts with. As indicated below, each instance
87a49173dbc22a145cb87e605cca83fd42524377Tripp * has full custom event support, but only if the event system
87a49173dbc22a145cb87e605cca83fd42524377Tripp * is available.
87a49173dbc22a145cb87e605cca83fd42524377Tripp * @class YUI
87a49173dbc22a145cb87e605cca83fd42524377Tripp * @constructor
87a49173dbc22a145cb87e605cca83fd42524377Tripp * @uses EventTarget
87a49173dbc22a145cb87e605cca83fd42524377Tripp * @param o* Up to five optional configuration objects. This object is stored
87a49173dbc22a145cb87e605cca83fd42524377Tripp * in YUI.config. See config for the list of supported properties.
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp /*global YUI*/
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp /*global YUI_config*/
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp globalConfig = (typeof YUI_config !== 'undefined') && YUI_config;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp // Allow instantiation without the new operator
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if (!(Y instanceof YUI)) {
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp // set up the core environment
f69d245bb21be88752420e834a6b6be37e9b525fTripp for (i=0; i<l; i++) {
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp // bind the specified additional modules for this instance
87a49173dbc22a145cb87e605cca83fd42524377Tripp(function() {
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp NOOP = function() {},
f69d245bb21be88752420e834a6b6be37e9b525fTripp APPLY_TO_AUTH = { 'io.xdrReady': 1, // the functions applyTo
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp handleLoad = function() {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp// Stamp the documentElement (HTML) with a class of "yui-loaded" to
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp// enable styles that need to key off of JS being enabled.
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp _config: function(o) {
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp o = o || {};
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp var config = this.config, i, j, m, mods = config.modules;
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp for (i in o) {
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp for (j in m) {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp } else if (i == 'win') {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * Initialize this YUI instance
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp _init: function() {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp Y.gallery = 'gallery-2010.02.22-22'; // @TODO build time
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp cdn: 'http://yui.yahooapis.com/' + VERSION + '/build/',
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp // get from querystring
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp nodes = (doc && doc.getElementsByTagName('script')) || [];
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp //&3.0.0/build/yui/yui-min.js"; // debug url
f69d245bb21be88752420e834a6b6be37e9b525fTripp // this is to set up the path to the loader. The file
f69d245bb21be88752420e834a6b6be37e9b525fTripp // filter for loader should match the yui include.
f69d245bb21be88752420e834a6b6be37e9b525fTripp // extract correct path for mixed combo urls
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp // use CDN default
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp // configuration defaults
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * Finishes the instance setup. Attaches whatever modules were defined
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * when the yui modules was registered.
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * @method _setup
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp _setup: function(o) {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp var Y = this,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp extras = Y.config.core || ['get', 'intl-base', 'loader', 'yui-log', 'yui-later', 'yui-throttle'];
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * Executes a method on a YUI instance with
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * the specified id if the specified method is whitelisted.
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * @method applyTo
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * @param id {string} the YUI instance id
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * @param method {string} the name of the method to exectute.
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * Ex: 'Object.keys'
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * @param args {Array} the arguments to apply to the method
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * @return {object} the return value from the applied method or null
f69d245bb21be88752420e834a6b6be37e9b525fTripp this.log(method + ': applyTo not allowed', 'warn', 'yui');
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp return null;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp this.log('applyTo not found: ' + method, 'warn', 'yui');
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp return null;
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * Register a module
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * @method add
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * @param name {string} module name
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * @param fn {Function} entry point into the module that
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * is used to bind module to the YUI instance
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * @param version {string} version string
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * @param details optional config data:
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * requires - features that should be present before loading
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * optional - optional features that should be present if load optional defined
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * use - features that should be attached automatically
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * skinnable -
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * omit - features that should not be loaded if this module is present
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * @return {YUI} the YUI instance
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp // this.log('Adding a new component ' + name);
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp // @todo expand this to include version mapping
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp // @todo may want to restore the build property
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp // @todo fire moduleAvailable event
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp return this;
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp // this.log('attaching ' + name, 'info', 'yui');
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * Bind a module to a YUI instance
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * @param modules* {string} 1-n modules to bind (uses arguments array)
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * @param *callback {function} callback function executed when
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * the instance has the required functionality. If included, it
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * must be the last parameter.
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * Implement versioning? loader can load different versions?
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * Should sub-modules/plugins be normal modules, or do
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * we add syntax for specifying these?
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * YUI().use('dragdrop')
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * YUI().use('dragdrop:2.4.0'); // specific version
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * YUI().use('dragdrop:2.4.0-'); // at least this version
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * YUI().use('dragdrop:2.4.0-2.9999.9999'); // version range
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * YUI().use('*'); // use all available modules
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * YUI().use('lang+dump+substitute'); // use lang and some plugins
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * YUI().use('lang+*'); // use lang and all known plugins
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * @return {YUI} the YUI instance
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp use: function() {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if (!this.Array) {
1dc743f5ebb81123e0c921f2d70392f1d160ddbfTripp // only attach a module once
1dc743f5ebb81123e0c921f2d70392f1d160ddbfTripp // CSS files don't register themselves, see if it has been loaded
1dc743f5ebb81123e0c921f2d70392f1d160ddbfTripp if (use) { // make sure we grab the submodule dependencies too
1dc743f5ebb81123e0c921f2d70392f1d160ddbfTripp // add this module to full list of things to attach
1dc743f5ebb81123e0c921f2d70392f1d160ddbfTripp if (missing.sort().join() == origMissing.sort().join()) {
1dc743f5ebb81123e0c921f2d70392f1d160ddbfTripp if (Y._useQueue && Y._useQueue.size() && !Y._loading) {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp // The last argument supplied to use can be a load complete callback
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp // YUI().use('*'); // bind everything available
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp // use loader to expand dependencies and sort the
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp // requirements if it is available.
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp // loader.allowRollup = false;
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp // process each requirement and any additional requirements
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp // the module metadata specifies
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp // dynamic load
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp } else if (boot && len && Y.Get && !Env.bootstrapped) {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp handleBoot = function() {
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp Y.message('Requirement NOT loaded: ' + missing, 'warn', 'yui');
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * Returns the namespace specified and creates it if it doesn't exist
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * YUI.namespace("property.package");
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * YUI.namespace("YAHOO.property.package");
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * Either of the above would create YUI.property, then
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * YUI.property.package (YAHOO is scrubbed out, this is
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * to remain compatible with YUI2)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * Be careful when naming packages. Reserved words may work in some browsers
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * and not others. For instance, the following will fail in Safari:
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * YUI.namespace("really.long.nested.namespace");
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * This fails because "long" is a future reserved word in ECMAScript
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * @method namespace
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * @param {string*} arguments 1-n namespaces to create
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * @return {object} A reference to the last namespace object created
1941f59d88c42b5449ef1353ec4336805bff6ac9Tripp namespace: function() {
1941f59d88c42b5449ef1353ec4336805bff6ac9Tripp var a=arguments, o=null, i, j, d;
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp for (j=(d[0] == "YAHOO") ? 1 : 0; j<d.length; j=j+1) {
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp o[d[j]] = o[d[j]] || {};
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp o = o[d[j]];
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp // this is replaced if the log module is included
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * Report an error. The reporting mechanism is controled by
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * the 'throwFail' configuration attribute. If throwFail is
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * not specified, the message is written to the Logger, otherwise
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * a JS error is thrown
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * @method error
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * @param msg {string} the error message
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * @param e {Error} Optional JS error that was caught. If supplied
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * and throwFail is specified, this error will be re-thrown.
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * @return {YUI} this YUI instance
16178708ecddc36b034aea99e129ceffa009ac05Tripp return this;
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * Generate an id that is unique among all YUI instances
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * @method guid
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * @param pre {string} optional guid prefix
16178708ecddc36b034aea99e129ceffa009ac05Tripp * @return {string} the guid
16178708ecddc36b034aea99e129ceffa009ac05Tripp * Returns a guid associated with an object. If the object
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * does not have one, a new one is created unless readOnly
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * is specified.
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * @method stamp
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * @param o The object to stamp
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * @param readOnly {boolean} if true, a valid guid will only
c8497af565e3869417da55c16f0afc9fafb7d79aTripp * be returned if the object has one assigned to it.
c8497af565e3869417da55c16f0afc9fafb7d79aTripp * @return {string} The object's guid or null
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp } catch(e) {
16178708ecddc36b034aea99e129ceffa009ac05Tripp// Give the YUI global the same properties as an instance.
16178708ecddc36b034aea99e129ceffa009ac05Tripp// This makes it so that the YUI global can be used like the YAHOO
16178708ecddc36b034aea99e129ceffa009ac05Tripp// global was used prior to 3.x. More importantly, the YUI global
16178708ecddc36b034aea99e129ceffa009ac05Tripp// provides global metadata, so env needs to be configured.
16178708ecddc36b034aea99e129ceffa009ac05Tripp// @TODO review
16178708ecddc36b034aea99e129ceffa009ac05Tripp // inheritance utilities are not available yet
16178708ecddc36b034aea99e129ceffa009ac05Tripp for (i in p) {
16178708ecddc36b034aea99e129ceffa009ac05Tripp if (1) { // intenionally ignoring hasOwnProperty check
16178708ecddc36b034aea99e129ceffa009ac05Tripp YUI[i] = p[i];
16178708ecddc36b034aea99e129ceffa009ac05Tripp // set up the environment
16178708ecddc36b034aea99e129ceffa009ac05Tripp // setTimeout(function() { YUI._attach(['yui-base']); }, 0);
16178708ecddc36b034aea99e129ceffa009ac05Tripp // add a window load event at load time so we can capture
16178708ecddc36b034aea99e129ceffa009ac05Tripp // the case where it fires before dynamic loading is
16178708ecddc36b034aea99e129ceffa009ac05Tripp // complete.
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp /*global exports*/
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp // Support the CommonJS method for exporting our single global
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * The config object contains all of the configuration options for
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * the YUI instance. This object is supplied by the implementer
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * when instantiating a YUI instance. Some properties have default
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * values if they are not supplied by the implementer.
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * @class config
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * Allows the YUI seed file to fetch the loader component and library
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * metadata to dynamically load additional dependencies.
82d0cf8c731b23f6a2fbb31e3e696e629444363eTripp * @property bootstrap
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * @type boolean
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * @default true
* A hash of log sources that should be logged. If specified, only log messages from these sources will be logged.
* A hash of log sources that should be not be logged. If specified, all sources are logged if not on this list.
* If throwFail is set, Y.fail will generate or re-throw a JS Error. Otherwise the failure is logged.
* The YUI combo service base dir. Ex: http://yui.yahooapis.com/combo?
* minified version of the files (e.g., event-min.js). The filter property
* <dd>Selects the debug versions of the library (e.g., event-debug.js).
* <dd>Selects the non-minified version of the library (e.g., event.js).</dd>
* 'replaceStr': "-debug.js"
* fullpath: 'http://myserver.mydomain.com/mymod1/mymod1.js'
* fullpath: 'http://myserver.mydomain.com/mymod2/mymod2.js'
* base: 'http://yui.yahooapis.com/2.8.0r4/build/',
* comboBase: 'http://yui.yahooapis.com/combo?',
* path: "yahoo-dom-event/yahoo-dom-event.js"
* path: "animation/animation.js",
* @default loader/loader-min.js
* This includes the script loading mechanism, a simple queue, and the core utilities for the library.
var L = Y.Lang,
TYPES = {
TRIMREGEX = /^\s+|\s+$/g,
L.isArray = function(o) {
L.isBoolean = function(o) {
return typeof o === BOOLEAN;
L.isFunction = function(o) {
L.isDate = function(o) {
L.isNull = function(o) {
L.isNumber = function(o) {
L.isString = function(o) {
return typeof o === STRING;
L.isUndefined = function(o) {
return typeof o === UNDEFINED;
L.trim = function(s){
L.isValue = function(o) {
var t = L.type(o);
case NUMBER:
return isFinite(o);
case NULL:
case UNDEFINED:
L.type = function (o) {
* This includes the script loading mechanism, a simple queue, and the core utilities for the library.
l = o.length;
Y.Array = YArray;
if (L.isObject(o)) {
if (L.isArray(o)) {
// indexed, but no tagName (element) or alert (window), or functions without apply/call (Safari HTMLElementCollection bug)
f.call(o || Y, a[i], i, a);
function(a, val) {
function(a, val) {
if (a[i] === val) {
var l = a.length, i;
if (f.call(o, a[i], i, a)) {
* This includes the script loading mechanism, a simple queue, and the core utilities for the library.
function Queue() {
this._init();
_init: function () {
this._q = [];
next: function () {
last: function () {
add: function () {
size: function () {
* This includes the script loading mechanism, a simple queue, and the core utilities for the library.
var L = Y.Lang,
_iefix = function(r, s) {
Y.merge = function() {
Y.mix(o, a[i], true);
* @param merge {boolean} merge objects instead of overwriting/ignoring
if (mode) {
switch (mode) {
p = wl[i];
if (s.hasOwnProperty(p)) {
Y.mix(r[p], s[p]);
} else if (arr) {
r.push(s[p]);
if (s.hasOwnProperty(i)) {
} else if (arr) {
r.push(s[i]);
_iefix(r, s);
return cache[k];
* This includes the script loading mechanism, a simple queue, and the core utilities for the library.
F.prototype = o;
owns = function(o, k) {
if (owns(o, i)) {
if (count) {
out++;
return out;
O.keys = function(o) {
return _extract(o);
O.values = function(o) {
O.size = function(o) {
O.hasValue = function(o, v) {
f.call(s, o[i], i, o);
if (f.call(s, o[i], i, o)) {
return UNDEFINED;
p = Y.Array(path),
l = p.length;
p = Y.Array(path),
ref = o;
return UNDEFINED;
* This includes the script loading mechanism, a simple queue, and the core utilities for the library.
Y.UA = function() {
var numberify = function(s) {
* http://en.wikipedia.org/wiki/Safari_(web_browser)#Version_history
mobile: null,
secure: false,
os: null
if (ua) {