Skip to content

Commit 12790b2

Browse files
authored
Extend C14N fast path to HTML documents too (#12293)
1 parent 96a3088 commit 12790b2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ext/dom/node.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1798,7 +1798,8 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{
17981798

17991799
bool simple_node_parent_lookup_callback = false;
18001800
if (xpath_array == NULL) {
1801-
if (nodep->type != XML_DOCUMENT_NODE) {
1801+
/* Optimization: if the node is a document, all nodes may be included, no extra filtering or nodeset necessary. */
1802+
if (nodep->type != XML_DOCUMENT_NODE && nodep->type != XML_HTML_DOCUMENT_NODE) {
18021803
simple_node_parent_lookup_callback = true;
18031804
}
18041805
} else {

0 commit comments

Comments
 (0)