base-base.js revision fda0ebbfc3632b3acc0eed183cc58255439e9e02
028737d2b3d0c359e3c0753da9a2541462402167Timo Sirainen * The base module provides the Base class, which objects requiring attribute and custom event support can extend.
028737d2b3d0c359e3c0753da9a2541462402167Timo Sirainen * The module also provides two ways to reuse code - It augments Base with the Plugin.Host interface which provides
028737d2b3d0c359e3c0753da9a2541462402167Timo Sirainen * plugin support and also provides the Base.build method which provides a way to build custom classes using extensions.
028737d2b3d0c359e3c0753da9a2541462402167Timo Sirainen * @module base
028737d2b3d0c359e3c0753da9a2541462402167Timo Sirainen * The base-base submodule provides the Base class without the Plugin support, provided by Plugin.Host,
028737d2b3d0c359e3c0753da9a2541462402167Timo Sirainen * and without the extension support provided by Base.build.
fa2f897114ac23879fe36a6a9a449d3105f9b254Timo Sirainen * @module base
028737d2b3d0c359e3c0753da9a2541462402167Timo Sirainen * @submodule base-base
028737d2b3d0c359e3c0753da9a2541462402167Timo Sirainen var O = Y.Object,
558d19d2111b67a236ee5e8f3eb22aba4a294032Timo Sirainen OBJECT_CONSTRUCTOR = Object.prototype.constructor,
if(wlhash[p]) {
* <dd>An event name to listener function map, to register event listeners for the "on" moment of the event. A constructor convenience property for the <a href="Base.html#method_on">on</a> method.</dd>
* <dd>An event name to listener function map, to register event listeners for the "after" moment of the event. A constructor convenience property for the <a href="Base.html#method_after">after</a> method.</dd>
* <dd>An object, or array of objects, to register as bubble targets for bubbled events fired by this instance. A constructor convenience property for the <a href="EventTarget.html#method_addTarget">addTarget</a> method.</dd>
* <dd>A plugin, or array of plugins to be plugged into the instance (see PluginHost's plug method for signature details). A constructor convenience property for the <a href="Plugin.Host.html#method_plug">plug</a> method.</dd>
function Base() {
if (!this._BaseInvoked) {
this._BaseInvoked = true;
Y.stamp(this);
* Attribute's <a href="Attribute.html#method_addAttr">addAttr</a> method, the attribute
initialized: {
readOnly:true,
value:false
destroyed: {
readOnly:true,
value:false
queuable:false,
fireOnce:true,
defaultTargetOnly:true,
if (config) {
var i, l, target,
} else if (target) {
destroy: function() {
queuable:false,
fireOnce:true,
defaultTargetOnly:true,
this.detachAll();
_defInitFn : function(e) {
if (this._initPlugins) {
_defDestroyFn : function(e) {
if (this._destroyPlugins) {
this._destroyPlugins();
this._destroyHierarchy();
* @return {Function[]} An array of classes (constructor functions), making up the class hierarchy for this object.
* This value is cached the first time the method, or _getAttrCfgs, is invoked. Subsequent invocations return the
_getClasses : function() {
if (!this._classes) {
this._initHierarchyData();
return this._classes;
* This value is cached the first time the method, or _getClasses, is invoked. Subsequent invocations return
_getAttrCfgs : function() {
if (!this._attrs) {
this._initHierarchyData();
return this._attrs;
* of an object with attribute name/configuration pairs.
if (attrs) {
return cfgs;
_initHierarchyData : function() {
var c = this.constructor,
classes = [],
attrs = [];
if (c.ATTRS) {
var attr,
cfg,
val,
path,
aggAttrs = {};
if (allAttrs) {
if (val) {
if ( (clone === undefined && (OBJECT_CONSTRUCTOR === val.constructor || L.isArray(val))) || clone === DEEP || clone === true) {
path = null;
} else if (!path) {
return aggAttrs;
ci,
ei,
el,
exts,
if (exts) {
// Using INITIALIZER in hasOwnProperty check, for performance reasons (helps IE6 avoid GC thresholds when
if (exts) {
_destroyHierarchy : function() {
var constr,
if (exts) {
toString: function() {