Dodo
DOm DOcument implementation
|
The ContainerNode class defines common functionality for node subtypes that can have children. More...
Public Member Functions | |
__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 | |
int | getNodeType () |
Return the node type enumeration for this node. | |
string | getNodeName () |
Return the nodeName for this 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. | |
_xmlSerialize (?string $namespace, NamespacePrefixMap $prefixMap, int &$prefixIndex, array $options, array &$markup) | |
XML serialize the given node. | |
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 Attributes | |
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. | |
Additional Inherited Members | |
Protected Member Functions inherited from Wikimedia\Dodo\Node | |
bool | _subclassIsEqualNode (Node $node) |
Delegated subclass method called by Node::isEqualNode() | |
Node | _subclassCloneNodeShallow () |
Delegated subclass method called by Node::cloneNode() | |
_setMissingProp (string $name, $value) | |
_getMissingProp (string $name) | |
The ContainerNode class defines common functionality for node subtypes that can have children.
We factor this out so that leaf nodes can save the space required to maintain the list of children. There are a lot of leaf nodes in a document, so this space can add up.
The list of children is kept primarily as a circular linked list of siblings. We fail over to an array of children (which makes insertion and removal much more expensive) only when required.
Wikimedia\Dodo\ContainerNode::__construct | ( | Document | $nodeDocument | ) |
Document | $nodeDocument |
Reimplemented from Wikimedia\Dodo\Node.
Reimplemented in Wikimedia\Dodo\DocumentFragment.
bool Wikimedia\Dodo\ContainerNode::_empty | ( | ) |
Reimplemented from Wikimedia\Dodo\Node.
int Wikimedia\Dodo\ContainerNode::_length | ( | ) |
Reimplemented from Wikimedia\Dodo\Node.
NodeList Wikimedia\Dodo\ContainerNode::getChildNodes | ( | ) |
Keeping child nodes as an array makes insertion/removal of nodes quite expensive.
So we try never to create this array, if possible. If someone actually fetches the childNodes list we lazily create it. It then has to be live, and so we must update it whenever nodes are appended or removed.
This should be overridden in ContainerNode and Leaf.
Reimplemented from Wikimedia\Dodo\Node.
Node Wikimedia\Dodo\ContainerNode::getFirstChild | ( | ) |
Be careful to use this method in most cases rather than directly accessing _firstChildOrChildren
.
This should be overridden in ContainerNode and Leaf.
Reimplemented from Wikimedia\Dodo\Node.
Node Wikimedia\Dodo\ContainerNode::getLastChild | ( | ) |
This should be overridden in ContainerNode and Leaf.
Reimplemented from Wikimedia\Dodo\Node.
string Wikimedia\Dodo\ContainerNode::getTextContent | ( | ) |
Generic implementation of ::getTextContent to be used by Element and DocumentFragment (but not Document!).
Reimplemented from Wikimedia\Dodo\Node.
Reimplemented in Wikimedia\Dodo\Document.
bool Wikimedia\Dodo\ContainerNode::hasChildNodes | ( | ) |
Return true iff there are children of this node.
Implements Wikimedia::IDLeDOM::Node.
Wikimedia\Dodo\ContainerNode::setTextContent | ( | ?string | $value | ) |
Generic implementation of ::setTextContent to be used by Element and DocumentFragment (but not Document!).
?string | $value |
Reimplemented from Wikimedia\Dodo\Node.
Reimplemented in Wikimedia\Dodo\Document.