Dodo
DOm DOcument implementation
Loading...
Searching...
No Matches
Wikimedia\Dodo\Internal\FakeElement Class Reference

A number of DOM algorithms on non-element types like Document and DocumentFragment are defined to return the same results as if they were called on an Element with the same children as that Document/DocumentFragment. More...

+ Inheritance diagram for Wikimedia\Dodo\Internal\FakeElement:

Public Member Functions

 __construct (Document $nodeDocument, callable $getFirstChildFunc)
 
Node getFirstChild ()
 
Element _nextElement (?Element $root)
 
- Public Member Functions inherited from Wikimedia::IDLeDOM::Element
string getNamespaceURI ()
 
string getPrefix ()
 
string getLocalName ()
 
string getTagName ()
 
string getId ()
 
 setId (string $val)
 
string getClassName ()
 
 setClassName (string $val)
 
DOMTokenList getClassList ()
 
 setClassList (string $val)
 
string getSlot ()
 
 setSlot (string $val)
 
bool hasAttributes ()
 
NamedNodeMap getAttributes ()
 
list< string > getAttributeNames ()
 
string getAttribute (string $qualifiedName)
 
string getAttributeNS (?string $namespace, string $localName)
 
void setAttribute (string $qualifiedName, string $value)
 
void setAttributeNS (?string $namespace, string $qualifiedName, string $value)
 
void removeAttribute (string $qualifiedName)
 
void removeAttributeNS (?string $namespace, string $localName)
 
bool toggleAttribute (string $qualifiedName, ?bool $force=null)
 
bool hasAttribute (string $qualifiedName)
 
bool hasAttributeNS (?string $namespace, string $localName)
 
Attr null getAttributeNode (string $qualifiedName)
 
Attr null getAttributeNodeNS (?string $namespace, string $localName)
 
Attr null setAttributeNode ( $attr)
 
Attr null setAttributeNodeNS ( $attr)
 
Attr removeAttributeNode ( $attr)
 
ShadowRoot attachShadow ( $init)
 
ShadowRoot null getShadowRoot ()
 
Wikimedia IDLeDOM Element null closest (string $selectors)
 
bool matches (string $selectors)
 
bool webkitMatchesSelector (string $selectors)
 
HTMLCollection getElementsByTagName (string $qualifiedName)
 
HTMLCollection getElementsByTagNameNS (?string $namespace, string $localName)
 
HTMLCollection getElementsByClassName (string $classNames)
 
Wikimedia IDLeDOM Element null insertAdjacentElement (string $where, $element)
 
void insertAdjacentText (string $where, string $data)
 
string getOuterHTML ()
 
 setOuterHTML (?string $val)
 
void insertAdjacentHTML (string $position, string $text)
 
void setIdAttribute (string $qualifiedName, bool $isId)
 
void setIdAttributeNode ( $attr, bool $isId)
 
void setIdAttributeNS (string $namespace, string $qualifiedName, bool $isId)
 
- Public Member Functions inherited from Wikimedia::IDLeDOM::Node
int getNodeType ()
 
string getNodeName ()
 
string getBaseURI ()
 
bool getIsConnected ()
 
Document null getOwnerDocument ()
 
Wikimedia IDLeDOM Node getRootNode ( $options=null)
 
Node null getParentNode ()
 
Element null getParentElement ()
 
bool hasChildNodes ()
 
NodeList getChildNodes ()
 
Node null getLastChild ()
 
Node null getPreviousSibling ()
 
Node null getNextSibling ()
 
string getNodeValue ()
 
 setNodeValue (?string $val)
 
string getTextContent ()
 
 setTextContent (?string $val)
 
void normalize ()
 
Wikimedia IDLeDOM Node cloneNode (bool $deep=false)
 
bool isEqualNode ( $otherNode)
 
bool isSameNode ( $otherNode)
 
int compareDocumentPosition ( $other)
 
bool contains ( $other)
 
string lookupPrefix (?string $namespace)
 
string lookupNamespaceURI (?string $prefix)
 
bool isDefaultNamespace (?string $namespace)
 
Wikimedia IDLeDOM Node insertBefore ( $node, $child=null)
 
Wikimedia IDLeDOM Node appendChild ( $node)
 
Wikimedia IDLeDOM Node replaceChild ( $node, $child)
 
Wikimedia IDLeDOM Node removeChild ( $child)
 
- 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::ChildNode
void before (... $nodes)
 
void after (... $nodes)
 
void replaceWith (... $nodes)
 
void remove ()
 
- Public Member Functions inherited from Wikimedia::IDLeDOM::InnerHTML
string getInnerHTML ()
 
 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 ()
 

Detailed Description

A number of DOM algorithms on non-element types like Document and DocumentFragment are defined to return the same results as if they were called on an Element with the same children as that Document/DocumentFragment.

In the CSS specification this is called a "virtual root".

This class allows us to reuse code in the Element class by creating a "fake element" class to serve as this virtual root. In order to remain live, the constructor takes a callback to generate to children of the virtual root on demand.

See also
https://drafts.csswg.org/selectors-4/#scoping-root

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Dodo\Internal\FakeElement::__construct ( Document $nodeDocument,
callable $getFirstChildFunc )
Parameters
Document$nodeDocument
callable():(?Node)$getFirstChildFunc

Member Function Documentation

◆ getFirstChild()

Node Wikimedia\Dodo\Internal\FakeElement::getFirstChild ( )

The documentation for this class was generated from the following file: