require(["delite/register"], function (register) {
register(tag, superclasses, props) → {function};
});
Declare a widget and register it as a custom element.
props{} can provide custom setters/getters for widget properties, which are called automatically when the widget properties are set. For a property XXX, define methods _setXXXAttr() and/or _getXXXAttr().
Parameters:
Name | Type | Description |
---|---|---|
tag |
string | The custom element's tag name. |
superclasses |
Array.<Object> | Any number of superclasses to be built into the custom element constructor. But first one must be [descendant] of HTMLElement. |
props |
Object | Properties of this widget class. |
- Source:
Returns:
A constructor function that will create an instance of the custom element.
- Type
- function
Methods
-
<static> after()
-
Convenience shortcut to dcl.after().
- Source:
-
<static> around()
-
Convenience shortcut to dcl.around().
- Source:
-
<static> before()
-
Convenience shortcut to dcl.before().
- Source:
-
<static> createElement(tag) → {Element}
-
Create an Element. Similar to document.createElement(), but if tag is the name of a widget defined by register(), then it upgrades the Element to be a widget.
Parameters:
Name Type Description tag
string - Source:
Returns:
The DOMNode
- Type
- Element
-
<static> dcl()
-
Convenience shortcut to dcl().
- Source:
-
<static> parse(root)
-
Parse the given DOM tree for any DOMNodes that need to be upgraded to widgets.
Parameters:
Name Type Argument Description root
Element <optional>
DOM node to parse from.
- Source:
-
<static> superCall()
-
Convenience shortcut to dcl.superCall().
- Source:
-
<static> upgrade(inElement)
-
Converts plain DOMNode of custom type into widget, by adding the widget's custom methods, etc. Does nothing if the DOMNode has already been converted or if it doesn't correspond to a custom widget. Roughly equivalent to dojo/parser::instantiate(), but for a single node, not an array
Parameters:
Name Type Description inElement
Element The DOM node.
- Source: