Class: Element

declarative.Element

Class representing a high-level element wrapping a mid-level element in a declarative fashion.

The properties of the underlying mid-level element are exposed as dynamic values.

new declarative.Element (type)

This constructor is not exported. Use the function declarative.element to create an element.

Name Type Description
type function

The constructor of the mid-level object type to wrap.

Methods

Adds a child element to this element.

Name Type Description
child declarative.Element

The child declarative-level element.

Returns:
Type Description
declarative.Element This element for chaining.

Calls the given method on the underlying mid-level element. The method's return value is waived.

Name Type Description
name string

The name of the method to call.

Returns:
Type Description
declarative.Element This element for chaining.

crossConnect (getEl, event)function

Returns a cross connector to another element's event.

Name Type Description
getEl function

A function returning the target declarative-level element.

event string

The name of the event.

Returns:
Type Description
function The connector.

Adds a custom event to the underlying mid-level element.

Name Type Description
name string

The name of the new event.

Returns:
Type Description
declarative.Element This element for chaining.

Returns the child element with the given ID in the given namespace.

Name Type Description
id string

The ID of the element to look for.

ns string

The namespace to search.

Returns:
Type Description
declarative.Element The element, or undefined if not found.

Returns the underlying mid-level element.

Returns:
Type Description
core.Object The mid-level element.

Sets or returns the ID of this element in the given namespace.

An element may be present in multiple namespaces by different IDs. For example, the root element of a component could have another ID within the component, than within the document where the component is used.

Name Type Default Description
i string

(optional) The element ID to set.

ns string "" optional

(optional) The namespace to use.

Returns:
Type Description
declarative.Element This element for chaining.

property (name, value)declarative.Element

Adds a custom property to the underlying mid-level element.

The new property is notifyable. If it is a number, it is transitionable as well.

Name Type Description
name string

The name of the new property.

value any

The initial value.

Returns:
Type Description
declarative.Element This element for chaining.

Sets the given property and returns this element for chaining.

Name Type Description
prop string

The property name.

value any

The new value.

Returns:
Type Description
declarative.Element This element for chaining.

Uses the given element subsequently in a chain of commands.

Name Type Description
el declarative.Element

A declarative-level element.

Returns:
Type Description
declarative.Element The given element for chaining.