/* YUI 3.17.2 (build 9c3c78e) Copyright 2014 Yahoo! Inc. All rights reserved. Licensed under the BSD License. http://yuilibrary.com/license/ */ YUI.add('attribute-base', function (Y, NAME) { /** * The attribute module provides an augmentable Attribute implementation, which * adds configurable attributes and attribute change events to the class being * augmented. It also provides a State class, which is used internally by Attribute, * but can also be used independently to provide a name/property/value data structure to * store state. * * @module attribute */ /** * The attribute-base submodule provides core attribute handling support, with everything * aside from complex attribute handling in the provider's constructor. * * @module attribute * @submodule attribute-base */ /** *
* Attribute provides configurable attribute support along with attribute change events. It is designed to be * augmented on to a host class, and provides the host with the ability to configure attributes to store and retrieve state, * along with attribute change events. *
*For example, attributes added to the host can be configured:
*See the addAttr method, for the complete set of configuration * options available for attributes.
* *NOTE: Most implementations will be better off extending the Base class, * instead of augmenting Attribute directly. Base augments Attribute and will handle the initial configuration * of attributes for derived classes, accounting for values passed into the constructor.
* * @class Attribute * @param attrs {Object} The attributes to add during construction (passed through to addAttrs). * These can also be defined on the constructor being augmented with Attribute by defining the ATTRS property on the constructor. * @param values {Object} The initial attribute values to apply (passed through to addAttrs). * These are not merged/cloned. The caller is responsible for isolating user provided values if required. * @param lazy {boolean} Whether or not to add attributes lazily (passed through to addAttrs). * @uses AttributeCore * @uses AttributeObservable * @uses EventTarget * @uses AttributeExtras */ function Attribute() { Y.AttributeCore.apply(this, arguments); Y.AttributeObservable.apply(this, arguments); Y.AttributeExtras.apply(this, arguments); } Y.mix(Attribute, Y.AttributeCore, false, null, 1); Y.mix(Attribute, Y.AttributeExtras, false, null, 1); // Needs to be `true`, to overwrite methods from AttributeCore Y.mix(Attribute, Y.AttributeObservable, true, null, 1); /** *The value to return from an attribute setter in order to prevent the set from going through.
* *You can return this value from your setter if you wish to combine validator and setter * functionality into a single setter function, which either returns the massaged value to be stored or * AttributeCore.INVALID_VALUE to prevent invalid values from being stored.
* * @property INVALID_VALUE * @type Object * @static * @final */ Attribute.INVALID_VALUE = Y.AttributeCore.INVALID_VALUE; /** * The list of properties which can be configured for * each attribute (e.g. setter, getter, writeOnce etc.). * * This property is used internally as a whitelist for faster * Y.mix operations. * * @property _ATTR_CFG * @type Array * @static * @protected */ Attribute._ATTR_CFG = Y.AttributeCore._ATTR_CFG.concat(Y.AttributeObservable._ATTR_CFG); /** * Utility method to protect an attribute configuration hash, by merging the * entire object and the individual attr config objects. * * @method protectAttrs * @static * @param {Object} attrs A hash of attribute to configuration object pairs. * @return {Object} A protected version of the `attrs` argument. */ Attribute.protectAttrs = Y.AttributeCore.protectAttrs; Y.Attribute = Attribute; }, '3.17.2', {"requires": ["attribute-core", "attribute-observable", "attribute-extras"]});