Coral.property is a set of property descriptor factories used by Coral components.

Coral.property API

Property descriptor factory factories

Methods

Coral.property.contentZone

A factory that creates descriptor factories for content zones.
Parameters:
Name Type Description
descriptor Coral~PropertyDescriptor

The property descriptor.

Name Type Optional Description
descriptor.handle String No
The handle of the element to proxy the attribute to.
descriptor.tagName String Yes
The tag name to expect. If not provided, any tag will be accepted.
descriptor.set function Yes
Executed after the property is set.
descriptor.get function Yes
An alternate getter. If not provided, the element specified by the handle will be returned.
descriptor.insert function Yes
The method that inserts the content zone into the element.
defaultContentZone Booelean Set to true if this is the default content zone that Coral.Component#render moves orphaned elements into.

Coral.property.proxy

A factory that creates descriptor factories that proxy a local property/attribute to a sub-property. This factory should be used when you need the property of an sub-object to be set or queued for sync when a local property changes. This is especially useful for setting the innerHTML or other properties of sub-elements.
Parameters:
Name Type Optional Default Description
descriptor Coral~PropertyDescriptor No
The property descriptor
path String No
The path under this to proxy to. For instance, _elements.header.innerHTML would proxy to the innerHTML of the element with the handle header
needsDOMSync Boolean Yes
Whether the property set should happen asynchronously on the next animation frame.
Returns:
The descriptor factory. {function}

Coral.property.proxyAttr

A factory that creates descriptor factories that proxy a local property/attribute to a sub-element's attribute. This is useful when you want to proxy a property/attrubute to a sub-element as an attribute set/removal. For instance, you may want to proxy the aria-labelledby property of a field component to the actual input inside of the component for accessibility purposes. When using this property factory, be sure to specify a property name not implemented by the browser already.
Parameters:
Name Type Description
descriptor Coral~PropertyDescriptor

The property descriptor.

Name Type Description
descriptor.attribute String The attribute to proxy.
descriptor.handle String The handle of the element to proxy the attribute to.