Class dom_document

Web process Lua interface to the DOM
This module is only available from web process Lua states.

Retrieving the DOM document for a page:

To retrieve the DOM document loaded in a page, use the document property.

Methods

document:create_element (tag_name, attributes, inner_text)

Create a new element for the DOM document.

Parameters

  • tag_name
    Type: string
    The tag name of the element to create.
  • attributes
    Type: table
    Optional
    A table of attributes to set on the new element. All keys and values must be strings.
  • inner_text
    Type: string
    Optional
    The inner text to set on the element.

document:element_from_point (x, y)

Find the DOM element at the given point.

Parameters

  • x
    Type: integer
    The X coordinate of the point.
  • y
    Type: integer
    The Y coordinate of the point.

Return Values

  • dom_element
    The element at the given point.

Properties

document.body

Type: dom_element
Read-only
The body of the DOM document.

document.window.scroll_x

Type: integer
Read-only
The horizontal scroll position of the document view.

document.window.scroll_y

Type: integer
Read-only
The vertical scroll position of the document view.

document.window.inner_width

Type: integer
Read-only
The inner width of the DOM document.

document.window.inner_height

Type: integer
Read-only
The inner height of the DOM document.

Attribution

Copyright