diff options
author | Andrew Dolgov <[email protected]> | 2022-07-16 16:30:46 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2022-07-16 16:30:46 +0300 |
commit | b8c1d622a77226b14fb307cfe3e0f4cea9e4268a (patch) | |
tree | 3df519798dcfef20c96a079e0956ebcd5509b619 /plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMElement.php | |
parent | fdd1c43612011060b4b876db438eb7ec62dd077d (diff) |
add missing files for forked idiorm
Diffstat (limited to 'plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMElement.php')
-rw-r--r-- | plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMElement.php | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMElement.php b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMElement.php index c07670bf7..b0da84fb9 100644 --- a/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMElement.php +++ b/plugins/af_readability/vendor/fivefilters/readability.php/src/Nodes/DOM/DOMElement.php @@ -1,10 +1,46 @@ <?php -namespace andreskrey\Readability\Nodes\DOM; +namespace fivefilters\Readability\Nodes\DOM; -use andreskrey\Readability\Nodes\NodeTrait; +use fivefilters\Readability\Nodes\NodeTrait; class DOMElement extends \DOMElement { use NodeTrait; + + /** + * Returns the child elements of this element. + * + * To get all child nodes, including non-element nodes like text and comment nodes, use childNodes. + * + * @return DOMNodeList + */ + public function children() + { + $newList = new DOMNodeList(); + foreach ($this->childNodes as $node) { + if ($node->nodeType === XML_ELEMENT_NODE) { + $newList->add($node); + } + } + return $newList; + } + + /** + * Returns the Element immediately prior to the specified one in its parent's children list, or null if the specified element is the first one in the list. + * + * @see https://wiki.php.net/rfc/dom_living_standard_api + * @return DOMElement|null + */ + public function previousElementSibling() + { + $previous = $this->previousSibling; + while ($previous) { + if ($previous->nodeType === XML_ELEMENT_NODE) { + return $previous; + } + $previous = $previous->previousSibling; + } + return null; + } } |