class Element
- namespace: RmlUi
Represents an element in the RmlUi document tree. This class cannot be constructed directly; use a Document object to instantiate elements. This is the foundational piece of the DOM.
[source]
methods
Element.AddEventListener
function Element.AddEventListener(
event: string,
listener: (function|string),
in_capture_phase: boolean
)
Adds an event listener to the element.
[source]
Element.AppendChild
function Element.AppendChild(element: RmlUi.ElementPtr) -> RmlUi.ElementPtr
Appends element as a child to this element.
[source]
Element.Blur
function Element.Blur()
Removes input focus from this element.
[source]
Element.Click
function Element.Click()
Fakes a click on this element.
[source]
Element.DispatchEvent
function Element.DispatchEvent(
event: string,
parameters: table,
interruptible: string
) -> boolean
Dispatches an event to this element.
[source]
Element.Focus
function Element.Focus()
Gives input focus to this element.
[source]
Element.GetAttribute
function Element.GetAttribute(name: string) -> any
Returns the value of the attribute named name. If no such attribute exists, the empty string will be returned.
[source]
Element.GetElementById
function Element.GetElementById(id: string) -> RmlUi.Element
Returns the descendant element with an id of id.
[source]
Element.GetElementsByTagName
function Element.GetElementsByTagName(tag_name: string) -> RmlUi.ElementPtr[]
Returns a list of all descendant elements with the tag of tag_name.
[source]
Element.QuerySelector
function Element.QuerySelector(query: string) -> RmlUi.ElementPtr
Unsure what this does, but seems powerful?
[source]
Element.QuerySelectorAll
function Element.QuerySelectorAll(selectors: string)
Unsure what this does, but seems powerful?
[source]
Element.HasAttribute
function Element.HasAttribute(name: string) -> boolean
Returns True if the element has a value for the attribute named name, False if not.
[source]
Element.HasChildNodes
function Element.HasChildNodes() -> boolean
Returns True if the element has at least one child node, false if not.
[source]
Element.InsertBefore
function Element.InsertBefore(
element: RmlUi.ElementPtr,
adjacent_element: RmlUi.Element
) -> RmlUi.Element?
Inserts the element element as a child of this element, directly before adjacent_element in the list of children.
[source]
Element.IsClassSet
function Element.IsClassSet(name: string) -> boolean
Returns true if the class name is set on the element, false if not.
[source]
Element.RemoveAttribute
function Element.RemoveAttribute(name: string)
Removes the attribute named name from the element.
[source]
Element.RemoveChild
function Element.RemoveChild(element: RmlUi.Element) -> boolean
Removes the child element element from this element.
[source]
Element.ReplaceChild
function Element.ReplaceChild(
inserted_element: RmlUi.ElementPtr,
replaced_element: RmlUi.Element
) -> boolean
Replaces the child element replaced_element with inserted_element in this element’s list of children. If replaced_element is not a child of this element, inserted_element will be appended onto the list instead.
[source]
Element.ScrollIntoView
function Element.ScrollIntoView(align_with_top: boolean)
Scrolls this element into view if its ancestors have hidden overflow.
[source]
Element.SetAttribute
function Element.SetAttribute(
name: string,
value: string
)
Sets the value of the attribute named name to value.
[source]
Element.SetClass
function Element.SetClass(
name: string,
value: boolean
)
Sets (if value is true) or clears (if value is false) the class name on the element.
[source]
Element.GetElementsByClassName
function Element.GetElementsByClassName(class_name: string) -> RmlUi.Element[]
[source]
Element.Clone
function Element.Clone() -> RmlUi.ElementPtr
[source]
Element.Closest
function Element.Closest() -> RmlUi.Element?
[source]
Element.SetPseudoClass
function Element.SetPseudoClass(class_name: string)
[source]
Element.IsPseudoClassSet
function Element.IsPseudoClassSet(class_name: string) -> boolean
[source]
Element.ArePseudoCLassesSet
function Element.ArePseudoCLassesSet(class_names: string[]) -> boolean
[source]
Element.GetActivePseudoCLasses
function Element.GetActivePseudoCLasses() -> string[]
[source]
Element.IsPointWithinElement
function Element.IsPointWithinElement(point: RmlUi.Vector2i) -> boolean
Is a screen-space point within this element?
[source]
Element.ProcessDefaultAction
function Element.ProcessDefaultAction(event: RmlUi.Event)
[source]
Element.GetValue
function Element.GetValue() -> value (number|string|"")
@return value
- Returns number if it has the tag “input”, a string if it has the tag “textarea”, else an empty string.
Get the value of this element.
[source]
Element.GetChild
function Element.GetChild(index: integer) -> RmlUi.Element?
[source]
fields
Element.class_name
Element.class_name : string
[source] Name of the class.
Element.id
Element.id : string
[source] ID of this element, in the context of <span id="foo">
.
Element.inner_rml
Element.inner_rml : string
[source] Gets or sets the inner RML (markup) content of the element.
Element.scroll_left
Element.scroll_left : integer
[source] Gets or sets the number of pixels that the content of the element is scrolled from the left.
Element.scroll_top
Element.scroll_top : integer
[source] Gets or sets the number of pixels that the content of the element is scrolled from the top.
Element.attributes
Element.attributes : RmlUi.ElementAttributesProxy
[source] Read-only. Proxy for accessing element attributes.
Element.child_nodes
Element.child_nodes : RmlUi.ElementChildNodesProxy
[source] Read-only. Proxy for accessing child nodes of the element.
Element.client_left
Element.client_left : integer
[source] Read-only. The width of the left border of the element in pixels.
Element.client_height
Element.client_height : integer
[source] Read-only. The inner height of the element in pixels, including padding but not the horizontal scrollbar height, border, or margin.
Element.client_top
Element.client_top : integer
[source] Read-only. The width of the top border of the element in pixels.
Element.client_width
Element.client_width : integer
[source] Read-only. The inner width of the element in pixels, including padding but not the vertical scrollbar width, border, or margin.
Element.first_child
Element.first_child : RmlUi.Element?
[source] Read-only. The first child element, or nil if there are no children.
Element.last_child
Element.last_child : RmlUi.Element?
[source] Read-only. The last child element, or nil if there are no children.
Element.next_sibling
Element.next_sibling : RmlUi.Element?
[source] Read-only. The next sibling element, or nil if there is none.
Element.offset_height
Element.offset_height : integer
[source] Read-only. The height of the element including vertical padding and borders, in pixels.
Element.offset_left
Element.offset_left : integer
[source] Read-only. The distance from the inner left edge of the offset parent, in pixels.
Element.offset_parent
Element.offset_parent : RmlUi.Element {
class_name: string,
id: string,
inner_rml: string,
scroll_left: integer,
scroll_top: integer,
attributes: RmlUi.ElementAttributesProxy,
child_nodes: RmlUi.ElementChildNodesProxy,
client_left: integer,
client_height: integer,
client_top: integer,
client_width: integer,
first_child: RmlUi.Element?,
...
}
[source] Read-only. The closest positioned ancestor element.
Element.offset_top
Element.offset_top : integer
[source] Read-only. The distance from the inner top edge of the offset parent, in pixels.
Element.offset_width
Element.offset_width : integer
[source] Read-only. The width of the element including horizontal padding and borders, in pixels.
Element.owner_document
Element.owner_document : RmlUi.Document {
title: string,
context: RmlUi.Context,
url: string,
modal: boolean,
widget: table,
}
[source] Read-only. The document that owns this element.
Element.parent_node
Element.parent_node : RmlUi.Element?
[source] Read-only. The parent node of this element, or nil if there is none.
Element.previous_sibling
Element.previous_sibling : RmlUi.Element?
[source] Read-only. The previous sibling element, or nil if there is none.
Element.scroll_height
Element.scroll_height : integer
[source] Read-only. The total height of the element’s content, including content not visible on the screen due to overflow.
Element.scroll_width
Element.scroll_width : integer
[source] Read-only. The total width of the element’s content, including content not visible on the screen due to overflow.
Element.style
Element.style : RmlUi.ElementStyleProxy
[source] Read-only. Proxy for accessing and modifying the element’s style properties.
Element.tag_name
Element.tag_name : string
[source] Read-only. The tag name of the element.
Element.address
Element.address : string
[source] Read-only. The address of the element in the document tree.
Element.absolute_left
Element.absolute_left : integer
[source] Read-only. The absolute left position of the element relative to the document.
Element.absolute_top
Element.absolute_top : integer
[source] Read-only. The absolute top position of the element relative to the document.
Element.baseline
Element.baseline : integer
[source] Read-only. The baseline position of the element.
Element.line_height
Element.line_height : integer
[source] Read-only. The computed line height of the element.
Element.visible
Element.visible : boolean
[source] Read-only. True if the element is visible, false otherwise.
Element.z_index
Element.z_index : integer
[source] Read-only. The computed z-index of the element.