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

Document

Extends:

NodeParentNode → Document

See:

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public get

body: *

public set

body: *

public get
public get

head: *

public get
public set
public get

textContent returns null if the element is a document, a document type, or a notation.

Method Summary

Public Methods
public

appendChild(child: Node): Node

public

Creates a new Comment.

public

Creates a new empty DocumentFragment.

public

Creates a new element with the given tag name.

public

createTextNode(textContent: string): Text

Creates a text node.

public

Returns a reference to the element by its ID.

public

getElementsByClassName(className: *): *

public

Returns an HTMLCollection of elements with the given tag name.

public

Returns the first element within the document (using depth-first pre-order traversal of the document's nodes|by first element in document markup and iterating through sequential nodes by order of amount of child nodes) that matches the specified group of selectors.

public

Returns a list of the elements within the document (using depth-first pre-order traversal of the document's nodes) that match the specified group of selectors. The object returned is a NodeList.

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 Constructors

public constructor source

Override:

ParentNode#constructor

Public Members

public get body: * source

public set body: * source

public get documentElement: * source

public get head: * source

public get location: * source

public set location: * source

public get textContent: * source

textContent returns null if the element is a document, a document type, or a notation.

Override:

Node#textContent

See:

Public Methods

public appendChild(child: Node): Node source

Override:

ParentNode#appendChild

Params:

NameTypeAttributeDescription
child Node

Return:

Node

public createComment(data: string): Comment source

Creates a new Comment.

Params:

NameTypeAttributeDescription
data string

Return:

Comment

See:

public createElement(name: string): HTMLElement source

Creates a new element with the given tag name.

Params:

NameTypeAttributeDescription
name string

Return:

HTMLElement

See:

public createTextNode(textContent: string): Text source

Creates a text node.

Params:

NameTypeAttributeDescription
textContent string

Return:

Text

See:

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.

See:

public getElementsByClassName(className: *): * source

Params:

NameTypeAttributeDescription
className *

Return:

*

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

See:

public querySelector(selector: string): Element source

Returns the first element within the document (using depth-first pre-order traversal of the document's nodes|by first element in document markup and iterating through sequential nodes by order of amount of child nodes) that matches the specified group of selectors.

Params:

NameTypeAttributeDescription
selector string

Return:

Element

See:

public querySelectorAll(selector: string): NodeList source

Returns a list of the elements within the document (using depth-first pre-order traversal of the document's nodes) that match the specified group of selectors. The object returned is a NodeList.

Params:

NameTypeAttributeDescription
selector string

Return:

NodeList

See: