diff --git a/docs/en/030_Document_Object_Model/010_Document/index.md b/docs/en/030_Document_Object_Model/010_Document/index.md index 74afdb5..cb42a33 100644 --- a/docs/en/030_Document_Object_Model/010_Document/index.md +++ b/docs/en/030_Document_Object_Model/010_Document/index.md @@ -14,7 +14,7 @@ Represents an entire HTML document; serves as the root of the document tree. Unl
MensBeam\HTML\Document extends \DOMDocument {
- use Node, Walk;
+ use ContainerNode, Walk;
/* Constants */
public const NO_QUIRKS_MODE = 0 ;
@@ -26,28 +26,26 @@ Represents an entire HTML document; serves as the root of the document tree. Unl
public string|null $documentEncoding = null ;
public int $quirksMode = 0 ;
- /* Inherited properties from \DOMDocument */
+ /* Inherited properties */
+ public readonly \DOMNamedNodeMap|null $attributes ;
+ public readonly string|null $baseURI ;
+ public readonly \DOMNodeList $childNodes ;
public readonly DocumentType $doctype ;
public readonly Element $documentElement ;
public string|null $documentURI ;
+ public readonly \DOMNode|null $firstChild ;
public readonly \DOMImplementation $implementation ;
-
- /* Inherited properties from \DOMNode */
+ public readonly \DOMNode|null $lastChild ;
+ public readonly string $localName ;
+ public readonly string|null $namespaceURI ;
+ public readonly \DOMNode|null $nextSibling ;
public readonly string $nodeName ;
public string $nodeValue ;
public readonly int $nodeType ;
- public readonly \DOMNode|null $parentNode ;
- public readonly \DOMNodeList $childNodes ;
- public readonly \DOMNode|null $firstChild ;
- public readonly \DOMNode|null $lastChild ;
- public readonly \DOMNode|null $previousSibling ;
- public readonly \DOMNode|null $nextSibling ;
- public readonly \DOMNamedNodeMap|null $attributes ;
public readonly Document|null $ownerDocument ;
- public readonly string|null $namespaceURI ;
+ public readonly \DOMNode|null $parentNode ;
public string $prefix ;
- public readonly string $localName ;
- public readonly string|null $baseURI ;
+ public readonly \DOMNode|null $previousSibling ;
public string $textContent ;
/* Methods */
@@ -63,55 +61,50 @@ Represents an entire HTML document; serves as the root of the document tree. Unl
public validate ( ) : true
public xinclude ( null $options = null ) : false
+ /* Trait Methods */
+ public ContainerNode::appendChild ( \DOMNode $node ) : \DOMNode|false
+ public Node::C14N ( bool $exclusive = false , bool $withComments = false , null $xpath = null , null $nsPrefixes = null ) : false
+ public Node::C14NFile ( string $uri , bool $exclusive = false , bool $withComments = false , null $xpath = null , null $nsPrefixes = null ) : false
+ public ContainerNode::insertBefore ( \DOMNode $node , \DOMNode|null $child = null ) : \DOMNode|false
+ public Walk::walk ( \Closure|null $filter = null ) : \Generator
+
/* Magic Methods */
public __toString() : string
- /* Methods from Node */
- public Node::appendChild ( \DOMNode $node ) : \DOMNode|false
- public Node::C14N ( bool $exclusive = false , bool $withComments = false , null $xpath = null , null $nsPrefixes = null ) : false
- public Node::C14NFile ( string $uri , bool $exclusive = false , bool $withComments = false , null $xpath = null , null $nsPrefixes = null ) : false
- public Node::insertBefore ( \DOMNode $node , \DOMNode|null $child = null ) : \DOMNode|false
-
- /* Methods from Walk */
- public walk ( ?\Closure $filter = null ) : \Generator
-
- /* Methods inherited from \DOMDocument */
- public createAttribute ( string $localName ) : \DOMAttr|false
- public createAttributeNS ( string|null $namespace , string $qualifiedName ) : \DOMAttr|false
- public createCDATASection ( string $data ) : \DOMCdataSection|false
- public createComment ( string $data ) : Comment|false
- public createDocumentFragment ( ) : DocumentFragment|false
- public createElement ( string $localName , string $value = "" ) : Element|false
- public createElementNS ( string|null $namespace , string $qualifiedName , string $value = "" ) : Element|false
- public createProcessingInstruction ( string $target , string $data = "" ) : ProcessingInstruction|false
- public createTextNode ( string $data ) : Text|false
- public getElementById ( string $elementId ) : Element|null
- public getElementsByTagName ( string $qualifiedName ) : \DOMNodeList
- public getElementsByTagNameNS ( string $namespace , string $localName ) : \DOMNodeList
- public importNode ( \DOMNode $node , bool $deep = false ) : \DOMNode|false
- public normalizeDocument ( ) : void
- public registerNodeClass ( string $baseClass , string|null $extendedClass ) : bool
- public relaxNGValidate ( string $filename ) : bool
- public relaxNGValidateSource ( string $source ) : bool
- public saveHTML ( \DOMNode|null $node = null ) : string|false
- public schemaValidate ( string $filename , int $flags = 0 ) : bool
- public schemaValidateSource ( string $source , int $flags = 0 ) : bool
-
- /* Methods inherited from \DOMNode */
+ /* Inherited methods */
public \DOMNode::cloneNode ( bool $deep = false ) : \DOMNode|false
+ public \DOMDocument::createAttribute ( string $localName ) : \DOMAttr|false
+ public \DOMDocument::createAttributeNS ( string|null $namespace , string $qualifiedName ) : \DOMAttr|false
+ public \DOMDocument::createCDATASection ( string $data ) : \DOMCdataSection|false
+ public \DOMDocument::createComment ( string $data ) : Comment|false
+ public \DOMDocument::createDocumentFragment ( ) : DocumentFragment|false
+ public \DOMDocument::createElement ( string $localName , string $value = "" ) : Element|false
+ public \DOMDocument::createElementNS ( string|null $namespace , string $qualifiedName , string $value = "" ) : Element|false
+ public \DOMDocument::createProcessingInstruction ( string $target , string $data = "" ) : ProcessingInstruction|false
+ public \DOMDocument::createTextNode ( string $data ) : Text|false
+ public \DOMDocument::getElementById ( string $elementId ) : Element|null
+ public \DOMDocument:getElementsByTagName ( string $qualifiedName ) : \DOMNodeList
+ public getElementsByTagNameNS ( string $namespace , string $localName ) : \DOMNodeList
public \DOMNode::getLineNo ( ) : int
public \DOMNode::getNodePath ( ) : string|null
public \DOMNode::hasAttributes ( ) : bool
public \DOMNode::hasChildNodes ( ) : bool
+ public \DOMDocument::importNode ( \DOMNode $node , bool $deep = false ) : \DOMNode|false
public \DOMNode::isDefaultNamespace ( string $namespace ) : bool
public \DOMNode::isSameNode ( \DOMNode $otherNode ) : bool
public \DOMNode::isSupported ( string $feature , string $version ) : bool
public \DOMNode::lookupNamespaceUri ( string $prefix ) : string
public \DOMNode::lookupPrefix ( string $namespace ) : string|null
public \DOMNode::normalize ( ) : void
+ public \DOMDocument::normalizeDocument ( ) : void
+ public \DOMDocument::registerNodeClass ( string $baseClass , string|null $extendedClass ) : bool
+ public \DOMDocument::relaxNGValidate ( string $filename ) : bool
+ public \DOMDocument::relaxNGValidateSource ( string $source ) : bool
public \DOMNode::removeChild ( \DOMNode $child ) : \DOMNode|false
public \DOMNode::replaceChild ( \DOMNode $node , \DOMNode $child ) : \DOMNode|false
-
+ public \DOMDocument::saveHTML ( \DOMNode|null $node = null ) : string|false
+ public \DOMDocument::schemaValidate ( string $filename , int $flags = 0 ) : bool
+ public \DOMDocument::schemaValidateSource ( string $source , int $flags = 0 ) : bool
}
## Constants ##
diff --git a/docs/en/030_Document_Object_Model/020_Element/index.md b/docs/en/030_Document_Object_Model/020_Element/index.md
index 9686d81..e2056e3 100644
--- a/docs/en/030_Document_Object_Model/020_Element/index.md
+++ b/docs/en/030_Document_Object_Model/020_Element/index.md
@@ -12,9 +12,14 @@ title: Element
MensBeam\HTML\Element extends \DOMElement {
- use Moonwalk, Node, Walk;
+ use Moonwalk, ContainerNode, Walk;
- /* Inherited properties from \DOMNode */
+ /* Properties */
+ public readonly NodeList|null $classList ;
+ public string $innerHTML ;
+ public string $outerHTML ;
+
+ /* Inherited properties */
public readonly string $nodeName ;
public string $nodeValue ;
public readonly int $nodeType ;
@@ -36,44 +41,28 @@ title: Element
public getAttribute ( string $qualifiedName ) : string|null
public getAttributeNS ( string|null $namespace , string $localName ) : string|null
- /* Magic Methods */
- public __toString() : string
-
- /* Methods from Moonwalk */
- public moonwalk ( ?\Closure $filter = null ) : \Generator
-
- /* Methods from Node */
- public Node::appendChild ( \DOMNode $node ) : \DOMNode|false
+ /* Trait Methods */
+ public ContainerNode::appendChild ( \DOMNode $node ) : \DOMNode|false
public Node::C14N ( bool $exclusive = false , bool $withComments = false , null $xpath = null , null $nsPrefixes = null ) : false
public Node::C14NFile ( string $uri , bool $exclusive = false , bool $withComments = false , null $xpath = null , null $nsPrefixes = null ) : false
- public Node::insertBefore ( \DOMNode $node , \DOMNode|null $child = null ) : \DOMNode|false
+ public ContainerNode::insertBefore ( \DOMNode $node , \DOMNode|null $child = null ) : \DOMNode|false
+ public Moonwalk::moonwalk ( \Closure|null $filter = null ) : \Generator
+ public Walk::walk ( \Closure|null $filter = null ) : \Generator
- /* Methods from Walk */
- public walk ( ?\Closure $filter = null ) : \Generator
+ /* Magic Methods */
+ public __toString() : string
- /* Methods inherited from \DOMElement */
+ /* Inherited Methods */
public __construct ( string $qualifiedName , string|null $value = null , string $namespace = "" )
- public getAttributeNode ( string $qualifiedName ) : \DOMAttr|false
- public getAttributeNodeNS ( string|null $namespace , string $localName ) : \DOMAttr|null
- public getElementsByTagName ( string $qualifiedName ) : \DOMNodeList
- public getElementsByTagNameNS ( string $namespace , string $localName ) : \DOMNodeList
- public hasAttribute ( string $qualifiedName ) : bool
- public hasAttributeNS ( string|null $namespace , string $localName ) : bool
- public removeAttribute ( string $qualifiedName ) : bool
- public removeAttributeNode ( \DOMAttr $attr ) : \DOMAttr|false
- public removeAttributeNS ( string|null $namespace , string $localName ) : void
- public setAttribute ( string $qualifiedName , string $value ) : \DOMAttr|bool
- public setAttributeNode ( \DOMAttr $attr ) : \DOMAttr|null|false
- public setAttributeNodeNS ( \DOMAttr $attr ) : \DOMAttr|null|false
- public setAttributeNS ( string|null $namespace , string $qualifiedName , string $value ) : void
- public setIdAttribute ( string $qualifiedName , bool $isId ) : void
- public setIdAttributeNode ( \DOMAttr $attr , bool $isId ) : void
- public setIdAttributeNS ( string $namespace , string $qualifiedName , bool $isId ) : void
-
- /* Methods inherited from \DOMNode */
public \DOMNode::cloneNode ( bool $deep = false ) : \DOMNode|false
+ public \DOMElement::getAttributeNode ( string $qualifiedName ) : \DOMAttr|false
+ public \DOMElement::getAttributeNodeNS ( string|null $namespace , string $localName ) : \DOMAttr|null
+ public \DOMElement::getElementsByTagName ( string $qualifiedName ) : \DOMNodeList
+ public \DOMElement::getElementsByTagNameNS ( string $namespace , string $localName ) : \DOMNodeList
public \DOMNode::getLineNo ( ) : int
public \DOMNode::getNodePath ( ) : string|null
+ public \DOMElement::hasAttribute ( string $qualifiedName ) : bool
+ public \DOMElement::hasAttributeNS ( string|null $namespace , string $localName ) : bool
public \DOMNode::hasAttributes ( ) : bool
public \DOMNode::hasChildNodes ( ) : bool
public \DOMNode::isDefaultNamespace ( string $namespace ) : bool
@@ -82,7 +71,30 @@ title: Element
public \DOMNode::lookupNamespaceUri ( string $prefix ) : string
public \DOMNode::lookupPrefix ( string $namespace ) : string|null
public \DOMNode::normalize ( ) : void
+ public \DOMElement::removeAttribute ( string $qualifiedName ) : bool
+ public \DOMElement::removeAttributeNode ( \DOMAttr $attr ) : \DOMAttr|false
+ public \DOMElement::removeAttributeNS ( string|null $namespace , string $localName ) : void
+ public \DOMElement::setAttribute ( string $qualifiedName , string $value ) : \DOMAttr|bool
public \DOMNode::removeChild ( \DOMNode $child ) : \DOMNode|false
public \DOMNode::replaceChild ( \DOMNode $node , \DOMNode $child ) : \DOMNode|false
+ public \DOMElement::setAttributeNode ( \DOMAttr $attr ) : \DOMAttr|null|false
+ public \DOMElement::setAttributeNodeNS ( \DOMAttr $attr ) : \DOMAttr|null|false
+ public \DOMElement::setAttributeNS ( string|null $namespace , string $qualifiedName , string $value ) : void
+ public \DOMElement::setIdAttribute ( string $qualifiedName , bool $isId ) : void
+ public \DOMElement::setIdAttributeNode ( \DOMAttr $attr , bool $isId ) : void
+ public \DOMElement::setIdAttributeNS ( string $namespace , string $qualifiedName , bool $isId ) : void
+
+}
+
+## Properties ##
+
+trait MensBeam\HTML\ContainerNode {
+
+ use Node;
+
+ public appendChild ( \DOMNode $node ) : \DOMNode|false
+ public insertBefore ( \DOMNode $node , \DOMNode|null $child = null ) : \DOMNode|false
+
+}
\ No newline at end of file
diff --git a/docs/en/030_Document_Object_Model/LeafNode/010_appendChild.md b/docs/en/030_Document_Object_Model/LeafNode/010_appendChild.md
new file mode 100644
index 0000000..67b4625
--- /dev/null
+++ b/docs/en/030_Document_Object_Model/LeafNode/010_appendChild.md
@@ -0,0 +1,13 @@
+---
+title: LeafNode::appendChild
+---
+
+LeafNode::appendChild — **DISABLED**
+
+## Description ##
+
+```php
+public LeafNode::appendChild ( \DOMNode $node ) : DOMException
+```
+
+Throws a `DOMException` upon use.
\ No newline at end of file
diff --git a/docs/en/030_Document_Object_Model/LeafNode/010_insertBefore.md b/docs/en/030_Document_Object_Model/LeafNode/010_insertBefore.md
new file mode 100644
index 0000000..8d0f802
--- /dev/null
+++ b/docs/en/030_Document_Object_Model/LeafNode/010_insertBefore.md
@@ -0,0 +1,13 @@
+---
+title: LeafNode::insertBefore
+---
+
+LeafNode::insertBefore — **DISABLED**
+
+## Description ##
+
+```php
+public LeafNode::insertBefore ( \DOMNode $node , \DOMNode|null $child = null ) : DOMException
+```
+
+Throws a `DOMException` upon use.
\ No newline at end of file
diff --git a/docs/en/030_Document_Object_Model/LeafNode/010_removeChild.md b/docs/en/030_Document_Object_Model/LeafNode/010_removeChild.md
new file mode 100644
index 0000000..86fe255
--- /dev/null
+++ b/docs/en/030_Document_Object_Model/LeafNode/010_removeChild.md
@@ -0,0 +1,13 @@
+---
+title: LeafNode::removeChild
+---
+
+LeafNode::removeChild — **DISABLED**
+
+## Description ##
+
+```php
+public LeafNode::removeChild ( \DOMNode $node ) : DOMException
+```
+
+Throws a `DOMException` upon use.
\ No newline at end of file
diff --git a/docs/en/030_Document_Object_Model/LeafNode/010_replaceChild.md b/docs/en/030_Document_Object_Model/LeafNode/010_replaceChild.md
new file mode 100644
index 0000000..968b58e
--- /dev/null
+++ b/docs/en/030_Document_Object_Model/LeafNode/010_replaceChild.md
@@ -0,0 +1,13 @@
+---
+title: LeafNode::replaceChild
+---
+
+LeafNode::replaceChild — **DISABLED**
+
+## Description ##
+
+```php
+public LeafNode::replaceChild ( \DOMNode $node , \DOMNode $child ) : DOMException
+```
+
+Throws a `DOMException` upon use.
\ No newline at end of file
diff --git a/docs/en/030_Document_Object_Model/LeafNode/index.md b/docs/en/030_Document_Object_Model/LeafNode/index.md
new file mode 100644
index 0000000..1c84993
--- /dev/null
+++ b/docs/en/030_Document_Object_Model/LeafNode/index.md
@@ -0,0 +1,16 @@
+# The LeafNode trait #
+
+## Introduction ##
+
+Allows the extended PHP DOM classes to simulate inheriting from a theoretical extended [\DOMNode](https://www.php.net/manual/en/class.domnode.php). This one disables all DOM child insertion methods.
+
+trait MensBeam\HTML\LeafNode {
+
+ use Node;
+
+ public appendChild ( \DOMNode $node ) : DOMException
+ public insertBefore ( \DOMNode $node , \DOMNode|null $child = null ) : DOMException
+ public removeChild ( \DOMNode $child ) : DOMException
+ public replaceChild ( \DOMNode $node, \DOMNode $child ) : DOMException
+
+}
\ No newline at end of file
diff --git a/docs/en/030_Document_Object_Model/Moonwalk/010_moonwalk.md b/docs/en/030_Document_Object_Model/Moonwalk/010_moonwalk.md
index 592d564..3896311 100644
--- a/docs/en/030_Document_Object_Model/Moonwalk/010_moonwalk.md
+++ b/docs/en/030_Document_Object_Model/Moonwalk/010_moonwalk.md
@@ -6,9 +6,8 @@ Moonwalk::moonwalk — Output generator for walking up the DOM tree
## Description ##
-```php
-public Moonwalk::moonwalk ( \Closure $filter ) : \Generator
-```
+public Moonwalk::moonwalk ( \Closure|null $filter = null ) : \Generator
+
Non-standard. Creates a [`\Generator`](https://www.php.net/manual/en/class.generator.php) object for walking up the DOM tree. This is in lieu of recreating the awful [DOM TreeWalker API](https://developer.mozilla.org/en-US/docs/Web/API/Treewalker).
diff --git a/docs/en/030_Document_Object_Model/Node/index.md b/docs/en/030_Document_Object_Model/Node/index.md
index ce47916..0489d67 100644
--- a/docs/en/030_Document_Object_Model/Node/index.md
+++ b/docs/en/030_Document_Object_Model/Node/index.md
@@ -2,13 +2,11 @@
## Introduction ##
-Allows the extended PHP DOM classes to simulate inheriting from a theoretical extended [\DOMNode](https://www.php.net/manual/en/class.domnode.php).
+Allows the extended PHP DOM classes to simulate inheriting from a theoretical extended [\DOMNode](https://www.php.net/manual/en/class.domnode.php). It is used to disable [C14N](C14N.html) and [C14NFile](C14NFile.html).
trait MensBeam\HTML\Node {
- public appendChild ( \DOMNode $node ) : \DOMNode|false
public C14N ( bool $exclusive = false , bool $withComments = false , null $xpath = null , null $nsPrefixes = null ) : false
public C14NFile ( string $uri , bool $exclusive = false , bool $withComments = false , null $xpath = null , null $nsPrefixes = null ) : false
- public insertBefore ( \DOMNode $node , \DOMNode|null $child = null ) : \DOMNode|false
}
\ No newline at end of file
diff --git a/docs/en/030_Document_Object_Model/Walk/010_walk.md b/docs/en/030_Document_Object_Model/Walk/010_walk.md
index 3f5a2ea..ddcf37e 100644
--- a/docs/en/030_Document_Object_Model/Walk/010_walk.md
+++ b/docs/en/030_Document_Object_Model/Walk/010_walk.md
@@ -6,9 +6,8 @@ Walk::walk — Output generator for walking down the DOM tree
## Description ##
-```php
-public Walk::walk ( \Closure $filter ) : \Generator
-```
+public Walk::walk ( \Closure|null $filter = null ) : \Generator
+
Non-standard. Creates a [`\Generator`](https://www.php.net/manual/en/class.generator.php) object for walking down the DOM tree. This is in lieu of recreating the awful [DOM TreeWalker API](https://developer.mozilla.org/en-US/docs/Web/API/Treewalker).
diff --git a/lib/DOM/traits/ContainerNode.php b/lib/DOM/traits/ContainerNode.php
index 6ebf942..2d786c3 100644
--- a/lib/DOM/traits/ContainerNode.php
+++ b/lib/DOM/traits/ContainerNode.php
@@ -8,7 +8,7 @@ namespace MensBeam\HTML;
// Node in the DOM spec is dirty. Many nodes which inherit from it inherit
// methods it cannot use which all check for this and throw exceptions. This is
-// for nodes which do have node insertion methods.
+// for nodes which DO have child nodes.
trait ContainerNode {
use Node;
diff --git a/lib/DOM/traits/LeafNode.php b/lib/DOM/traits/LeafNode.php
index 03ad37e..0294864 100644
--- a/lib/DOM/traits/LeafNode.php
+++ b/lib/DOM/traits/LeafNode.php
@@ -8,7 +8,7 @@ namespace MensBeam\HTML;
// Node in the DOM spec is dirty. Many nodes which inherit from it inherit
// methods it cannot use which all check for this and throw exceptions. This is
-// for nodes which do NOT have node insertion methods.
+// for nodes which DO NOT have child nodes.
trait LeafNode {
use Node;