tests: Fix failures due to CDATA handling in PHP

It appears PHP's DOM library always uses CDATA nodes for the contents of
<style> tags, even if there is no such markup in the source HTML.

Change-Id: Id04b27086c5e7a0b016a3a440b2b4895d6b13c93
This commit is contained in:
Bartosz Dziewoński 2020-05-13 22:26:08 +02:00 committed by Esanders
parent 33d69e26c9
commit 76289cdf73
2 changed files with 2 additions and 0 deletions

View file

@ -199,6 +199,7 @@ class DiscussionToolsCommentParser {
if (
$n && (
( $n->nodeType === XML_TEXT_NODE && $this->htmlTrim( $n->nodeValue ) !== '' ) ||
( $n->nodeType === XML_CDATA_SECTION_NODE && $this->htmlTrim( $n->nodeValue ) !== '' ) ||
( $n->nodeType === XML_ELEMENT_NODE && !$n->firstChild )
)
) {

View file

@ -634,6 +634,7 @@ function nextInterestingLeafNode( node, rootNode ) {
}
if (
( n.nodeType === Node.TEXT_NODE && htmlTrim( n.textContent ) !== '' ) ||
( n.nodeType === Node.CDATA_SECTION_NODE && htmlTrim( n.textContent ) !== '' ) ||
( n.nodeType === Node.ELEMENT_NODE && !n.firstChild )
) {
return NodeFilter.FILTER_ACCEPT;