Manual Reference Source Test
import Element from 'elementify/lib/element.js'
public class | version 1.0.0 | since 1.0.0 | source

Element

Element is basically a constructor that will take anything (string, node...) and returns the appropriate Elementify object.

If the provided input cannot be elementified, it is returned unchanged

Constructor Summary

Public Constructor
public

constructor(input: String | Node | HTMLElement, options: keyValueObject): HtmlElement | FormElement | FormInput | FormSelector | FormSwitcher | Collection

version 1.0.0 since 1.0.0

Method Summary

Private Methods
private

_nodeToElement(node: Node, options: KeyValueObject): HtmlElement | FormElement | FormInput | FormSelector | FormSwitcher | Collection

Converts a node to an HtmlElement.

version 1.0.0 since 1.0.0
private

_stringToElements(s: String, options: KeyValueObject): HtmlElement | FormElement | FormInput | FormSelector | FormSwitcher | Collection

Converts a string to an HtmlElement.

version 1.0.0 since 1.0.0

Public Constructors

public constructor(input: String | Node | HTMLElement, options: keyValueObject): HtmlElement | FormElement | FormInput | FormSelector | FormSwitcher | Collection version 1.0.0 since 1.0.0 source

Params:

NameTypeAttributeDescription
input String | Node | HTMLElement
options keyValueObject
  • optional
  • default: {}

An option/value object that will be passed to the resulting object. It may contain any HTML attributes and options. See each returned elements for legible values.

Return:

HtmlElement | FormElement | FormInput | FormSelector | FormSwitcher | Collection

Private Methods

private _nodeToElement(node: Node, options: KeyValueObject): HtmlElement | FormElement | FormInput | FormSelector | FormSwitcher | Collection version 1.0.0 since 1.0.0 source

Converts a node to an HtmlElement. You don't usually need to call directly this method.

Params:

NameTypeAttributeDescription
node Node

Node to import

options KeyValueObject
  • optional

An option/value object that will be passed to the resulting object. It may contain any HTML attributes and options. See each returned elements for legible values.

Return:

HtmlElement | FormElement | FormInput | FormSelector | FormSwitcher | Collection

private _stringToElements(s: String, options: KeyValueObject): HtmlElement | FormElement | FormInput | FormSelector | FormSwitcher | Collection version 1.0.0 since 1.0.0 source

Converts a string to an HtmlElement. You don't usually need to call directly this method.

Params:

NameTypeAttributeDescription
s String

String value to be converted to an Element

options KeyValueObject
  • optional

An option/value object that will be passed to the resulting object. It may contain any HTML attributes and options. See each returned elements for legible values.

Return:

HtmlElement | FormElement | FormInput | FormSelector | FormSwitcher | Collection