DOMElement
extends DOMElement
in package
This class is used to represent elements, and implements many jQuery-like functions for the elements
Table of Contents
- __construct() : mixed
- Constructor for a DOMElement. This should not be called directly. Use the document's createElement method instead
- __get() : mixed
- Getter. The only supported property is html
- __set() : mixed
- __toString() : string
- Returns this element as a HTML fragment string.
- getBreadth() : int
- Returns the breadth (sometimes called child index) of this node in regards to it's siblings
- getDepth() : int
- Returns the depth of this node in regards to it's ancestors
- isBefore() : bool
- Test if this element comes before the other element in the DOM tree
- querySelector() : DOMElement|null
- Equivalent of JavaScripts querySelector. This will return the first element matching the specified selector, or NULL when no elements match
- querySelectorAll() : DOMObject
- Equivalent of JavaScripts querySelectorAll, takes a CSS selector, and optionally an array of options.
- implicitCastDomElement() : DOMElement
- implicitCastParentNode() : DOMElement
Methods
__construct()
Constructor for a DOMElement. This should not be called directly. Use the document's createElement method instead
public
__construct(string $qualifiedName) : mixed
Parameters
- $qualifiedName : string
Return values
mixed —__get()
Getter. The only supported property is html
public
__get(string $name) : mixed
Parameters
- $name : string
-
The name of the property to get
Return values
mixed —__set()
public
__set(mixed $name, mixed $value) : mixed
Parameters
- $name : mixed
- $value : mixed
Return values
mixed —__toString()
Returns this element as a HTML fragment string.
public
__toString() : string
Return values
string —Elements in this element rendered to a HTML string fragment
getBreadth()
Returns the breadth (sometimes called child index) of this node in regards to it's siblings
public
getBreadth() : int
Return values
int —The index of this node
getDepth()
Returns the depth of this node in regards to it's ancestors
public
getDepth() : int
Return values
int —The depth of this node
isBefore()
Test if this element comes before the other element in the DOM tree
public
isBefore(DOMElement $other) : bool
Parameters
- $other : DOMElement
-
The element to compare positions with
Return values
bool —TRUE if this element comes before the other, FALSE if not
querySelector()
Equivalent of JavaScripts querySelector. This will return the first element matching the specified selector, or NULL when no elements match
public
querySelector(string $selector) : DOMElement|null
Parameters
- $selector : string
-
The CSS selector
Return values
DOMElement|null —The element matching the selector, or NULL if none is found
querySelectorAll()
Equivalent of JavaScripts querySelectorAll, takes a CSS selector, and optionally an array of options.
public
querySelectorAll(string $selector[, array<string|int, mixed> $options = [] ]) : DOMObject
Parameters
- $selector : string
-
The CSS selector
- $options : array<string|int, mixed> = []
-
An array of options. The only supported option is "sort" which is true by default. This can be set to false for improved performance, where that is desirable over ordered results.
Return values
DOMObject —The result set matching the specified selector
implicitCastDomElement()
private
static implicitCastDomElement(mixed $el) : DOMElement
Parameters
- $el : mixed
Return values
DOMElement —implicitCastParentNode()
private
implicitCastParentNode() : DOMElement