Mixin: AutoAttributeReader

domjscomp. AutoAttributeReader

Mixin adds methods that can be used for web components to set properties from attribute It also adds domjscomp.AttributeHolder mixin

Methods


<protected> _initPropertiesFromAttributes(attributes)

Set properties based on attributes. Property name is created by changing '-' in attribute name to upper case letter. Firstly it check if public property exists and sets it, if not the prefixes property with '_' and checks private property.
Parameters:
Name Type Description
attributes NamedNodeMap attributes from dom

<protected> _setPropertyFromAttribute(name, value)

Set property based on attribute name. Property name is created by changing '-' in attribute name to upper case letter. Firstly it check if public property exists and sets it, if not the prefixes property with '_' and checks private property.
Parameters:
Name Type Description
name string name of attribute
value * attribute value
Example
Attribute: my-great-attribute
Property: myGreatAttribute
Private property: _myGreatAttribute