Class: Object

html.Object

Base class representing an abstract object in a HTML environment.

new html.Object ()

Extends

Methods

addHtmlEventListener (target, type, listener, options)

Adds a HTML event listener and registers it for proper removal when this object gets destroyed. This method is prefered to just using addEventListener, which may leak event listener callbacks along with their closures.

Name Type Description
target HTMLElement

The target HTML element.

type string

The event type.

listener function

The listener function.

options object optional

Optional HTML event listener options.

See:
  • removeHtmlEventListener

blobUrl (blob)string

Creates an URL for the given blob. The URL is automatically revoked on destruction of this object.

Name Type Description
blob Blob

The blob to create an URL for.

Returns:
Type Description
string
  • The URL.

escapeHtml (text)string

Escapes a text string for HTML output.

This function replaces certain characters in the text string by entities (for example, "<" becomes "&lt;") so that the string may safely be output in HTML.

Name Type Description
text string

The text to escape.

Returns:
Type Description
string The escaped text.

escapeMarkup (text)string

Escapes a text string for literal output.

Name Type Description
text string

The text to escape.

Returns:
Type Description
string The escaped text.

removeHtmlEventListener (target, type, listener, options)

Removes the given HTML event listener. This is prefered to just using removeEventListener.

Name Type Description
target HTMLElement

The target HTML element.

type string

The event type.

listener function

The listener function.

options object optional

Optional HTML event listener options.

See:
  • addHtmlEventListener