Upgraded the YUI libs to version 0.12.0, released 14 Nov 2006.

This commit is contained in:
vyshane 2006-11-23 03:10:20 +00:00
parent 6418486c69
commit d38ed4fba2
79 changed files with 45819 additions and 28246 deletions

View file

@ -1,10 +1,37 @@
YAHOO Global Namespace - Release Notes
0.12.0
* Added YAHOO.augment, which copies all or part of the prototype of one
object to another.
* YAHOO.namespace now can create multiple namespaces.
* Added an optional third parameter to YAHOO.extend: overrides. It takes
an object literal of properties/methods to apply to the subclass
prototype, overriding the superclass if present.
0.11.4
* Changed window.YAHOO = window.YAHOO || {} to
if (typeof YAHOO == "undefined") YAHOO = {} because the previous statement
contributed to a memory leak in IE6 when the library was hosted in an
iframe.
0.11.3
* Changed var YAHOO = window.YAHOO || {} to window.YAHOO = window.YAHOO || {}.
This fixes an issue in IE where YAHOO would get overwritten if previously
defined via array notation (window["YAHOO"]).
0.11.0
* Added YAHOO.extend, which provides an easy way to assign the prototype,
constructor, and superclass properties inheritance properties. It also
prevents the constructor of the superclass from being exectuted twice.
0.10.0
* Added YAHOO.log that provides a safe way to plumb logging statements in
code that will work if the logging component isn't available.

View file

@ -1,61 +1,81 @@
/*
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 0.11.0
*/
/*
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 0.12.0
*/
/**
* The Yahoo global namespace
* @constructor
* The YAHOO object is the single global object used by YUI Library. It
* contains utility function for setting up namespaces, inheritance, and
* logging. YAHOO.util, YAHOO.widget, and YAHOO.example are namespaces
* created automatically for and used by the library.
* @module yahoo
* @title YAHOO Global
*/
var YAHOO = window.YAHOO || {};
/**
* The YAHOO global namespace object
* @class YAHOO
* @static
*/
if (typeof YAHOO == "undefined") {
var YAHOO = {};
}
/**
* Returns the namespace specified and creates it if it doesn't exist
*
* <pre>
* YAHOO.namespace("property.package");
* YAHOO.namespace("YAHOO.property.package");
*
* </pre>
* Either of the above would create YAHOO.property, then
* YAHOO.property.package
*
* @param {String} ns The name of the namespace
* @return {Object} A reference to the namespace object
* Be careful when naming packages. Reserved words may work in some browsers
* and not others. For instance, the following will fail in Safari:
* <pre>
* YAHOO.namespace("really.long.nested.namespace");
* </pre>
* This fails because "long" is a future reserved word in ECMAScript
*
* @method namespace
* @static
* @param {String*} arguments 1-n namespaces to create
* @return {Object} A reference to the last namespace object created
*/
YAHOO.namespace = function(ns) {
YAHOO.namespace = function() {
var a=arguments, o=null, i, j, d;
for (i=0; i<a.length; ++i) {
d=a[i].split(".");
o=YAHOO;
if (!ns || !ns.length) {
return null;
// YAHOO is implied, so it is ignored if it is included
for (j=(d[0] == "YAHOO") ? 1 : 0; j<d.length; ++j) {
o[d[j]]=o[d[j]] || {};
o=o[d[j]];
}
}
var levels = ns.split(".");
var nsobj = YAHOO;
// YAHOO is implied, so it is ignored if it is included
for (var i=(levels[0] == "YAHOO") ? 1 : 0; i<levels.length; ++i) {
nsobj[levels[i]] = nsobj[levels[i]] || {};
nsobj = nsobj[levels[i]];
}
return nsobj;
return o;
};
/**
* Uses YAHOO.widget.Logger to output a log message, if the widget is available.
*
* @param {string} sMsg The message to log.
* @param {string} sCategory The log category for the message. Default
* categories are "info", "warn", "error", time".
* Custom categories can be used as well. (opt)
* @param {string} sSource The source of the the message (opt)
* @return {boolean} True if the log operation was successful.
* @method log
* @static
* @param {String} msg The message to log.
* @param {String} cat The log category for the message. Default
* categories are "info", "warn", "error", time".
* Custom categories can be used as well. (opt)
* @param {String} src The source of the the message (opt)
* @return {Boolean} True if the log operation was successful.
*/
YAHOO.log = function(sMsg, sCategory, sSource) {
var l = YAHOO.widget.Logger;
YAHOO.log = function(msg, cat, src) {
var l=YAHOO.widget.Logger;
if(l && l.log) {
return l.log(sMsg, sCategory, sSource);
return l.log(msg, cat, src);
} else {
return false;
}
@ -65,21 +85,61 @@ YAHOO.log = function(sMsg, sCategory, sSource) {
* Utility to set up the prototype, constructor and superclass properties to
* support an inheritance strategy that can chain constructors and methods.
*
* @param {Function} subclass the object to modify
* @param {Function} superclass the object to inherit
* @method extend
* @static
* @param {Function} subc the object to modify
* @param {Function} superc the object to inherit
* @param {String[]} overrides additional properties/methods to add to the
* subclass prototype. These will override the
* matching items obtained from the superclass
* if present.
*/
YAHOO.extend = function(subclass, superclass) {
var f = function() {};
f.prototype = superclass.prototype;
subclass.prototype = new f();
subclass.prototype.constructor = subclass;
subclass.superclass = superclass.prototype;
if (superclass.prototype.constructor == Object.prototype.constructor) {
superclass.prototype.constructor = superclass;
YAHOO.extend = function(subc, superc, overrides) {
var F = function() {};
F.prototype=superc.prototype;
subc.prototype=new F();
subc.prototype.constructor=subc;
subc.superclass=superc.prototype;
if (superc.prototype.constructor == Object.prototype.constructor) {
superc.prototype.constructor=superc;
}
if (overrides) {
for (var i in overrides) {
subc.prototype[i]=overrides[i];
}
}
};
YAHOO.namespace("util");
YAHOO.namespace("widget");
YAHOO.namespace("example");
/**
* Applies all prototype properties in the supplier to the receiver if the
* receiver does not have these properties yet. Optionally, one or more
* methods/properties can be specified (as additional parameters). This
* option will overwrite the property if receiver has it already.
*
* @method augment
* @static
* @param {Function} r the object to receive the augmentation
* @param {Function} s the object that supplies the properties to augment
* @param {String*} arguments zero or more properties methods to augment the
* receiver with. If none specified, everything
* in the supplier will be used unless it would
* overwrite an existing property in the receiver
*/
YAHOO.augment = function(r, s) {
var rp=r.prototype, sp=s.prototype, a=arguments, i, p;
if (a[2]) {
for (i=2; i<a.length; ++i) {
rp[a[i]] = sp[a[i]];
}
} else {
for (p in sp) {
if (!rp[p]) {
rp[p] = sp[p];
}
}
}
};
YAHOO.namespace("util", "widget", "example");

View file

@ -1 +1 @@
/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 0.11.0 */ var YAHOO=window.YAHOO||{};YAHOO.namespace=function(ns){if(!ns||!ns.length){return null;}var _2=ns.split(".");var _3=YAHOO;for(var i=(_2[0]=="YAHOO")?1:0;i<_2.length;++i){_3[_2[i]]=_3[_2[i]]||{};_3=_3[_2[i]];}return _3;};YAHOO.log=function(_5,_6,_7){var l=YAHOO.widget.Logger;if(l&&l.log){return l.log(_5,_6,_7);}else{return false;}};YAHOO.extend=function(_9,_10){var f=function(){};f.prototype=_10.prototype;_9.prototype=new f();_9.prototype.constructor=_9;_9.superclass=_10.prototype;if(_10.prototype.constructor==Object.prototype.constructor){_10.prototype.constructor=_10;}};YAHOO.namespace("util");YAHOO.namespace("widget");YAHOO.namespace("example");
/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.Code licensed under the BSD License:http://developer.yahoo.net/yui/license.txt version: 0.12.0 */ if(typeof YAHOO=="undefined"){var YAHOO={};}YAHOO.namespace=function(){var a=arguments,o=null,i,j,d;for(i=0;i<a.length;++i){d=a[i].split(".");o=YAHOO;for(j=(d[0]=="YAHOO")?1:0;j<d.length;++j){o[d[j]]=o[d[j]]||{};o=o[d[j]];}}return o;};YAHOO.log=function(_2,_3,_4){var l=YAHOO.widget.Logger;if(l&&l.log){return l.log(_2,_3,_4);}else{return false;}};YAHOO.extend=function(_6,_7,_8){var F=function(){};F.prototype=_7.prototype;_6.prototype=new F();_6.prototype.constructor=_6;_6.superclass=_7.prototype;if(_7.prototype.constructor==Object.prototype.constructor){_7.prototype.constructor=_7;}if(_8){for(var i in _8){_6.prototype[i]=_8[i];}}};YAHOO.augment=function(r,s){var rp=r.prototype,sp=s.prototype,a=arguments,i,p;if(a[2]){for(i=2;i<a.length;++i){rp[a[i]]=sp[a[i]];}}else{for(p in sp){if(!rp[p]){rp[p]=sp[p];}}}};YAHOO.namespace("util","widget","example");

153
lib/yui/yahoo/yahoo.js vendored
View file

@ -1,60 +1,81 @@
/*
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 0.11.0
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 0.12.0
*/
/**
* The Yahoo global namespace
* @constructor
* The YAHOO object is the single global object used by YUI Library. It
* contains utility function for setting up namespaces, inheritance, and
* logging. YAHOO.util, YAHOO.widget, and YAHOO.example are namespaces
* created automatically for and used by the library.
* @module yahoo
* @title YAHOO Global
*/
var YAHOO = window.YAHOO || {};
/**
* The YAHOO global namespace object
* @class YAHOO
* @static
*/
if (typeof YAHOO == "undefined") {
var YAHOO = {};
}
/**
* Returns the namespace specified and creates it if it doesn't exist
*
* <pre>
* YAHOO.namespace("property.package");
* YAHOO.namespace("YAHOO.property.package");
*
* </pre>
* Either of the above would create YAHOO.property, then
* YAHOO.property.package
*
* @param {String} ns The name of the namespace
* @return {Object} A reference to the namespace object
* Be careful when naming packages. Reserved words may work in some browsers
* and not others. For instance, the following will fail in Safari:
* <pre>
* YAHOO.namespace("really.long.nested.namespace");
* </pre>
* This fails because "long" is a future reserved word in ECMAScript
*
* @method namespace
* @static
* @param {String*} arguments 1-n namespaces to create
* @return {Object} A reference to the last namespace object created
*/
YAHOO.namespace = function(ns) {
YAHOO.namespace = function() {
var a=arguments, o=null, i, j, d;
for (i=0; i<a.length; ++i) {
d=a[i].split(".");
o=YAHOO;
if (!ns || !ns.length) {
return null;
// YAHOO is implied, so it is ignored if it is included
for (j=(d[0] == "YAHOO") ? 1 : 0; j<d.length; ++j) {
o[d[j]]=o[d[j]] || {};
o=o[d[j]];
}
}
var levels = ns.split(".");
var nsobj = YAHOO;
// YAHOO is implied, so it is ignored if it is included
for (var i=(levels[0] == "YAHOO") ? 1 : 0; i<levels.length; ++i) {
nsobj[levels[i]] = nsobj[levels[i]] || {};
nsobj = nsobj[levels[i]];
}
return nsobj;
return o;
};
/**
* Uses YAHOO.widget.Logger to output a log message, if the widget is available.
*
* @param {string} sMsg The message to log.
* @param {string} sCategory The log category for the message. Default
* categories are "info", "warn", "error", time".
* Custom categories can be used as well. (opt)
* @param {string} sSource The source of the the message (opt)
* @return {boolean} True if the log operation was successful.
* @method log
* @static
* @param {String} msg The message to log.
* @param {String} cat The log category for the message. Default
* categories are "info", "warn", "error", time".
* Custom categories can be used as well. (opt)
* @param {String} src The source of the the message (opt)
* @return {Boolean} True if the log operation was successful.
*/
YAHOO.log = function(sMsg, sCategory, sSource) {
var l = YAHOO.widget.Logger;
YAHOO.log = function(msg, cat, src) {
var l=YAHOO.widget.Logger;
if(l && l.log) {
return l.log(sMsg, sCategory, sSource);
return l.log(msg, cat, src);
} else {
return false;
}
@ -64,21 +85,61 @@ YAHOO.log = function(sMsg, sCategory, sSource) {
* Utility to set up the prototype, constructor and superclass properties to
* support an inheritance strategy that can chain constructors and methods.
*
* @param {Function} subclass the object to modify
* @param {Function} superclass the object to inherit
* @method extend
* @static
* @param {Function} subc the object to modify
* @param {Function} superc the object to inherit
* @param {String[]} overrides additional properties/methods to add to the
* subclass prototype. These will override the
* matching items obtained from the superclass
* if present.
*/
YAHOO.extend = function(subclass, superclass) {
var f = function() {};
f.prototype = superclass.prototype;
subclass.prototype = new f();
subclass.prototype.constructor = subclass;
subclass.superclass = superclass.prototype;
if (superclass.prototype.constructor == Object.prototype.constructor) {
superclass.prototype.constructor = superclass;
YAHOO.extend = function(subc, superc, overrides) {
var F = function() {};
F.prototype=superc.prototype;
subc.prototype=new F();
subc.prototype.constructor=subc;
subc.superclass=superc.prototype;
if (superc.prototype.constructor == Object.prototype.constructor) {
superc.prototype.constructor=superc;
}
if (overrides) {
for (var i in overrides) {
subc.prototype[i]=overrides[i];
}
}
};
YAHOO.namespace("util");
YAHOO.namespace("widget");
YAHOO.namespace("example");
/**
* Applies all prototype properties in the supplier to the receiver if the
* receiver does not have these properties yet. Optionally, one or more
* methods/properties can be specified (as additional parameters). This
* option will overwrite the property if receiver has it already.
*
* @method augment
* @static
* @param {Function} r the object to receive the augmentation
* @param {Function} s the object that supplies the properties to augment
* @param {String*} arguments zero or more properties methods to augment the
* receiver with. If none specified, everything
* in the supplier will be used unless it would
* overwrite an existing property in the receiver
*/
YAHOO.augment = function(r, s) {
var rp=r.prototype, sp=s.prototype, a=arguments, i, p;
if (a[2]) {
for (i=2; i<a.length; ++i) {
rp[a[i]] = sp[a[i]];
}
} else {
for (p in sp) {
if (!rp[p]) {
rp[p] = sp[p];
}
}
}
};
YAHOO.namespace("util", "widget", "example");