LibWeb: Make Node::is_text() return true for CDATASection nodes

CDATASection inherits from Text, and so it was incorrect for them to
claim not to be Text nodes.

This fixes at least two WPT subtests. :^)

It also exposed a bug in the DOM Parsing and Serialization spec,
where we're not told how to serialize CDATASection nodes.

Spec bug: https://github.com/w3c/DOM-Parsing/issues/38
This commit is contained in:
Andreas Kling 2024-11-19 15:35:31 +01:00 committed by Tim Ledbetter
commit 6ffc7ea36d
Notes: github-actions[bot] 2024-11-19 19:25:35 +00:00
5 changed files with 2545 additions and 7 deletions

View file

@ -110,7 +110,7 @@ public:
NodeType type() const { return m_type; }
bool is_element() const { return type() == NodeType::ELEMENT_NODE; }
bool is_text() const { return type() == NodeType::TEXT_NODE; }
bool is_text() const { return type() == NodeType::TEXT_NODE || type() == NodeType::CDATA_SECTION_NODE; }
bool is_document() const { return type() == NodeType::DOCUMENT_NODE; }
bool is_document_type() const { return type() == NodeType::DOCUMENT_TYPE_NODE; }
bool is_comment() const { return type() == NodeType::COMMENT_NODE; }