Construct a new Actribute instance with the fallback props and attribute prefix.
When it is used to process markup, attributes with names starting with attrPrefix are assumed to be component specifiers. A component specifier is of the form [attrPrefix][componentName]="[propertyName] [propertyName] ..."
When a component specifier is encountered, the component's function will be invoked with the element and any specified properties as arguments.
The attribute can be string (where at least 1 property name is specified), or boolean (where no property is specified).
The props object passed to this initializer behaves like a global
from which component props may be obtained if they are not found in
the props object passed to the process
method.
The value to assign to the props member.
The value to assign to attrPrefix. Defaults to 'c-'
This is the attribute prefix that denotes component specifiers in markup. A component specifier is an attribute where the name (after the prefix) refers to a component name (in the registery) and the optional value is a space-separated list of property names.
This object holds any fallback props which can be referenced in the markup, in the values of component attributes. Property names can be referenced similarly to CSS classes.
The object that holds all registered components. The keys are the component names and the values are the component functions.
Recursively processes the node to identify and apply components.
At elements where any components are encountered, the components are called with the element and any specified props. The decendants are not processed.
At elements without a component, the descendants are processed recursively.
Returns the same actribute to support call chaining.
Registers a function as a component bearing the given name. The component can be referenced in processed markup using the name.
Returns the same actribute to support chaining.
The component name
The component function
This module has been designed to be a drop-in replacement for extending built-in elements. It is supposed to be
The attributes here name the components and the values are the names of props to pass to them along with the element.
Example