Struct Element
A html element
struct Element
;
Properties
Name | Type | Description |
---|---|---|
children [set]
|
auto | All the children contained in this element. (non-deep search) |
contains [set]
|
bool | Check if this element contains another one |
descendants [set]
|
auto | All the children contained in this element. (deep search) |
firstChild [set]
|
Element | The first child |
getAttribute [set]
|
string | Get an attribute |
hasAttribute [set]
|
bool | Check if an attribute exists |
id [get]
|
string | The id of this element (if present) |
innerHTML [set]
|
string | Set the html content of this element |
innerHTML [get]
|
string | Get the content of this element |
innerText [get]
|
string | Set the inner text of this element (replacing html) |
innerText [set]
|
string | Get the inner text of this element (ignoring html tags) |
isAncestorOf [set]
|
bool | Check if this element is the ancestor of another one |
isDescendantOf [set]
|
bool | Check if this element is the descendant of another one |
isEmpty [get]
|
bool | Is this element empty? |
isValid [get]
|
bool | Is this element valid? |
lastChild [set]
|
Element | The last child |
name [get]
|
string | The tag name of this element. For example "p" or "div" |
next [set]
|
Element | The next element in the document |
outerHTML [get]
|
string | The outer html of this element |
outerHTML [set]
|
string | Set the outer html of this element |
owner [get]
|
Document | The owner of this element |
parent [get]
|
Element | The parent element |
prev [set]
|
Element | The previous element in the document |
removeAttribute [set]
|
string | Remove an attribute from this element |
setAttribute [set]
|
string | Set an attribute for this element |
Methods
Name | Description |
---|---|
appendChild
(el)
|
Put a new child in the last position |
appendSibling
(el)
|
Append an element |
attributes
()
|
Return a lazy range of attributes for this element |
byClass
(name)
|
Search for elements by class |
byComment
(comment, stripSpaces)
|
Search for elements by comment |
byId
(id)
|
Search for elements by id |
bySelector
(selector)
|
Search for elements by selector |
byTagName
(name)
|
Search for elements by tag name |
classes
(, )
|
All the classes of this element |
copyFrom
(e, deep)
|
Copy another element here |
dup
(deep)
|
Clone this element |
prependChild
(el)
|
Put a new child in the first position |
prependSibling
(el)
|
Prepend an element |
remove
()
|
Remove this element from the document |
replaceWith
(el)
|
Replace this element with another one |
toString
(deep)
|
Convert this element to a string |
Inner structs
Name | Description |
---|---|
Attribute
|
A simple key/value struct representing a html attribute |