Home Reference Source Repository
import Element from 'html-document/src/Element.js'
public class | source

Element

Extends:

NodeParentNode → Element

Direct Subclass:

HTMLElement

The outerHTML attribute of the element DOM interface gets the serialized HTML fragment describing the element including its descendants. It can be set to replace the element with nodes parsed from the given string.

See:

Member Summary

Public Members
public get
public get

Returns an unsigned long giving the amount of children that the object has.

public get

Returns a live HTMLCollection containing all objects of type Element that are children of this ParentNode.

public get

Returns the Element that is the first child of this ParentNode, or null if there is none.

public get

The id of the element.

public set

id(id: string): *

public get

Returns the Element that is the first child of this ParentNode, or null if there is none.

public get

Returns the Element immediately following the specified one in its parent's children list, or null if the specified element is the last one in the list.

public get

Returns the Element immediately prior to the specified one in its parent's children list, or null if the specified element is the first one in the list.

public get

The tag name of the element.

Method Summary

Public Methods
public

Returns a reference to the element by its ID.

public

The Element.getElementsByClassName() method returns a live HTMLCollection containing all child elements which have all of the given class names.

public

Returns an HTMLCollection of elements with the given tag name.

public

Returns the first element that is a descendant of the element on which it is invoked that matches the specified group of selectors.

public

Returns a non-live NodeList of all elements descended from the element on which it is invoked that match the specified group of CSS selectors.

Inherited Summary

From class Node
public get
public set

nodeValue(value: *): *

public get

Returns the Document that this node belongs to.

public get
public

addEventListener(eventType: string, listener: function, capturingPhase: boolean): *

public
public

getAttribute(attributeName: string): string

get attribute's value

public

hasAttribute(attributeName: string): boolean

checks if attribute exists for node

public

removeAttribute(attributeName: string)

remove attribute

public

removeEventListener(eventType: string, listener: function, capturingPhase: boolean): boolean

public

setAttribute(attributeName: string, attributeValue: string)

set attribute's value

From class ParentNode
public get

TODO return {HTMLCollection}

public get
public get
public get
public get
public get
public

appendChild(child: Node): Node

public

Clone a Node, and optionally, all of its contents.

public

Method returns true if node has child nodes.

public

insertBefore(child: Node, existingChild: Node): Node

public

removeChild(toRemoveChild: Node): Node

public

replaceChild(newChild: Node, oldChild: Node): Node

protected

_createCollection(selector: *): *

Inner method to create new live HTMLCollection.

Public Members

public get attributes: * source

public get childElementCount: number source

Returns an unsigned long giving the amount of children that the object has.

public get children: Element[] source

Returns a live HTMLCollection containing all objects of type Element that are children of this ParentNode.

Note: this currently returns a non-live array.

later type {HTMLCollection}

public get firstElementChild: Element source

Returns the Element that is the first child of this ParentNode, or null if there is none.

public get id: string source

The id of the element.

public set id(id: string): * source

public get lastElementChild: Element source

Returns the Element that is the first child of this ParentNode, or null if there is none.

public get nextElementSibling: Element source

Returns the Element immediately following the specified one in its parent's children list, or null if the specified element is the last one in the list.

public get previousElementSibling: Element source

Returns the Element immediately prior to the specified one in its parent's children list, or null if the specified element is the first one in the list.

public get tagName: string source

The tag name of the element.

Public Methods

public getElementById(id: string): Element source

Returns a reference to the element by its ID.

Params:

NameTypeAttributeDescription
id string

case-sensitive string representing the unique ID of the element being sought

Return:

Element

reference to an Element, or null if an element with the specified ID is not in the document.

public getElementsByClassName(names: string): HTMLCollection source

The Element.getElementsByClassName() method returns a live HTMLCollection containing all child elements which have all of the given class names. When called on the document object, the complete document is searched, including the root node.

Params:

NameTypeAttributeDescription
names string

is a string representing the list of class names to match; class names are separated by whitespace

Return:

HTMLCollection

public getElementsByTagName(tagName: string): HTMLCollection source

Returns an HTMLCollection of elements with the given tag name. The complete document is searched, including the root node. The returned HTMLCollection is live, meaning that it updates itself automatically to stay in sync with the DOM treewithout having to call document.getElementsByTagName() again.

Params:

NameTypeAttributeDescription
tagName string

Return:

HTMLCollection

public querySelector(query: string): Element | null source

Returns the first element that is a descendant of the element on which it is invoked that matches the specified group of selectors.

Params:

NameTypeAttributeDescription
query string

CSS query for selecting element

Return:

Element | null

public querySelectorAll(query: string): Element[] source

Returns a non-live NodeList of all elements descended from the element on which it is invoked that match the specified group of CSS selectors.

Params:

NameTypeAttributeDescription
query string

Return:

Element[]