Dodo
DOm DOcument implementation
|
Public Member Functions | |||||||||
string | getNodeValue () | ||||||||
Return the value for this node.
| |||||||||
setNodeValue (?string $value) | |||||||||
string | getTextContent () | ||||||||
Return the textContent for this node.
| |||||||||
setTextContent (?string $value) | |||||||||
string | substringData (int $offset, int $count) | ||||||||
DOMString substringData(unsigned long offset, unsigned long count);. | |||||||||
appendData (string $data) | |||||||||
void appendData(DOMString data); | |||||||||
insertData (int $offset, string $data) | |||||||||
void insertData(unsigned long offset, DOMString data); | |||||||||
deleteData (int $offset, int $count) | |||||||||
void deleteData(unsigned long offset, unsigned long count); | |||||||||
replaceData (int $offset, int $count, string $data) | |||||||||
void replaceData(unsigned long offset, unsigned long count,
DOMString data); | |||||||||
int | getLength () | ||||||||
NOTE: see discussion of UTF-16 code units -vs- unicode code points in ::substringData() above. | |||||||||
string | getData () | ||||||||
setData (?string $value) | |||||||||
int | _length () | ||||||||
| |||||||||
bool | _empty () | ||||||||
| |||||||||
int | count () | ||||||||
This is a non-standard extension, but it allows count() to be used on CharacterData nodes in the same way that .length is used on them in JavaScript – and makes some of our WPT test cases pass. | |||||||||
![]() | |||||||||
bool | hasChildNodes () | ||||||||
Node | getFirstChild () | ||||||||
This should be overridden in ContainerNode and Leaf. | |||||||||
Node | getLastChild () | ||||||||
This should be overridden in ContainerNode and Leaf. | |||||||||
Node | insertBefore ( $node, $refChild=null) | ||||||||
Insert $node as a child of $this, and insert it before $refChild in the document order.spec DOM-LSTHINGS TO KNOW FROM THE SPEC:
| |||||||||
Node | replaceChild ( $node, $refChild) | ||||||||
Node | removeChild ( $node) | ||||||||
_removeChildren () | |||||||||
NodeList | getChildNodes () | ||||||||
This should be overridden in ContainerNode and Leaf. | |||||||||
![]() | |||||||||
__construct (Document $nodeDocument) | |||||||||
Create a Node whose node document is the given $nodeDocument. | |||||||||
int | getNodeType () | ||||||||
Return the node type enumeration for this node. | |||||||||
string | getNodeName () | ||||||||
Return the nodeName for this node. | |||||||||
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. | |||||||||
appendChild ( $node) | |||||||||
Node | _unsafeAppendChild (Node $node) | ||||||||
Does not check for insertion validity. | |||||||||
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. | |||||||||
![]() | |||||||||
void | addEventListener (string $type, $callback, $options=null) | ||||||||
void | removeEventListener (string $type, $callback, $options=null) | ||||||||
bool | dispatchEvent ( $event) | ||||||||
![]() | |||||||||
string | getBaseURI () | ||||||||
![]() | |||||||||
void | before (... $nodes) | ||||||||
void | after (... $nodes) | ||||||||
void | replaceWith (... $nodes) | ||||||||
void | remove () | ||||||||
![]() | |||||||||
Element null | getPreviousElementSibling () | ||||||||
Element null | getNextElementSibling () | ||||||||
Protected Member Functions | |
mixed | _getMissingProp (string $name) |
HACK! For compatibilty with W3C test suite, which assumes that an access to 'attributes' will return null. | |
_setMissingProp (string $prop, $value) | |
Implement _setMissingProp to allow $_charLength to be a dynamic property. | |
__construct (Document $nodeDocument, string $data) | |
Create a CharacterData with data (in UTF-8 encoding). | |
![]() | |
bool | _subclassIsEqualNode (Node $node) |
Delegated subclass method called by Node::isEqualNode() | |
Node | _subclassCloneNodeShallow () |
Delegated subclass method called by Node::cloneNode() | |
Protected Attributes | |
string | $_data |
Additional Inherited Members | |
![]() | |
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. | |
|
protected |
Create a CharacterData with data (in UTF-8 encoding).
Document | $nodeDocument | the owner document |
string | $data | contents, in UTF-8 encoding |
Reimplemented in Wikimedia\Dodo\Text.
bool Wikimedia\Dodo\CharacterData::_empty | ( | ) |
Reimplemented from Wikimedia\Dodo\Node.
|
protected |
HACK! For compatibilty with W3C test suite, which assumes that an access to 'attributes' will return null.
string | $name |
Reimplemented from Wikimedia\Dodo\Node.
int Wikimedia\Dodo\CharacterData::_length | ( | ) |
Reimplemented from Wikimedia\Dodo\Node.
|
protected |
Implement _setMissingProp to allow $_charLength to be a dynamic property.
Very few instances of CharacterData 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.
Wikimedia\Dodo\CharacterData::appendData | ( | string | $data | ) |
void appendData(DOMString data);
The appendData(data) method must append data to the context object's data.
PORT NOTES: Again, for the number of arguments, we can just use the function prototype to check.
string | $data |
Implements Wikimedia::IDLeDOM::CharacterData.
int Wikimedia\Dodo\CharacterData::count | ( | ) |
This is a non-standard extension, but it allows count() to be used on CharacterData nodes in the same way that .length is used on them in JavaScript – and makes some of our WPT test cases pass.
Wikimedia\Dodo\CharacterData::deleteData | ( | int | $offset, |
int | $count ) |
void deleteData(unsigned long offset, unsigned long count);
The deleteData(offset, count) method must run these steps:
If offset is greater than the context object's length <u>in code points</u>, throw an INDEX_SIZE_ERR exception and terminate these steps. If offset+count is greater than the context object's length <u>in code points</u> let count be length-offset. Starting from offset <s>UTF-16 code units</s> <u>code points</u> remove count <s>UTF-16 code units</s> <u>code points</u> from the context object's data.
NOTE: see discussion of UTF-16 code units -vs- unicode code points in ::substringData() above. Be careful!
int | $offset | |
int | $count |
Implements Wikimedia::IDLeDOM::CharacterData.
string Wikimedia\Dodo\CharacterData::getData | ( | ) |
Implements Wikimedia::IDLeDOM::CharacterData.
int Wikimedia\Dodo\CharacterData::getLength | ( | ) |
NOTE: see discussion of UTF-16 code units -vs- unicode code points in ::substringData() above.
Be careful!
Implements Wikimedia::IDLeDOM::CharacterData.
|
final |
|
final |
Wikimedia\Dodo\CharacterData::insertData | ( | int | $offset, |
string | $data ) |
void insertData(unsigned long offset, DOMString data);
The insertData(offset, data) method must run these steps:
If offset is greater than the context object's length <u>in code points</u>, throw an INDEX_SIZE_ERR exception and terminate these steps. Insert data into the context object's data after offset <s>UTF-16 code units</s> <u>code points</u>.
NOTE: see discussion of UTF-16 code units -vs- unicode code points in ::substringData() above. Be careful!
int | $offset | |
string | $data |
Implements Wikimedia::IDLeDOM::CharacterData.
Wikimedia\Dodo\CharacterData::replaceData | ( | int | $offset, |
int | $count, | ||
string | $data ) |
void replaceData(unsigned long offset, unsigned long count, DOMString data);
The replaceData(offset, count, data) method must act as if the deleteData() method is invoked with offset and count as arguments followed by the insertData() method with offset and data as arguments and re-throw any exceptions these methods might have thrown.
NOTE: see discussion of UTF-16 code units -vs- unicode code points in ::substringData() above.
int | $offset | |
int | $count | |
string | $data |
Implements Wikimedia::IDLeDOM::CharacterData.
Wikimedia\Dodo\CharacterData::setData | ( | ?string | $value | ) |
Implements Wikimedia::IDLeDOM::CharacterData.
|
final |
Reimplemented from Wikimedia\Dodo\Node.
|
final |
Reimplemented from Wikimedia\Dodo\Node.
string Wikimedia\Dodo\CharacterData::substringData | ( | int | $offset, |
int | $count ) |
DOMString substringData(unsigned long offset, unsigned long count);.
The substringData(offset, count) method must run these steps:
If offset is greater than the context object's length, throw an INDEX_SIZE_ERR exception and terminate these steps. If offset+count is greater than the context object's length, return a DOMString whose value is the <s>UTF-16 code units</s> <u>code points</u> from the offset-th <s>UTF-16 code unit</s> <u>code point</u> to the end of data. Return a DOMString whose value is the <s>UTF-16 code units</s> <u>code points</u> from the offset-th <s>UTF-16 code unit</s> <u>code point</u> to the (offset+count)-th <s>UTF-16 code unit</s> <u>code point</u> in data.
PORT NOTES: In Domino.js, checking was done to ensure $offset and $count were integers and not-undefined. Here we just use type hints.
The DOM spec requires that the offset and count be in UTF-16 units and the PHP \DOMText etc classes originally did this (and the PHP docs still say that's how things should work). In PHP 5 the implementation was changed to measure things in codepoints, so that surrogates are no longer counted. This is very sensible, so we've chosen to be compatible w/ current PHP behavior, and this incompatible with DOM spec and with PHP documentation (which doesn't match the current PHP implementation). Be careful!
int | $offset | |
int | $count |
Implements Wikimedia::IDLeDOM::CharacterData.
|
protected |