# Yahoo! UI Library

### element 2.3.1

Yahoo! UI Library > element > YAHOO.util.Attribute

Show Private Show Protected

## Class YAHOO.util.Attribute

Provides Attribute configurations.

### Constructor

YAHOO.util.Attribute `( hash , The )`

Parameters:
  `hash <Object>` The intial Attribute.
  `The <YAHOO.util.AttributeProvider>` owner of the Attribute instance.

### Properties

#### _initialConfig `- private Object`

The attribute's initial configuration.

#### _written `- private Boolean`

Whether or not the attribute's value has been set.

#### method `- Function`

The method to use when setting the attribute's value. The method recieves the new value as the only argument.

#### name `- String`

The name of the attribute.

#### owner `- YAHOO.util.AttributeProvider`

The owner of the attribute.

#### readOnly `- Boolean`

Whether or not the attribute is read only.

#### validator `- Function`

The validator to use when setting the attribute's value.

#### value `- String`

The value of the attribute.

#### writeOnce `- Boolean`

Whether or not the attribute can only be written once.

### Methods

#### configure

`void configure ( map , init )`
Allows for configuring the Attribute's properties.

Parameters:
  `map <Object>` A key-value map of Attribute properties.
  `init <Boolean>` Whether or not this should become the initial config.

Returns: `void`

#### getValue

`any getValue ( )`
Retrieves the current value of the attribute.

Returns: `any`
  The current value of the attribute.

#### refresh

`Boolean refresh ( )`
Resets the value to the current value. Useful when values may have gotten out of sync with actual properties.

Returns: `Boolean`
  Whether or not the value was set.

#### resetConfig

`void resetConfig ( )`
Resets the attribute config to the initial config state.

Returns: `void`

#### resetValue

`Boolean resetValue ( )`
Resets the value to the initial config value.

Returns: `Boolean`
  Whether or not the value was set.

#### setValue

`Boolean setValue ( value , silent )`
Sets the value of the attribute and fires beforeChange and change events.

Parameters:
  `value <Any>` The value to apply to the attribute.
  `silent <Boolean>` If true the change events will not be fired.

Returns: `Boolean`
  Whether or not the value was set.

Copyright © 2007 Yahoo! Inc. All rights reserved.