Dodo
DOm DOcument implementation
|
Public Member Functions | ||||||||||||||||
static callable(Element,?string,?string)(string $localName) void | __construct (Document $nodeDocument, string $lname, ?string $ns, ?string $prefix=null) | |||||||||||||||
Fetch the appropriate attribute change handler for a change to the attribute named $localName . | ||||||||||||||||
int | getNodeType () | |||||||||||||||
Return the node type enumeration for this node.
| ||||||||||||||||
string | getNodeName () | |||||||||||||||
Return the nodeName for this node.
| ||||||||||||||||
NamedNodeMap | getAttributes () | |||||||||||||||
string | getPrefix () | |||||||||||||||
string | getLocalName () | |||||||||||||||
string | getNamespaceURI () | |||||||||||||||
string | getTagName () | |||||||||||||||
string | getInnerHTML () | |||||||||||||||
string | getOuterHTML () | |||||||||||||||
setIdAttribute (string $qualifiedName, bool $isId) | ||||||||||||||||
_xmlSerialize (?string $namespace, NamespacePrefixMap $prefixMap, int &$prefixIndex, array $options, array &$markup) | ||||||||||||||||
XML serialize the given node.This is overridden in subclasses. Note that this is effectively "outerHTML", due to a spec inconsistency: https://github.com/w3c/DOM-Parsing/issues/28 .
| ||||||||||||||||
string | getAttribute (string $qname) | |||||||||||||||
Fetch the value of an attribute with the given qualified name. | ||||||||||||||||
setAttribute (string $qname, string $value) | ||||||||||||||||
Set the value of first attribute with a particular qualifiedName. | ||||||||||||||||
_setAttribute (string $qname, string $value) | ||||||||||||||||
Internal version of ::setAttribute() which bypasses checks and lowercasing; used by Remex when tree building. | ||||||||||||||||
removeAttribute (string $qname) | ||||||||||||||||
Remove the first attribute given a particular qualifiedName. | ||||||||||||||||
bool | hasAttribute (string $qname) | |||||||||||||||
Test Element for attribute with the given qualified name. | ||||||||||||||||
bool | toggleAttribute (string $qname, ?bool $force=null) | |||||||||||||||
Toggle the first attribute with the given qualified name. | ||||||||||||||||
string | getAttributeNS (?string $ns, string $lname) | |||||||||||||||
Fetch value of attribute with the given namespace and localName. | ||||||||||||||||
setAttributeNS (?string $ns, string $qname, string $value) | ||||||||||||||||
Set value of attribute with a particular namespace and localName. | ||||||||||||||||
_setAttributeNS (?string $ns, ?string $prefix, string $lname, string $value) | ||||||||||||||||
Internal version of ::setAttributeNS which bypasses checks and prefix parsing; used by Remex when tree building. | ||||||||||||||||
removeAttributeNS (?string $ns, string $lname) | ||||||||||||||||
Remove attribute given a particular namespace and localName. | ||||||||||||||||
bool | hasAttributeNS (?string $ns, string $lname) | |||||||||||||||
Test Element for attribute with the given namespace and localName. | ||||||||||||||||
Attr | getAttributeNode (string $qname) | |||||||||||||||
Fetch the Attr node with the given qualifiedName. | ||||||||||||||||
Attr | setAttributeNode ( $attr) | |||||||||||||||
Add an Attr node to an Element node. | ||||||||||||||||
Attr | removeAttributeNode ( $attr) | |||||||||||||||
Remove the given attribute node from this Element. | ||||||||||||||||
Attr | getAttributeNodeNS (?string $ns, string $lname) | |||||||||||||||
Fetch the Attr node with the given namespace and localName. | ||||||||||||||||
Attr | setAttributeNodeNS ( $attr) | |||||||||||||||
Add a namespace-aware Attr node to an Element node. | ||||||||||||||||
bool | hasAttributes () | |||||||||||||||
Test whether this Element has any attributes. | ||||||||||||||||
array | getAttributeNames () | |||||||||||||||
Fetch the qualified names of all attributes on this Element. | ||||||||||||||||
mixed null | getClassList () | |||||||||||||||
bool | matches (string $selectors) | |||||||||||||||
bool | webkitMatchesSelector (string $selectors) | |||||||||||||||
Element | closest (string $selectors) | |||||||||||||||
bool | _isHTMLElement () | |||||||||||||||
Calls isHTMLDocument() on ownerDocument. | ||||||||||||||||
Element | _nextElement (?Element $root) | |||||||||||||||
Return the next element, in source order, after this one or null if there are no more. | ||||||||||||||||
HTMLCollection | getElementsByTagName (string $lname) | |||||||||||||||
HTMLCollection | getElementsByClassName (string $names) | |||||||||||||||
array< Element > | _getElementsById (string $id) | |||||||||||||||
This is a non-standard Dodo extension that interfaces with the Zest CSS selector library to allow quick lookup by ID even if there are multiple nodes in the document with the same ID. | ||||||||||||||||
static callable(Element)(string $lname) static callable(Element)(string $lname) HTMLCollection | getElementsByTagNameNS (?string $ns, string $lname) | |||||||||||||||
Public Member Functions inherited from Wikimedia\Dodo\ContainerNode | ||||||||||||||||
__construct (Document $nodeDocument) | ||||||||||||||||
bool | hasChildNodes () | |||||||||||||||
Return true iff there are children of this node. | ||||||||||||||||
int | _length () | |||||||||||||||
| ||||||||||||||||
bool | _empty () | |||||||||||||||
| ||||||||||||||||
NodeList | getChildNodes () | |||||||||||||||
Keeping child nodes as an array makes insertion/removal of nodes quite expensive. | ||||||||||||||||
Node | getFirstChild () | |||||||||||||||
Be careful to use this method in most cases rather than directly accessing _firstChildOrChildren . | ||||||||||||||||
Node | getLastChild () | |||||||||||||||
This should be overridden in ContainerNode and Leaf. | ||||||||||||||||
string | getTextContent () | |||||||||||||||
Generic implementation of ::getTextContent to be used by Element and DocumentFragment (but not Document!). | ||||||||||||||||
setTextContent (?string $value) | ||||||||||||||||
Generic implementation of ::setTextContent to be used by Element and DocumentFragment (but not Document!). | ||||||||||||||||
Public Member Functions inherited from Wikimedia\Dodo\Node | ||||||||||||||||
string | getNodeValue () | |||||||||||||||
Return the value for this node. | ||||||||||||||||
setNodeValue (?string $val) | ||||||||||||||||
Document | getOwnerDocument () | |||||||||||||||
The ownerDocument getter steps are to return null, if this is a document; otherwise this’s node document. | ||||||||||||||||
Node | getParentNode () | |||||||||||||||
Nodes might not have a parentNode. | ||||||||||||||||
Element | getParentElement () | |||||||||||||||
This value is the same as parentNode, except it puts an extra condition, that the parentNode must be an Element. | ||||||||||||||||
Wikimedia IDLeDOM Node | getRootNode ($options=null) | |||||||||||||||
Return this' shadow-including root if options['composed'] is true; otherwise return this' root. | ||||||||||||||||
Node | getPreviousSibling () | |||||||||||||||
Node | getNextSibling () | |||||||||||||||
_roothook () | ||||||||||||||||
<script> elements need to know when they're inserted into the document. | ||||||||||||||||
Node | insertBefore ($node, $refNode=null) | |||||||||||||||
Insert $node as a child of $this, and insert it before $refChild in the document order. | ||||||||||||||||
appendChild ( $node) | ||||||||||||||||
Node | _unsafeAppendChild (Node $node) | |||||||||||||||
Does not check for insertion validity. | ||||||||||||||||
Node | replaceChild ( $new, $old) | |||||||||||||||
Node | removeChild ( $node) | |||||||||||||||
normalize () | ||||||||||||||||
Puts $this and the entire subtree rooted at $this into "normalized" form. | ||||||||||||||||
int | compareDocumentPosition ( $that) | |||||||||||||||
bool | contains ( $node) | |||||||||||||||
bool | isSameNode ( $node) | |||||||||||||||
bool | isEqualNode ( $node) | |||||||||||||||
Determine whether this node and $other are equal. | ||||||||||||||||
Node | cloneNode (bool $deep=false) | |||||||||||||||
Clone this Node. | ||||||||||||||||
string | lookupPrefix (?string $ns) | |||||||||||||||
Return DOMString containing prefix for given namespace URI. | ||||||||||||||||
string | lookupNamespaceURI (?string $prefix) | |||||||||||||||
Return DOMString containing namespace URI for a given prefix. | ||||||||||||||||
bool | isDefaultNamespace (?string $ns) | |||||||||||||||
Determine whether this is the default namespace. | ||||||||||||||||
string | getNodePath () | |||||||||||||||
Get an XPath for a node. | ||||||||||||||||
_resetNodeDocument (Document $doc) | ||||||||||||||||
Set the ownerDocument reference on a subtree rooted at $this. | ||||||||||||||||
bool | getIsConnected () | |||||||||||||||
Determine whether this Node is rooted (belongs to the tree rooted at the node document). | ||||||||||||||||
int | _getSiblingIndex () | |||||||||||||||
The index of this Node in its parent's childNodes list. | ||||||||||||||||
int | _lastModTime () | |||||||||||||||
Return the lastModTime value for this node. | ||||||||||||||||
_modify () | ||||||||||||||||
Increment the owner document's modclock [and use the new value to update the lastModTime value for this node and all of its ancestors. | ||||||||||||||||
_htmlSerialize (array &$result, array $options) | ||||||||||||||||
Convert the children of a node to an HTML string. | ||||||||||||||||
mixed | getExtensionData (string $key, $defaultValue=null) | |||||||||||||||
Get "extension data" associate with this node, using the given $key. | ||||||||||||||||
setExtensionData (string $key, $value) | ||||||||||||||||
Set "extension data" associate with this node, using the given $key. | ||||||||||||||||
Public Member Functions inherited from Wikimedia::IDLeDOM::EventTarget | ||||||||||||||||
void | addEventListener (string $type, $callback, $options=null) | |||||||||||||||
void | removeEventListener (string $type, $callback, $options=null) | |||||||||||||||
bool | dispatchEvent ( $event) | |||||||||||||||
Public Member Functions inherited from Wikimedia::IDLeDOM::Node | ||||||||||||||||
string | getBaseURI () | |||||||||||||||
Public Member Functions inherited from Wikimedia::IDLeDOM::Element | ||||||||||||||||
string | getId () | |||||||||||||||
setId (string $val) | ||||||||||||||||
string | getClassName () | |||||||||||||||
setClassName (string $val) | ||||||||||||||||
setClassList (string $val) | ||||||||||||||||
string | getSlot () | |||||||||||||||
setSlot (string $val) | ||||||||||||||||
ShadowRoot | attachShadow ( $init) | |||||||||||||||
ShadowRoot null | getShadowRoot () | |||||||||||||||
Wikimedia IDLeDOM Element null | insertAdjacentElement (string $where, $element) | |||||||||||||||
void | insertAdjacentText (string $where, string $data) | |||||||||||||||
setOuterHTML (?string $val) | ||||||||||||||||
void | insertAdjacentHTML (string $position, string $text) | |||||||||||||||
void | setIdAttributeNode ( $attr, bool $isId) | |||||||||||||||
void | setIdAttributeNS (string $namespace, string $qualifiedName, bool $isId) | |||||||||||||||
Public Member Functions inherited from Wikimedia::IDLeDOM::ChildNode | ||||||||||||||||
void | before (... $nodes) | |||||||||||||||
void | after (... $nodes) | |||||||||||||||
void | replaceWith (... $nodes) | |||||||||||||||
void | remove () | |||||||||||||||
Public Member Functions inherited from Wikimedia::IDLeDOM::InnerHTML | ||||||||||||||||
setInnerHTML (?string $val) | ||||||||||||||||
Public Member Functions inherited from Wikimedia::IDLeDOM::NonDocumentTypeChildNode | ||||||||||||||||
Element null | getPreviousElementSibling () | |||||||||||||||
Element null | getNextElementSibling () | |||||||||||||||
Public Member Functions inherited from Wikimedia::IDLeDOM::ParentNode | ||||||||||||||||
HTMLCollection | getChildren () | |||||||||||||||
Element null | getFirstElementChild () | |||||||||||||||
Element null | getLastElementChild () | |||||||||||||||
int | getChildElementCount () | |||||||||||||||
void | prepend (... $nodes) | |||||||||||||||
void | append (... $nodes) | |||||||||||||||
void | replaceChildren (... $nodes) | |||||||||||||||
Element null | querySelector (string $selectors) | |||||||||||||||
NodeList | querySelectorAll (string $selectors) | |||||||||||||||
Public Member Functions inherited from Wikimedia::IDLeDOM::Slottable | ||||||||||||||||
HTMLSlotElement null | getAssignedSlot () | |||||||||||||||
Public Attributes | |
NamedNodeMap | $_attributes = null |
Attribute storage; null if no attributes. | |
Public Attributes inherited from Wikimedia\Dodo\ContainerNode | |
Node NodeList null | $_firstChildOrChildren |
The first child (if we're using the linked list representation), or a NodeList (if we're using the array of children), or null (if there are no children). | |
Public Attributes inherited from Wikimedia\Dodo\Node | |
Document | $_nodeDocument |
The document this node is associated to. | |
Node null | $_parentNode |
should be considered read-only | |
Node | $_nextSibling |
The sibling list is stored as a circular linked list: the node "before" the first sibling is the last sibling, and the node "after" the last sibling is the first sibling. | |
Node | $_previousSibling |
int | $_documentIndex = null |
DEVELOPERS NOTE: An index is assigned when a node is added to a Document (becomes rooted). | |
int | $_cachedSiblingIndex = null |
DEVELOPERS NOTE: An index is assigned on INSERTION. | |
Static Public Attributes | |
static array< string, callable > null | $_attributeChangeHandlers = null |
A registry of handlers for changes to specific attributes. | |
Protected Member Functions | ||||
_setMissingProp (string $prop, $value) | ||||
Implement _setMissingProp to allow $_classList to be a dynamic property. | ||||
Element | _subclassCloneNodeShallow () | |||
bool | _subclassIsEqualNode (Node $node) | |||
Delegated subclass method called by Node::isEqualNode()
| ||||
Protected Member Functions inherited from Wikimedia\Dodo\Node | ||||
_getMissingProp (string $name) | ||||
static callable(Element,?string,?string)(string $localName) void Wikimedia\Dodo\Element::__construct | ( | Document | $nodeDocument, |
string | $lname, | ||
?string | $ns, | ||
?string | $prefix = null ) |
Fetch the appropriate attribute change handler for a change to the attribute named $localName
.
string | $localName |
Document | $nodeDocument | |
string | $lname | |
?string | $ns | |
?string | $prefix |
array< Element > Wikimedia\Dodo\Element::_getElementsById | ( | string | $id | ) |
This is a non-standard Dodo extension that interfaces with the Zest CSS selector library to allow quick lookup by ID even if there are multiple nodes in the document with the same ID.
string | $id |
bool Wikimedia\Dodo\Element::_isHTMLElement | ( | ) |
Calls isHTMLDocument() on ownerDocument.
Return the next element, in source order, after this one or null if there are no more.
If root element is specified, then don't traverse beyond its subtree.
This is not a DOM method, but is convenient for lazy traversals of the tree.
?Element | $root |
Wikimedia\Dodo\Element::_setAttribute | ( | string | $qname, |
string | $value ) |
Internal version of ::setAttribute() which bypasses checks and lowercasing; used by Remex when tree building.
string | $qname | |
string | $value |
Wikimedia\Dodo\Element::_setAttributeNS | ( | ?string | $ns, |
?string | $prefix, | ||
string | $lname, | ||
string | $value ) |
Internal version of ::setAttributeNS which bypasses checks and prefix parsing; used by Remex when tree building.
?string | $ns | |
?string | $prefix | |
string | $lname | |
string | $value |
|
protected |
Implement _setMissingProp to allow $_classList to be a dynamic property.
Very few instances of Element will need to allocate this property.
string | $prop | the name of the property requested |
mixed | $value | the value to set |
Reimplemented from Wikimedia\Dodo\Node.
|
protected |
Reimplemented from Wikimedia\Dodo\Node.
|
protected |
Delegated subclass method called by Node::isEqualNode()
Node | $node |
Reimplemented from Wikimedia\Dodo\Node.
Wikimedia\Dodo\Element::_xmlSerialize | ( | ?string | $namespace, |
NamespacePrefixMap | $prefixMap, | ||
int & | $prefixIndex, | ||
array | $options, | ||
array & | $markup ) |
XML serialize the given node.This is overridden in subclasses. Note that this is effectively "outerHTML", due to a spec inconsistency: https://github.com/w3c/DOM-Parsing/issues/28 .
?string | $namespace | |
NamespacePrefixMap | $prefixMap | |
int | &$prefixIndex | |
array | $options | |
string[] | &$markup | accumulator for the result |
Reimplemented from Wikimedia\Dodo\Node.
Element Wikimedia\Dodo\Element::closest | ( | string | $selectors | ) |
string Wikimedia\Dodo\Element::getAttribute | ( | string | $qname | ) |
Fetch the value of an attribute with the given qualified name.
string | $qname | The attribute's qualifiedName |
Implements Wikimedia::IDLeDOM::Element.
array Wikimedia\Dodo\Element::getAttributeNames | ( | ) |
Fetch the qualified names of all attributes on this Element.
spec DOM-LS
NOTE The names are not guaranteed to be unique.
Implements Wikimedia::IDLeDOM::Element.
Attr Wikimedia\Dodo\Element::getAttributeNode | ( | string | $qname | ) |
Fetch the Attr node with the given qualifiedName.
spec DOM-LS
string | $qname | The attribute's qualified name |
Implements Wikimedia::IDLeDOM::Element.
Attr Wikimedia\Dodo\Element::getAttributeNodeNS | ( | ?string | $ns, |
string | $lname ) |
Fetch the Attr node with the given namespace and localName.
spec DOM-LS
?string | $ns | The attribute's local name |
string | $lname | The attribute's local name |
Implements Wikimedia::IDLeDOM::Element.
string Wikimedia\Dodo\Element::getAttributeNS | ( | ?string | $ns, |
string | $lname ) |
Fetch value of attribute with the given namespace and localName.
spec DOM-LS
?string | $ns | The attribute's namespace |
string | $lname | The attribute's local name |
Implements Wikimedia::IDLeDOM::Element.
NamedNodeMap Wikimedia\Dodo\Element::getAttributes | ( | ) |
Implements Wikimedia::IDLeDOM::Element.
mixed null Wikimedia\Dodo\Element::getClassList | ( | ) |
Implements Wikimedia::IDLeDOM::Element.
HTMLCollection Wikimedia\Dodo\Element::getElementsByClassName | ( | string | $names | ) |
HTMLCollection Wikimedia\Dodo\Element::getElementsByTagName | ( | string | $lname | ) |
static callable(Element)(string $lname) static callable(Element)(string $lname) HTMLCollection Wikimedia\Dodo\Element::getElementsByTagNameNS | ( | ?string | $ns, |
string | $lname ) |
string | $lname |
string | $lname |
string | null | $ns | |
string | $lname |
Implements Wikimedia::IDLeDOM::Element.
string Wikimedia\Dodo\Element::getInnerHTML | ( | ) |
Implements Wikimedia::IDLeDOM::InnerHTML.
string Wikimedia\Dodo\Element::getLocalName | ( | ) |
Implements Wikimedia::IDLeDOM::Element.
string Wikimedia\Dodo\Element::getNamespaceURI | ( | ) |
Implements Wikimedia::IDLeDOM::Element.
|
final |
|
final |
string Wikimedia\Dodo\Element::getOuterHTML | ( | ) |
Implements Wikimedia::IDLeDOM::Element.
string Wikimedia\Dodo\Element::getPrefix | ( | ) |
Implements Wikimedia::IDLeDOM::Element.
|
final |
Implements Wikimedia::IDLeDOM::Element.
bool Wikimedia\Dodo\Element::hasAttribute | ( | string | $qname | ) |
Test Element for attribute with the given qualified name.
spec DOM-LS
string | $qname | Qualified name of attribute |
Implements Wikimedia::IDLeDOM::Element.
bool Wikimedia\Dodo\Element::hasAttributeNS | ( | ?string | $ns, |
string | $lname ) |
Test Element for attribute with the given namespace and localName.
spec DOM-LS
?string | $ns | the namespace |
string | $lname | the localName |
Implements Wikimedia::IDLeDOM::Element.
bool Wikimedia\Dodo\Element::hasAttributes | ( | ) |
Test whether this Element has any attributes.
spec DOM-LS
Implements Wikimedia::IDLeDOM::Element.
bool Wikimedia\Dodo\Element::matches | ( | string | $selectors | ) |
Wikimedia\Dodo\Element::removeAttribute | ( | string | $qname | ) |
Remove the first attribute given a particular qualifiedName.
spec DOM-LS
string | $qname |
Implements Wikimedia::IDLeDOM::Element.
Attr Wikimedia\Dodo\Element::removeAttributeNode | ( | $attr | ) |
Remove the given attribute node from this Element.
spec DOM-LS
Implements Wikimedia::IDLeDOM::Element.
Wikimedia\Dodo\Element::removeAttributeNS | ( | ?string | $ns, |
string | $lname ) |
Remove attribute given a particular namespace and localName.
spec DOM-LS
Implements Wikimedia::IDLeDOM::Element.
Wikimedia\Dodo\Element::setAttribute | ( | string | $qname, |
string | $value ) |
Set the value of first attribute with a particular qualifiedName.
spec DOM-LS
NOTES Per spec, $value is not a string, but the string value of whatever is passed.
TODO: DRY with this and setAttributeNS?
Implements Wikimedia::IDLeDOM::Element.
Attr Wikimedia\Dodo\Element::setAttributeNode | ( | $attr | ) |
Add an Attr node to an Element node.
Implements Wikimedia::IDLeDOM::Element.
Attr Wikimedia\Dodo\Element::setAttributeNodeNS | ( | $attr | ) |
Add a namespace-aware Attr node to an Element node.
IAttr | $attr |
Implements Wikimedia::IDLeDOM::Element.
Wikimedia\Dodo\Element::setAttributeNS | ( | ?string | $ns, |
string | $qname, | ||
string | $value ) |
Set value of attribute with a particular namespace and localName.
spec DOM-LS
NOTES Per spec, $value is not a string, but the string value of whatever is passed.
Implements Wikimedia::IDLeDOM::Element.
Wikimedia\Dodo\Element::setIdAttribute | ( | string | $qualifiedName, |
bool | $isId ) |
Implements Wikimedia::IDLeDOM::Element.
bool Wikimedia\Dodo\Element::toggleAttribute | ( | string | $qname, |
?bool | $force = null ) |
Toggle the first attribute with the given qualified name.
spec DOM-LS
string | $qname | qualified name |
bool | null | $force | whether to set if no attribute exists |
Implements Wikimedia::IDLeDOM::Element.
bool Wikimedia\Dodo\Element::webkitMatchesSelector | ( | string | $selectors | ) |