[pdm-devel] [PATCH yew-comp] sanitize html: don't fail on html comments

Dominik Csapak d.csapak at proxmox.com
Tue Dec 2 11:34:40 CET 2025


html comments are type '8' [0], so instead of failing when encountering
them, just ignore them.

0: https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/sanitize_html.rs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/sanitize_html.rs b/src/sanitize_html.rs
index 35277c9..ff058c7 100644
--- a/src/sanitize_html.rs
+++ b/src/sanitize_html.rs
@@ -27,6 +27,7 @@ fn sanitize_html_element(node: &web_sys::Node, base_url: &str) -> Result<(), Err
     let node_type = node.node_type();
 
     match node_type {
+        8 => Ok(()), /* HTML Comment Node */
         3 => Ok(()), /* Text Node */
         1 => {
             /*  Element Node */
-- 
2.47.3





More information about the pdm-devel mailing list