]> git.kaiwu.me - njs.git/commit
XML: create text nodes before mutation
authorDmitry Volyntsev <xeioex@nginx.com>
Thu, 10 Sep 2026 00:04:47 +0000 (17:04 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Fri, 11 Sep 2026 01:29:10 +0000 (18:29 -0700)
commitd7bff7e0ac1926c9140135e24af2485236beb98f
tree6850ab75fdf118635ce771fc410214b3f38e3f2a
parentc837f4c511c014131dd47626c59231cbd6b7910b
XML: create text nodes before mutation

Previously, text updates encoded content manually and then passed it to
libxml2. This duplicated libxml2 escaping rules and allocated the
encoded buffer before creating the text node.

The fix is to create a libxml2 text node from the unencoded value before
replacing the copied node's children. libxml2 now owns escaping, and a
failure leaves the original XML tree unchanged.
external/njs_xml_module.c
external/qjs_xml_module.c
test/xml/xml.t.mjs