Documentation

PrototypeElement extends PrototypeTraversal

Tags
extends

\DOMElement

Table of Contents

ancestors()  : NodeList
Collects all of element's ancestor elements and returns them as an array of extended elements.
childElements()  : NodeList
Collects all of the element's children and returns them as an array of Element.extended elements, in document order.
cleanWhitespace()  : PrototypeNode
Removes all of element's child text nodes that contain only whitespace. Returns element.
descendantOf()  : bool
Checks if element is a descendant of ancestor.
descendants()  : NodeList
Collects all of the element's descendants (its children, their children, etc.) and returns them as an array of extended elements.
down()  : PrototypeTraversal|null
Returns element's first descendant (or the Nth descendant, if index is specified) that matches expression.
empty()  : bool
Tests whether element is empty (i.e., contains only whitespace).
firstDescendant()  : PrototypeTraversal|null
Returns the first child that is an element.
importNode()  : PrototypeNode
Imports a new node into the document
insert()  : PrototypeElement
insert_after()  : PrototypeElement
Shortcut for PrototypeElement::insert(['after' => $content])
insert_before()  : PrototypeElement
Shortcut for PrototypeElement::insert(['before' => $content])
insert_bottom()  : PrototypeElement
Shortcut for PrototypeElement::insert(['bottom' => $content])
insert_top()  : PrototypeElement
Shortcut for PrototypeElement::insert(['top' => $content])
inspect()  : string
Returns the debug-oriented string representation of element.
match()  : bool
Checks if element matches the given CSS selector.
name()  : string
Returns the node name (convenience method)
next()  : PrototypeTraversal|null
Returns element's first following sibling (or the Nth, if index is specified) that matches expression.
nextSiblings()  : NodeList
Collects all of element's next siblings and returns them as an Array of elements.
previous()  : PrototypeTraversal|null
Returns element's first previous sibling (or the Nth, if index is specified) that matches expression.
previousSiblings()  : NodeList
Collects all of element's previous siblings and returns them as an Array of elements.
purge()  : PrototypeNode
Removes all child elements from the current element (not to confuse with the prototype method of the same name)
recursivelyCollect()  : NodeList
Recursively collects elements whose relationship to element is specified by property.
recursivelyFind()  : PrototypeTraversal|DOMNode|null
removeNode()  : PrototypeNode
Completely removes element from the document and returns it.
replace()  : PrototypeNode
Replaces element itself with newContent and returns element.
select()  : NodeList
This method is very similar to $$ but can be used within the context of one element, rather than the whole document.
siblings()  : NodeList
Collects all of element's siblings and returns them as an Array of elements.
tag()  : string|null
Returns the element tag name (convenience method) or null if the property doesn't exist
up()  : PrototypeTraversal|null
Returns element's first ancestor (or the Nth ancestor, if index is specified) that matches expression.
update()  : PrototypeElement
value()  : string
Returns the node value, optionally trims whitespace (default)
wrap()  : PrototypeElement

Methods

down()

Returns element's first descendant (or the Nth descendant, if index is specified) that matches expression.

public down([int|string|array<string|int, mixed>|null $expression = null ][, int|null $index = null ]) : PrototypeTraversal|null

If no expression is provided, all descendants are considered. If no descendant matches these criteria, null is returned.

Parameters
$expression : int|string|array<string|int, mixed>|null = null
$index : int|null = null
Tags
link
http://api.prototypejs.org/dom/Element/down/
Return values
PrototypeTraversal|null

name()

Returns the node name (convenience method)

public name() : string
Return values
string

next()

Returns element's first following sibling (or the Nth, if index is specified) that matches expression.

public next([int|string|array<string|int, mixed>|null $expression = null ][, int|null $index = null ]) : PrototypeTraversal|null

If no expression is provided, all following siblings are considered. If none matches these criteria, null is returned.

Parameters
$expression : int|string|array<string|int, mixed>|null = null
$index : int|null = null
Tags
link
http://api.prototypejs.org/dom/Element/next/
Return values
PrototypeTraversal|null

previous()

Returns element's first previous sibling (or the Nth, if index is specified) that matches expression.

public previous([int|string|array<string|int, mixed>|null $expression = null ][, int|null $index = null ]) : PrototypeTraversal|null

If no expression is provided, all previous siblings are considered. If none matches these criteria, null is returned.

Parameters
$expression : int|string|array<string|int, mixed>|null = null
$index : int|null = null
Tags
link
http://api.prototypejs.org/dom/Element/previous/
Return values
PrototypeTraversal|null

recursivelyCollect()

Recursively collects elements whose relationship to element is specified by property.

public recursivelyCollect(string $property[, int $maxLength = null ][, int $nodeType = null ]) : NodeList

property has to be a property of element that points to a single DOM node (e.g., nextSibling or parentNode).

Parameters
$property : string
$maxLength : int = null
$nodeType : int = null
Tags
link
http://api.prototypejs.org/dom/Element/recursivelyCollect/
Return values
NodeList

select()

This method is very similar to $$ but can be used within the context of one element, rather than the whole document.

public select([array<string|int, mixed> $selectors = null ]) : NodeList

The supported CSS syntax is identical, so please refer to the $$ docs for details.

Parameters
$selectors : array<string|int, mixed> = null
Tags
link
http://api.prototypejs.org/dom/Element/select/
Return values
NodeList

tag()

Returns the element tag name (convenience method) or null if the property doesn't exist

public tag() : string|null
Return values
string|null

up()

Returns element's first ancestor (or the Nth ancestor, if index is specified) that matches expression.

public up([int|string|array<string|int, mixed>|null $expression = null ][, int|null $index = null ]) : PrototypeTraversal|null

If no expression is provided, all ancestors are considered. If no ancestor matches these criteria, null is returned.

Parameters
$expression : int|string|array<string|int, mixed>|null = null
$index : int|null = null
Tags
link
http://api.prototypejs.org/dom/Element/up/
Return values
PrototypeTraversal|null

value()

Returns the node value, optionally trims whitespace (default)

public value([bool $trimmed = true ]) : string
Parameters
$trimmed : bool = true
Return values
string

Search results