Dodo
DOm DOcument implementation
|
The Document class. More...
Public Member Functions | ||||||||||||||||
__construct (string $version="1.0", string $encoding="") | ||||||||||||||||
These constructor arguments are not given by the DOM spec, but are instead chosen to match the PHP constructor arguments for compatibility with the DOM extension. | ||||||||||||||||
_setOrigin (?Document $originDoc) | ||||||||||||||||
_setContentType (string $contentType, bool $isHtml) | ||||||||||||||||
_setURL (?string $url) | ||||||||||||||||
Document | _getTemplateDoc () | |||||||||||||||
The children of a <template> element aren't part of the element's node document; instead they are children of an "associated inert
template document". This creates that "inert template document". | ||||||||||||||||
_setQuirksMode (string $mode) | ||||||||||||||||
Used by a callback in the HTML Parser (RemexHtml) to force quirks mode depending on the value of the DOCTYPE token. | ||||||||||||||||
int | getNodeType () | |||||||||||||||
string | getNodeName () | |||||||||||||||
string | getCharacterSet () | |||||||||||||||
DOMTokenList. \IDLeDOM\Document::getCharacterSet() | ||||||||||||||||
string | getCharset () | |||||||||||||||
string | getInputEncoding () | |||||||||||||||
string | getEncoding () | |||||||||||||||
setEncoding (string $encoding) | ||||||||||||||||
DOMImplementation | getImplementation () | |||||||||||||||
string | getDocumentURI () | |||||||||||||||
string | getURL () | |||||||||||||||
string | getCompatMode () | |||||||||||||||
string | getContentType () | |||||||||||||||
DocumentType | getDoctype () | |||||||||||||||
Element | getDocumentElement () | |||||||||||||||
Document | getOwnerDocument () | |||||||||||||||
The ownerDocument getter steps are to return null, if this is a document; otherwise this’s node document.We will override this implementation to return null in the Document class. | ||||||||||||||||
string | getTitle () | |||||||||||||||
setTitle (string $val) | ||||||||||||||||
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!).
| ||||||||||||||||
Text | createTextNode (string $data) | |||||||||||||||
CDATASection | createCDATASection (string $data) | |||||||||||||||
Comment | createComment (string $data) | |||||||||||||||
createDocumentFragment () | ||||||||||||||||
createProcessingInstruction (string $target, string $data) | ||||||||||||||||
createAttribute (string $localName) | ||||||||||||||||
createAttributeNS (?string $ns, string $qname) | ||||||||||||||||
createElement (string $lname, $options=null) | ||||||||||||||||
createElementNS (?string $ns, string $qname, $options=null) | ||||||||||||||||
Element | _createElementNS (string $lname, ?string $ns, ?string $prefix) | |||||||||||||||
This function is used directly by HTML parser, which allows it to create elements with localNames containing ':' and non-default namespaces. | ||||||||||||||||
Range | createRange () | |||||||||||||||
NodeIterator | createNodeIterator ( $root, int $whatToShow=NodeFilter::SHOW_ALL, $filter=null) | |||||||||||||||
_attachNodeIterator (NodeIterator $ni) | ||||||||||||||||
Add a node iterator to the list of NodeIterators associated with this Document. | ||||||||||||||||
_detachNodeIterator (NodeIterator $ni) | ||||||||||||||||
Remove a node iterator from the list of NodeIterators associated with this Document. | ||||||||||||||||
_preremoveNodeIterators (Node $toBeRemoved) | ||||||||||||||||
Run preremove steps on all NodeIterators associated with this document. | ||||||||||||||||
adoptNode ( $node) | ||||||||||||||||
Adopt the subtree rooted at Node into this Document. | ||||||||||||||||
Node | importNode ( $node, bool $deep=false) | |||||||||||||||
Clone and then adopt either $node or, if $deep === true, the entire subtree rooted at $node, into the Document. | ||||||||||||||||
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 | _unsafeAppendChild (Node $node) | |||||||||||||||
Does not check for insertion validity.This out-performs PHP DOMDocument by over 2x.
| ||||||||||||||||
Node | replaceChild ( $node, $child) | |||||||||||||||
Node | removeChild ( $child) | |||||||||||||||
Document | cloneNode (bool $deep=false) | |||||||||||||||
Clone this Document, import nodes, and call __update_document_state. | ||||||||||||||||
getElementById (string $id) | ||||||||||||||||
Fetch an Element in this Document with a given ID value. | ||||||||||||||||
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. | ||||||||||||||||
FakeElement | _fakeElement () | |||||||||||||||
A number of methods of Document act as if the Document were an Element. | ||||||||||||||||
HTMLCollection | getElementsByTagName (string $lname) | |||||||||||||||
HTMLCollection | getElementsByTagNameNS (?string $ns, string $lname) | |||||||||||||||
HTMLCollection | getElementsByClassName (string $names) | |||||||||||||||
string | getInnerHTML () | |||||||||||||||
string | getOuterHTML () | |||||||||||||||
bool | _isHTMLDocument () | |||||||||||||||
Return true if this document is an HTML document, otherwise it is an XML document and will return false. | ||||||||||||||||
_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 bool | saveXML ( $node=null, int $options=0) | |||||||||||||||
Creates an XML document from the DOM representation. | ||||||||||||||||
bool | loadXML (string $source, int $options=0) | |||||||||||||||
Loads an XML document from a string. | ||||||||||||||||
bool | loadHTML (string $source, int $options=0) | |||||||||||||||
string bool | saveHTML ( $node=null) | |||||||||||||||
Dumps the internal document into a string using HTML formatting. | ||||||||||||||||
HTMLElement null | getBody () | |||||||||||||||
HTMLHeadElement null | getHead () | |||||||||||||||
_mutateValue (Node $node) | ||||||||||||||||
Implementation-specific function. | ||||||||||||||||
_mutateAttr (Attr $attr, ?string $oldval) | ||||||||||||||||
Invoked when an attribute's value changes. | ||||||||||||||||
_mutateRemoveAttr (Attr $attr) | ||||||||||||||||
Used by removeAttribute and removeAttributeNS for attributes. | ||||||||||||||||
_mutateRemove (Node $node) | ||||||||||||||||
Called by Node.removeChild, etc. | ||||||||||||||||
_mutateInsert (Node $node) | ||||||||||||||||
Called when a new element becomes rooted. | ||||||||||||||||
_mutateMove (Node $node) | ||||||||||||||||
Called when a rooted element is moved within the document. | ||||||||||||||||
_addToIdTable (string $id, Element $elt) | ||||||||||||||||
_removeFromIdTable (string $id, Element $elt) | ||||||||||||||||
![]() | ||||||||||||||||
__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 | getNodeValue () | |||||||||||||||
Return the value for this node. | ||||||||||||||||
setNodeValue (?string $val) | ||||||||||||||||
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) | ||||||||||||||||
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. | ||||||||||||||||
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. | ||||||||||||||||
![]() | ||||||||||||||||
void | addEventListener (string $type, $callback, $options=null) | |||||||||||||||
void | removeEventListener (string $type, $callback, $options=null) | |||||||||||||||
bool | dispatchEvent ( $event) | |||||||||||||||
![]() | ||||||||||||||||
string | getBaseURI () | |||||||||||||||
![]() | ||||||||||||||||
Event | createEvent (string $interface) | |||||||||||||||
TreeWalker | createTreeWalker ( $root, int $whatToShow=-1, $filter=null) | |||||||||||||||
Location null | getLocation () | |||||||||||||||
setLocation (string $val) | ||||||||||||||||
string | getReferrer () | |||||||||||||||
string | getCookie () | |||||||||||||||
setCookie (string $val) | ||||||||||||||||
string | getLastModified () | |||||||||||||||
string | getDir () | |||||||||||||||
setDir (string $val) | ||||||||||||||||
setBody ( $val) | ||||||||||||||||
HTMLCollection | getImages () | |||||||||||||||
HTMLCollection | getEmbeds () | |||||||||||||||
HTMLCollection | getPlugins () | |||||||||||||||
HTMLCollection | getLinks () | |||||||||||||||
HTMLCollection | getForms () | |||||||||||||||
HTMLCollection | getScripts () | |||||||||||||||
NodeList | getElementsByName (string $elementName) | |||||||||||||||
HTMLScriptElement null | getCurrentScript () | |||||||||||||||
Wikimedia IDLeDOM Document | open (string $type='text/html', string $replace='') | |||||||||||||||
void | close () | |||||||||||||||
void | write (string ... $text) | |||||||||||||||
void | writeln (string ... $text) | |||||||||||||||
bool | hasFocus () | |||||||||||||||
EventHandlerNonNull callable null | getOnreadystatechange () | |||||||||||||||
setOnreadystatechange ( $val) | ||||||||||||||||
HTMLCollection | getAnchors () | |||||||||||||||
HTMLCollection | getApplets () | |||||||||||||||
void | clear () | |||||||||||||||
void | captureEvents () | |||||||||||||||
void | releaseEvents () | |||||||||||||||
bool | getHidden () | |||||||||||||||
string | getVisibilityState () | |||||||||||||||
EventHandlerNonNull callable null | getOnvisibilitychange () | |||||||||||||||
setOnvisibilitychange ( $val) | ||||||||||||||||
bool | getPreserveWhiteSpace () | |||||||||||||||
setPreserveWhiteSpace (bool $val) | ||||||||||||||||
bool | getFormatOutput () | |||||||||||||||
setFormatOutput (bool $val) | ||||||||||||||||
bool | getValidateOnParse () | |||||||||||||||
setValidateOnParse (bool $val) | ||||||||||||||||
bool | getStrictErrorChecking () | |||||||||||||||
setStrictErrorChecking (bool $val) | ||||||||||||||||
![]() | ||||||||||||||||
StyleSheetList | getStyleSheets () | |||||||||||||||
![]() | ||||||||||||||||
EventHandlerNonNull callable null | getOnload () | |||||||||||||||
setOnload ( $val) | ||||||||||||||||
![]() | ||||||||||||||||
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) | |||||||||||||||
![]() | ||||||||||||||||
XPathExpression | createExpression (string $expression, $resolver=null) | |||||||||||||||
XPathNSResolver callable | createNSResolver ( $nodeResolver) | |||||||||||||||
XPathResult | evaluate (string $expression, $contextNode, $resolver=null, int $type=0, $result=null) | |||||||||||||||
Public Attributes | |
int | $_modclock = 0 |
This property holds a monotonically increasing value akin to a timestamp used to record the last modification time of nodes and their subtrees. | |
DocumentType | $_doctype = null |
Reference to the first DocumentType child, in document order. | |
Element | $_documentElement = null |
Reference to the first Element child, in document order. | |
DOMImplementation | $_implementation |
The DOMImplementation associated with this Document. | |
string | $_readyState |
![]() | |
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). | |
![]() | |
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 Member Functions | |
mixed | _getMissingProp (string $name) |
Document | _subclassCloneNodeShallow () |
Delegated method called by Node::cloneNode() Performs the shallow clone branch. | |
bool | _subclassIsEqualNode (Node $other=null) |
Delegated method called by Node::isEqualNode() | |
![]() | |
_setMissingProp (string $name, $value) | |
Protected Attributes | |
$_contentType = 'application/xml' | |
The Document class.
The HTML specification extends this class with a number of additional methods for Documents which contain HTML. We use "document type" to distinguish between XML documents and HTML documents.
Each document has an associated encoding (an encoding), content type (a string), URL (a URL), origin (an origin), type ("xml" or "html"), and mode ("no-quirks", "quirks", or "limited-quirks").
Unless stated otherwise, a document’s encoding is the utf-8 encoding, content type is "application/xml", URL is "about:blank", origin is an opaque origin, type is "xml", and its mode is "no-quirks".
A document is said to be an XML document if its type is "xml", and an HTML document otherwise. Whether a document is an HTML document or an XML document affects the behavior of certain APIs.
A document is said to be in no-quirks mode if its mode is "no-quirks", quirks mode if its mode is "quirks", and limited-quirks mode if its mode is "limited-quirks".
Wikimedia\Dodo\Document::__construct | ( | string | $version = "1.0", |
string | $encoding = "" ) |
These constructor arguments are not given by the DOM spec, but are instead chosen to match the PHP constructor arguments for compatibility with the DOM extension.
string | $version | The version number of the document as part of the XML declaration. |
string | $encoding | The encoding of the document as part of the XML declaration. |
Wikimedia\Dodo\Document::_addToIdTable | ( | string | $id, |
Element | $elt ) |
string | $id | |
Element | $elt |
Wikimedia\Dodo\Document::_attachNodeIterator | ( | NodeIterator | $ni | ) |
Add a node iterator to the list of NodeIterators associated with this Document.
NodeIterator | $ni |
Element Wikimedia\Dodo\Document::_createElementNS | ( | string | $lname, |
?string | $ns, | ||
?string | $prefix ) |
This function is used directly by HTML parser, which allows it to create elements with localNames containing ':' and non-default namespaces.
string | $lname | |
?string | $ns | |
?string | $prefix |
Wikimedia\Dodo\Document::_detachNodeIterator | ( | NodeIterator | $ni | ) |
Remove a node iterator from the list of NodeIterators associated with this Document.
NodeIterator | $ni |
FakeElement Wikimedia\Dodo\Document::_fakeElement | ( | ) |
A number of methods of Document act as if the Document were an Element.
Return a fake element class to make these work.
array< Element > Wikimedia\Dodo\Document::_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 |
|
protected |
Document Wikimedia\Dodo\Document::_getTemplateDoc | ( | ) |
The children of a <template> element aren't part of the element's node document; instead they are children of an "associated inert template document". This creates that "inert template document".
bool Wikimedia\Dodo\Document::_isHTMLDocument | ( | ) |
Return true if this document is an HTML document, otherwise it is an XML document and will return false.
Wikimedia\Dodo\Document::_mutateAttr | ( | Attr | $attr, |
?string | $oldval ) |
Invoked when an attribute's value changes.
Attr holds the new value. oldval is the old value. Attribute mutations can also involve changes to the prefix (and therefore the qualified name)
Attr | $attr | |
?string | $oldval |
Wikimedia\Dodo\Document::_mutateInsert | ( | Node | $node | ) |
Called when a new element becomes rooted.
It must recursively generate mutation events for each of the children, and mark them all as rooted.
Called in Node::_insertOrReplace.
Node | $node |
Wikimedia\Dodo\Document::_mutateMove | ( | Node | $node | ) |
Called when a rooted element is moved within the document.
Node | $node |
Wikimedia\Dodo\Document::_mutateRemove | ( | Node | $node | ) |
Called by Node.removeChild, etc.
to remove a rooted element from the tree. Only needs to generate a single mutation event when a node is removed, but must recursively mark all descendants as not rooted.
Node | $node |
Wikimedia\Dodo\Document::_mutateRemoveAttr | ( | Attr | $attr | ) |
Used by removeAttribute and removeAttributeNS for attributes.
Attr | $attr |
Wikimedia\Dodo\Document::_mutateValue | ( | Node | $node | ) |
Implementation-specific function.
Called when a text, comment, or pi value changes.
Node | $node |
Wikimedia\Dodo\Document::_preremoveNodeIterators | ( | Node | $toBeRemoved | ) |
Run preremove steps on all NodeIterators associated with this document.
Node | $toBeRemoved | the Node about to be removed |
Wikimedia\Dodo\Document::_removeFromIdTable | ( | string | $id, |
Element | $elt ) |
string | $id | |
Element | $elt |
Wikimedia\Dodo\Document::_setContentType | ( | string | $contentType, |
bool | $isHtml ) |
string | $contentType | |
bool | $isHtml | Whether this is to be an "HTML document" |
Wikimedia\Dodo\Document::_setOrigin | ( | ?Document | $originDoc | ) |
?Document | $originDoc |
Wikimedia\Dodo\Document::_setQuirksMode | ( | string | $mode | ) |
Used by a callback in the HTML Parser (RemexHtml) to force quirks mode depending on the value of the DOCTYPE token.
string | $mode |
Wikimedia\Dodo\Document::_setURL | ( | ?string | $url | ) |
?string | $url |
|
protected |
Delegated method called by Node::cloneNode() Performs the shallow clone branch.
spec Dodo
Reimplemented from Wikimedia\Dodo\Node.
|
protected |
Delegated method called by Node::isEqualNode()
spec DOM-LS
NOTE: Any two Documents are shallowly equal, since equality is determined by their children; this will be tested by Node::isEqualNode(), so just return true.
Node | null | $other | to compare |
Reimplemented from Wikimedia\Dodo\Node.
Does not check for insertion validity.This out-performs PHP DOMDocument by over 2x.
Node | $node |
Reimplemented from Wikimedia\Dodo\Node.
Wikimedia\Dodo\Document::_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.
Wikimedia\Dodo\Document::adoptNode | ( | $node | ) |
Adopt the subtree rooted at Node into this Document.
This means setting ownerDocument of each node in the subtree to point to $this.
No insertion is performed, but if Node is inserted into another Document, it will be removed.
Implements Wikimedia::IDLeDOM::Document.
Document Wikimedia\Dodo\Document::cloneNode | ( | bool | $deep = false | ) |
Clone this Document, import nodes, and call __update_document_state.
extends Node::cloneNode() spec DOM-LS
NOTE:
bool | $deep | if true, clone entire document |
Reimplemented from Wikimedia\Dodo\Node.
Wikimedia\Dodo\Document::createAttribute | ( | string | $localName | ) |
Implements Wikimedia::IDLeDOM::Document.
Wikimedia\Dodo\Document::createAttributeNS | ( | ?string | $ns, |
string | $qname ) |
Implements Wikimedia::IDLeDOM::Document.
CDATASection Wikimedia\Dodo\Document::createCDATASection | ( | string | $data | ) |
Implements Wikimedia::IDLeDOM::Document.
Comment Wikimedia\Dodo\Document::createComment | ( | string | $data | ) |
Implements Wikimedia::IDLeDOM::Document.
Wikimedia\Dodo\Document::createDocumentFragment | ( | ) |
Implements Wikimedia::IDLeDOM::Document.
Wikimedia\Dodo\Document::createElement | ( | string | $lname, |
$options = null ) |
Implements Wikimedia::IDLeDOM::Document.
Wikimedia\Dodo\Document::createElementNS | ( | ?string | $ns, |
string | $qname, | ||
$options = null ) |
Implements Wikimedia::IDLeDOM::Document.
NodeIterator Wikimedia\Dodo\Document::createNodeIterator | ( | $root, | |
int | $whatToShow = NodeFilter::SHOW_ALL, | ||
$filter = null ) |
\Wikimedia\IDLeDOM\Node | $root | |
int | $whatToShow | |
\Wikimedia\IDLeDOM\NodeFilter | callable | null | $filter |
Implements Wikimedia::IDLeDOM::Document.
Wikimedia\Dodo\Document::createProcessingInstruction | ( | string | $target, |
string | $data ) |
Implements Wikimedia::IDLeDOM::Document.
Range Wikimedia\Dodo\Document::createRange | ( | ) |
Implements Wikimedia::IDLeDOM::Document.
Text Wikimedia\Dodo\Document::createTextNode | ( | string | $data | ) |
Implements Wikimedia::IDLeDOM::Document.
HTMLElement null Wikimedia\Dodo\Document::getBody | ( | ) |
Implements Wikimedia::IDLeDOM::Document.
string Wikimedia\Dodo\Document::getCharacterSet | ( | ) |
DOMTokenList. \IDLeDOM\Document::getCharacterSet()
Note that duplicates are permitted!
Implements Wikimedia::IDLeDOM::Document.
string Wikimedia\Dodo\Document::getCharset | ( | ) |
Implements Wikimedia::IDLeDOM::Document.
string Wikimedia\Dodo\Document::getCompatMode | ( | ) |
Implements Wikimedia::IDLeDOM::Document.
string Wikimedia\Dodo\Document::getContentType | ( | ) |
Implements Wikimedia::IDLeDOM::Document.
DocumentType Wikimedia\Dodo\Document::getDoctype | ( | ) |
Implements Wikimedia::IDLeDOM::Document.
Element Wikimedia\Dodo\Document::getDocumentElement | ( | ) |
Implements Wikimedia::IDLeDOM::Document.
string Wikimedia\Dodo\Document::getDocumentURI | ( | ) |
Implements Wikimedia::IDLeDOM::Document.
Wikimedia\Dodo\Document::getElementById | ( | string | $id | ) |
Fetch an Element in this Document with a given ID value.
spec DOM-LS
NOTE In the spec, this is actually the sole method of the NonElementParentNode mixin.
Implements Wikimedia::IDLeDOM::NonElementParentNode.
HTMLCollection Wikimedia\Dodo\Document::getElementsByClassName | ( | string | $names | ) |
HTMLCollection Wikimedia\Dodo\Document::getElementsByTagName | ( | string | $lname | ) |
HTMLCollection Wikimedia\Dodo\Document::getElementsByTagNameNS | ( | ?string | $ns, |
string | $lname ) |
string | null | $ns | |
string | $lname |
Implements Wikimedia::IDLeDOM::Document.
string Wikimedia\Dodo\Document::getEncoding | ( | ) |
Implements Wikimedia::IDLeDOM::Document.
HTMLHeadElement null Wikimedia\Dodo\Document::getHead | ( | ) |
Implements Wikimedia::IDLeDOM::Document.
DOMImplementation Wikimedia\Dodo\Document::getImplementation | ( | ) |
Implements Wikimedia::IDLeDOM::Document.
string Wikimedia\Dodo\Document::getInnerHTML | ( | ) |
string Wikimedia\Dodo\Document::getInputEncoding | ( | ) |
Implements Wikimedia::IDLeDOM::Document.
|
final |
int Wikimedia\Dodo\Document::getNodeType | ( | ) |
string Wikimedia\Dodo\Document::getOuterHTML | ( | ) |
Document Wikimedia\Dodo\Document::getOwnerDocument | ( | ) |
The ownerDocument getter steps are to return null, if this is a document; otherwise this’s node document.We will override this implementation to return null in the Document class.
Reimplemented from Wikimedia\Dodo\Node.
string Wikimedia\Dodo\Document::getTextContent | ( | ) |
Generic implementation of getTextContent to be used by Element and DocumentFragment (but not Document!).
Reimplemented from Wikimedia\Dodo\ContainerNode.
string Wikimedia\Dodo\Document::getTitle | ( | ) |
Implements Wikimedia::IDLeDOM::Document.
string Wikimedia\Dodo\Document::getURL | ( | ) |
Node Wikimedia\Dodo\Document::importNode | ( | $node, | |
bool | $deep = false ) |
Clone and then adopt either $node or, if $deep === true, the entire subtree rooted at $node, into the Document.
By default, only $node will be cloned.
Implements Wikimedia::IDLeDOM::Document.
Node Wikimedia\Dodo\Document::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:
INode | $node | To be inserted |
?INode | $refNode | Child of this node before which to insert $node |
DOMException | "HierarchyRequestError" or "NotFoundError" |
Reimplemented from Wikimedia\Dodo\Node.
bool Wikimedia\Dodo\Document::loadHTML | ( | string | $source, |
int | $options = 0 ) |
string | $source | The HTML string |
int | $options | Additional libxml parameters |
true
on success or false
on failure Implements Wikimedia::IDLeDOM::Document.
bool Wikimedia\Dodo\Document::loadXML | ( | string | $source, |
int | $options = 0 ) |
Loads an XML document from a string.
Non-standard: PHP extension.
string | $source | The string containing the XML. |
int | $options | Bitwise OR of the libxml option constants. |
true
on success or false
on failure. Implements Wikimedia::IDLeDOM::Document.
Node Wikimedia\Dodo\Document::removeChild | ( | $child | ) |
Reimplemented from Wikimedia\Dodo\Node.
Node Wikimedia\Dodo\Document::replaceChild | ( | $node, | |
$child ) |
Reimplemented from Wikimedia\Dodo\Node.
string bool Wikimedia\Dodo\Document::saveHTML | ( | $node = null | ) |
Dumps the internal document into a string using HTML formatting.
Node | null | $node | Optional parameter to output a subset of the document |
false
if an error occurred Implements Wikimedia::IDLeDOM::Document.
string bool Wikimedia\Dodo\Document::saveXML | ( | $node = null, | |
int | $options = 0 ) |
Creates an XML document from the DOM representation.
Non-standard: PHP extension.
Node | null | $node | Output only a specific node rather than the entire document. |
int | $options | Additional options. Only LIBXML_NOEMPTYTAG is supported. |
false
if an error occurred. Implements Wikimedia::IDLeDOM::Document.
Wikimedia\Dodo\Document::setEncoding | ( | string | $encoding | ) |
string | $encoding |
Implements Wikimedia::IDLeDOM::Document.
Wikimedia\Dodo\Document::setTextContent | ( | ?string | $value | ) |
Generic implementation of setTextContent to be used by Element and DocumentFragment (but not Document!).
?string | $value |
Reimplemented from Wikimedia\Dodo\ContainerNode.
Wikimedia\Dodo\Document::setTitle | ( | string | $val | ) |
string | $val |
Implements Wikimedia::IDLeDOM::Document.
DocumentType Wikimedia\Dodo\Document::$_doctype = null |
Reference to the first DocumentType child, in document order.
Null if no such child exists.
Element Wikimedia\Dodo\Document::$_documentElement = null |
Reference to the first Element child, in document order.
Null if no such child exists.
int Wikimedia\Dodo\Document::$_modclock = 0 |
This property holds a monotonically increasing value akin to a timestamp used to record the last modification time of nodes and their subtrees.
See the lastModTime attribute and modify() method of the Node class. And see FilteredElementList for an example of the use of lastModTime.