Options
All
  • Public
  • Public/Protected
  • All
Menu

Provides an interface compatible with the browser HTMLElement - at least in so much as it provides the capabilities Wafer requires. The actual implementation is proxied to node-html-parser implementation of HTMLElement. It should be relatively straight forward to swap this implementation out for an alternative one if required.

Hierarchy

  • ServerElement

Index

Constructors

constructor

  • new ServerElement(tagName: string, attrs?: Object): ServerElement
  • Parameters

    • tagName: string

      the tag name of this element

    • attrs: Object = {}

      Object of initial attribute name/value pairs

    Returns ServerElement

Properties

_element

_element: ServerElement

Element containing reference to underlying HTMLElement implementation. The element is proxied in this class to:

  • avoid clashes with HTMLElement implementation details

  • make it easy to swap out for alternative implementations

Accessors

attributes

  • get attributes(): Object

childNodes

firstChild

innerHTML

  • set innerHTML(html: string): void
  • Set the innerHTML of underlying element

    Parameters

    • html: string

    Returns void

nodeType

  • get nodeType(): NodeType

parentNode

rawTagName

  • get rawTagName(): string
  • The tag name of the original element. This is used internally by node-html-parser and needs to br proxied here so a ServerElement can be used everywhere node-html-parser's HTMLElement is

    Returns string

tagName

  • get tagName(): string

textContent

  • get textContent(): string
  • set textContent(content: string): void

Methods

appendChild

getAttribute

  • getAttribute(key: string): string
  • Return the current value of names attribute

    Parameters

    • key: string

      Attribute name

    Returns string

getElement

hasAttribute

  • hasAttribute(key: string): boolean
  • Does this element have an attribute set with named key

    Parameters

    • key: string

      Attribute name

    Returns boolean

querySelector

querySelectorAll

removeAttribute

  • removeAttribute(key: string): void
  • Remove names attribute

    Parameters

    • key: string

      Attribute name

    Returns void

setAttribute

  • setAttribute(key: string, value: string): void
  • Sets the value for the name attribute

    Parameters

    • key: string

      Attribute name

    • value: string

      Value to set

    Returns void

setAttributes

  • setAttributes(attrs: Object): void
  • Sets all attributes at once

    Parameters

    • attrs: Object

      Value to set

    Returns void

setElement

toString

  • toString(): string

updateDone

  • updateDone(registry: Object): Promise<void>
  • Promise resolves when all pending updates have been processed

    Parameters

    • registry: Object

      registry of tag names to Wafer component definitions

    Returns Promise<void>

Generated using TypeDoc