src/cm/media/js/lib/yui/yui_3.10.3/build/base-base/base-base-debug.js
changeset 525 89ef5ed3c48b
equal deleted inserted replaced
524:322d0feea350 525:89ef5ed3c48b
       
     1 /*
       
     2 YUI 3.10.3 (build 2fb5187)
       
     3 Copyright 2013 Yahoo! Inc. All rights reserved.
       
     4 Licensed under the BSD License.
       
     5 http://yuilibrary.com/license/
       
     6 */
       
     7 
       
     8 YUI.add('base-base', function (Y, NAME) {
       
     9 
       
    10     /**
       
    11      * The base module provides the Base class, which objects requiring attribute and custom event support can extend.
       
    12      * The module also provides two ways to reuse code - It augments Base with the Plugin.Host interface which provides
       
    13      * plugin support and also provides the BaseCore.build method which provides a way to build custom classes using extensions.
       
    14      *
       
    15      * @module base
       
    16      */
       
    17 
       
    18     /**
       
    19      * The base-base submodule provides the Base class without the Plugin support, provided by Plugin.Host,
       
    20      * and without the extension support provided by BaseCore.build.
       
    21      *
       
    22      * @module base
       
    23      * @submodule base-base
       
    24      */
       
    25 
       
    26     var AttributeCore   = Y.AttributeCore,
       
    27         AttributeExtras = Y.AttributeExtras,
       
    28         BaseCore        = Y.BaseCore,
       
    29         BaseObservable  = Y.BaseObservable;
       
    30 
       
    31     /**
       
    32      * <p>
       
    33      * A base class which objects requiring attributes and custom event support can
       
    34      * extend. Base also handles the chaining of initializer and destructor methods across
       
    35      * the hierarchy as part of object construction and destruction. Additionally, attributes configured
       
    36      * through the static <a href="#property_ATTRS">ATTRS</a> property for each class
       
    37      * in the hierarchy will be initialized by Base.
       
    38      * </p>
       
    39      *
       
    40      * <p>
       
    41      * The static <a href="#property_NAME">NAME</a> property of each class extending
       
    42      * from Base will be used as the identifier for the class, and is used by Base to prefix
       
    43      * all events fired by instances of that class.
       
    44      * </p>
       
    45      *
       
    46      * @class Base
       
    47      * @constructor
       
    48      * @uses BaseCore
       
    49      * @uses BaseObservable
       
    50      * @uses AttributeCore
       
    51      * @uses AttributeObservable
       
    52      * @uses AttributeExtras
       
    53      * @uses EventTarget
       
    54      *
       
    55      * @param {Object} config Object with configuration property name/value pairs. The object can be
       
    56      * used to provide default values for the objects published attributes.
       
    57      *
       
    58      * <p>
       
    59      * The config object can also contain the following non-attribute properties, providing a convenient
       
    60      * way to configure events listeners and plugins for the instance, as part of the constructor call:
       
    61      * </p>
       
    62      *
       
    63      * <dl>
       
    64      *   <dt>on</dt>
       
    65      *   <dd>An event name to listener function map, to register event listeners for the "on" moment of the event.
       
    66      *       A constructor convenience property for the <a href="Base.html#method_on">on</a> method.</dd>
       
    67      *   <dt>after</dt>
       
    68      *   <dd>An event name to listener function map, to register event listeners for the "after" moment of the event.
       
    69      *       A constructor convenience property for the <a href="Base.html#method_after">after</a> method.</dd>
       
    70      *   <dt>bubbleTargets</dt>
       
    71      *   <dd>An object, or array of objects, to register as bubble targets for bubbled events fired by this instance.
       
    72      *       A constructor convenience property for the <a href="EventTarget.html#method_addTarget">addTarget</a> method.</dd>
       
    73      *   <dt>plugins</dt>
       
    74      *   <dd>A plugin, or array of plugins to be plugged into the instance (see PluginHost's plug method for signature details).
       
    75      *       A constructor convenience property for the <a href="Plugin.Host.html#method_plug">plug</a> method.</dd>
       
    76      * </dl>
       
    77      */
       
    78     function Base() {
       
    79         BaseCore.apply(this, arguments);
       
    80         BaseObservable.apply(this, arguments);
       
    81         AttributeExtras.apply(this, arguments);
       
    82     }
       
    83 
       
    84     /**
       
    85      * The list of properties which can be configured for
       
    86      * each attribute (e.g. setter, getter, writeOnce, readOnly etc.)
       
    87      *
       
    88      * @property _ATTR_CFG
       
    89      * @type Array
       
    90      * @static
       
    91      * @private
       
    92      */
       
    93     Base._ATTR_CFG = BaseCore._ATTR_CFG.concat(BaseObservable._ATTR_CFG);
       
    94 
       
    95     /**
       
    96      * The array of non-attribute configuration properties supported by this class.
       
    97      *
       
    98      * `Base` supports "on", "after", "plugins" and "bubbleTargets" properties,
       
    99      * which are not set up as attributes.
       
   100      *
       
   101      * This property is primarily required so that when
       
   102      * <a href="#property__allowAdHocAttrs">`_allowAdHocAttrs`</a> is enabled by
       
   103      * a class, non-attribute configurations don't get added as ad-hoc attributes.
       
   104      *
       
   105      * @property _NON_ATTRS_CFG
       
   106      * @type Array
       
   107      * @static
       
   108      * @private
       
   109      */
       
   110     Base._NON_ATTRS_CFG = BaseCore._NON_ATTRS_CFG.concat(BaseObservable._NON_ATTRS_CFG);
       
   111 
       
   112     /**
       
   113      * <p>
       
   114      * The string to be used to identify instances of
       
   115      * this class, for example in prefixing events.
       
   116      * </p>
       
   117      * <p>
       
   118      * Classes extending Base, should define their own
       
   119      * static NAME property, which should be camelCase by
       
   120      * convention (e.g. MyClass.NAME = "myClass";).
       
   121      * </p>
       
   122      * @property NAME
       
   123      * @type String
       
   124      * @static
       
   125      */
       
   126     Base.NAME = 'base';
       
   127 
       
   128     /**
       
   129      * The default set of attributes which will be available for instances of this class, and
       
   130      * their configuration. In addition to the configuration properties listed by
       
   131      * Attribute's <a href="Attribute.html#method_addAttr">addAttr</a> method, the attribute
       
   132      * can also be configured with a "cloneDefaultValue" property, which defines how the statically
       
   133      * defined value field should be protected ("shallow", "deep" and false are supported values).
       
   134      *
       
   135      * By default if the value is an object literal or an array it will be "shallow" cloned, to
       
   136      * protect the default value.
       
   137      *
       
   138      * @property ATTRS
       
   139      * @type Object
       
   140      * @static
       
   141      */
       
   142     Base.ATTRS = AttributeCore.protectAttrs(BaseCore.ATTRS);
       
   143 
       
   144     /**
       
   145     Provides a way to safely modify a `Y.Base` subclass' static `ATTRS` after
       
   146     the class has been defined or created.
       
   147 
       
   148     Base-based classes cache information about the class hierarchy in order to
       
   149     efficiently create instances. This cache includes includes the aggregated
       
   150     `ATTRS` configs. If the static `ATTRS` configs need to be modified after the
       
   151     class has been defined or create, then use this method which will make sure
       
   152     to clear any cached data before making any modifications.
       
   153 
       
   154     @method modifyAttrs
       
   155     @param {Function} [ctor] The constructor function whose `ATTRS` should be
       
   156         modified. If a `ctor` function is not specified, then `this` is assumed
       
   157         to be the constructor which hosts the `ATTRS`.
       
   158     @param {Object} configs The collection of `ATTRS` configs to mix with the
       
   159         existing attribute configurations.
       
   160     @static
       
   161     @since 3.10.0
       
   162     **/
       
   163     Base.modifyAttrs = BaseCore.modifyAttrs;
       
   164 
       
   165     Y.mix(Base, BaseCore, false, null, 1);
       
   166     Y.mix(Base, AttributeExtras, false, null, 1);
       
   167 
       
   168     // Needs to be `true`, to overwrite methods from `BaseCore`.
       
   169     Y.mix(Base, BaseObservable, true, null, 1);
       
   170 
       
   171     // Fix constructor
       
   172     Base.prototype.constructor = Base;
       
   173 
       
   174     Y.Base = Base;
       
   175 
       
   176 
       
   177 }, '3.10.3', {"requires": ["attribute-base", "base-core", "base-observable"]});