PrototypeHTMLElement extends PrototypeElement
Tags
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
addClassName()
Adds the given CSS class to element.
public
addClassName(string $classname) : PrototypeHTMLElement
Parameters
- $classname : string
Tags
Return values
PrototypeHTMLElement —addClassNames()
public
addClassNames(array<string|int, mixed> $classnames) : PrototypeHTMLElement
Parameters
- $classnames : array<string|int, mixed>
Return values
PrototypeHTMLElement —ancestors()
Collects all of element's ancestor elements and returns them as an array of extended elements.
public
ancestors() : NodeList
Tags
Return values
NodeList —childElements()
Collects all of the element's children and returns them as an array of Element.extended elements, in document order.
public
childElements([int $nodeType = null ]) : NodeList
The first entry in the array is the topmost child of element, the next is the child after that, etc.
Parameters
- $nodeType : int = null
Tags
Return values
NodeList —classNames()
Returns an array of the element's current class names.
public
classNames() : array<string|int, string>
Tags
Return values
array<string|int, string> —cleanWhitespace()
Removes all of element's child text nodes that contain only whitespace. Returns element.
public
cleanWhitespace() : PrototypeNode
Tags
Return values
PrototypeNode —descendantOf()
Checks if element is a descendant of ancestor.
public
descendantOf(DOMNode $ancestor) : bool
Parameters
- $ancestor : DOMNode
Tags
Return values
bool —descendants()
Collects all of the element's descendants (its children, their children, etc.) and returns them as an array of extended elements.
public
descendants() : NodeList
Tags
Return values
NodeList —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
Return values
PrototypeTraversal|null —empty()
Tests whether element is empty (i.e., contains only whitespace).
public
empty() : bool
Tags
Return values
bool —firstDescendant()
Returns the first child that is an element.
public
firstDescendant() : PrototypeTraversal|null
Tags
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 —getStyle()
Returns the given CSS property value of element.
public
getStyle(string $property) : string|null
Parameters
- $property : string
Tags
Return values
string|null —getStyles()
public
getStyles() : array<string|int, string>
Return values
array<string|int, string> —hasClassName()
Checks for the presence of CSS class className on element.
public
hasClassName(string $classname) : bool
Parameters
- $classname : string
Tags
Return values
bool —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 —importNode()
Imports a new node into the document
public
importNode(PrototypeNode $newNode) : PrototypeNode
Parameters
- $newNode : PrototypeNode
Return values
PrototypeNode —insert()
public
insert(string|array<string|int, mixed>|DOMNode|DOMNodeList|PrototypeElement $content) : PrototypeElement
Parameters
- $content : string|array<string|int, mixed>|DOMNode|DOMNodeList|PrototypeElement
Tags
Return values
PrototypeElement —insert_after()
Shortcut for PrototypeElement::insert(['after' => $content])
public
insert_after(PrototypeElement $node) : PrototypeElement
Parameters
- $node : PrototypeElement
Return values
PrototypeElement —insert_before()
Shortcut for PrototypeElement::insert(['before' => $content])
public
insert_before(PrototypeElement $node[, PrototypeElement $refNode = null ]) : PrototypeElement
Parameters
- $node : PrototypeElement
- $refNode : PrototypeElement = null
Return values
PrototypeElement —insert_bottom()
Shortcut for PrototypeElement::insert(['bottom' => $content])
public
insert_bottom(PrototypeElement $node) : PrototypeElement
Parameters
- $node : PrototypeElement
Return values
PrototypeElement —insert_top()
Shortcut for PrototypeElement::insert(['top' => $content])
public
insert_top(PrototypeElement $node) : PrototypeElement
Parameters
- $node : PrototypeElement
Return values
PrototypeElement —inspect()
Returns the debug-oriented string representation of element.
public
inspect([bool $xml = null ]) : string
Parameters
- $xml : bool = null
Tags
Return values
string —match()
Checks if element matches the given CSS selector.
public
match(string $selector) : bool
Parameters
- $selector : string
Tags
Return values
bool —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
Return values
PrototypeTraversal|null —nextSiblings()
Collects all of element's next siblings and returns them as an Array of elements.
public
nextSiblings() : NodeList
Tags
Return values
NodeList —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
Return values
PrototypeTraversal|null —previousSiblings()
Collects all of element's previous siblings and returns them as an Array of elements.
public
previousSiblings() : NodeList
Tags
Return values
NodeList —purge()
Removes all child elements from the current element (not to confuse with the prototype method of the same name)
public
purge() : PrototypeNode
Return values
PrototypeNode —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
Return values
NodeList —recursivelyFind()
public
recursivelyFind([string $selector = null ][, int $index = null ][, string $property = null ][, int $nodeType = XML_ELEMENT_NODE ]) : PrototypeTraversal|DOMNode|null
Parameters
- $selector : string = null
- $index : int = null
- $property : string = null
- $nodeType : int = XML_ELEMENT_NODE
Tags
Return values
PrototypeTraversal|DOMNode|null —removeAttributes()
public
removeAttributes(array<string|int, mixed> $attributes) : PrototypeHTMLElement
Parameters
- $attributes : array<string|int, mixed>
Return values
PrototypeHTMLElement —removeClassName()
Removes CSS class className from element.
public
removeClassName(string $classname) : PrototypeHTMLElement
Parameters
- $classname : string
Tags
Return values
PrototypeHTMLElement —removeClassNames()
public
removeClassNames(array<string|int, mixed> $classnames) : PrototypeHTMLElement
Parameters
- $classnames : array<string|int, mixed>
Return values
PrototypeHTMLElement —removeNode()
Completely removes element from the document and returns it.
public
removeNode() : PrototypeNode
Tags
Return values
PrototypeNode —replace()
Replaces element itself with newContent and returns element.
public
replace(PrototypeNode $newNode) : PrototypeNode
Parameters
- $newNode : PrototypeNode
Tags
Return values
PrototypeNode —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
Return values
NodeList —setAttributes()
public
setAttributes(array<string|int, mixed> $attributes) : PrototypeHTMLElement
Parameters
- $attributes : array<string|int, mixed>
Return values
PrototypeHTMLElement —setClassName()
Sets the (raw) classname
public
setClassName(string $class) : PrototypeHTMLElement
Parameters
- $class : string
Return values
PrototypeHTMLElement —setHref()
Sets the "href" attribute (convenience)
public
setHref(string $href) : PrototypeHTMLElement
Parameters
- $href : string
Return values
PrototypeHTMLElement —setSrc()
Sets the "src" attribute (convenience)
public
setSrc(string $src) : PrototypeHTMLElement
Parameters
- $src : string
Return values
PrototypeHTMLElement —setStyle()
Modifies element's CSS style properties.
public
setStyle(array<string|int, mixed> $style[, bool $replace = null ]) : PrototypeHTMLElement
Parameters
- $style : array<string|int, mixed>
- $replace : bool = null
Tags
Return values
PrototypeHTMLElement —siblings()
Collects all of element's siblings and returns them as an Array of elements.
public
siblings() : NodeList
Tags
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 —toggleClassName()
Toggles the presence of CSS class className on element.
public
toggleClassName(string $classname) : PrototypeHTMLElement
Parameters
- $classname : string
Tags
Return values
PrototypeHTMLElement —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
Return values
PrototypeTraversal|null —update()
public
update(string|DOMNode|DOMNodeList $content) : PrototypeElement
Parameters
- $content : string|DOMNode|DOMNodeList
Tags
Return values
PrototypeElement —value()
Returns the node value, optionally trims whitespace (default)
public
value([bool $trimmed = true ]) : string
Parameters
- $trimmed : bool = true
Return values
string —wrap()
public
wrap(PrototypeElement $wrapper) : PrototypeElement
Parameters
- $wrapper : PrototypeElement