Documentation

PrototypeHTMLElement extends PrototypeElement

Tags
extends

\DOMElement

Table of Contents

addClassName()  : PrototypeHTMLElement
Adds the given CSS class to element.
addClassNames()  : PrototypeHTMLElement
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.
classNames()  : array<string|int, string>
Returns an array of the element's current class names.
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.
getAttributes()  : array<string|int, string>
getClassName()  : string
Returns the (raw) classname
getHref()  : string
Returns the "href" attribute (if any, convenience)
getSrc()  : string
Returns the "src" attribute (if any, convenience)
getStyle()  : string|null
Returns the given CSS property value of element.
getStyles()  : array<string|int, string>
hasClassName()  : bool
Checks for the presence of CSS class className on element.
identify()  : string
Returns element's ID. If element does not have an ID, $newID assigned to element, and the old id returned.
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
removeAttributes()  : PrototypeHTMLElement
removeClassName()  : PrototypeHTMLElement
Removes CSS class className from element.
removeClassNames()  : PrototypeHTMLElement
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.
setAttributes()  : PrototypeHTMLElement
setClassName()  : PrototypeHTMLElement
Sets the (raw) classname
setHref()  : PrototypeHTMLElement
Sets the "href" attribute (convenience)
setSrc()  : PrototypeHTMLElement
Sets the "src" attribute (convenience)
setStyle()  : PrototypeHTMLElement
Modifies element's CSS style properties.
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
toggleClassName()  : PrototypeHTMLElement
Toggles the presence of CSS class className on element.
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

getAttributes()

public getAttributes() : array<string|int, string>
Return values
array<string|int, string>

getClassName()

Returns the (raw) classname

public getClassName() : string
Return values
string

getHref()

Returns the "href" attribute (if any, convenience)

public getHref() : string
Return values
string

getSrc()

Returns the "src" attribute (if any, convenience)

public getSrc() : string
Return values
string

getStyles()

public getStyles() : array<string|int, string>
Return values
array<string|int, string>

identify()

Returns element's ID. If element does not have an ID, $newID assigned to element, and the old id returned.

public identify([string $newID = null ]) : string

http://api.prototypejs.org/dom/Element/identify/

Parameters
$newID : string = null
Return values
string

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