From 3eeffb645d5ee168ecbac5664f4f2589718b714b Mon Sep 17 00:00:00 2001 From: Tab Atkins-Bittner Date: Thu, 7 Dec 2023 16:28:17 -0800 Subject: [PATCH] WIP - a comment in an idl block is real fucked up, now that I preserve comments a little longer. childNodes() seems to treat comments wrong somehow --- bikeshed/h/dom.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bikeshed/h/dom.py b/bikeshed/h/dom.py index a59ab83473..c2475b5348 100644 --- a/bikeshed/h/dom.py +++ b/bikeshed/h/dom.py @@ -129,12 +129,14 @@ def textContent(el: t.ElementT, exact: bool = False) -> str: def textContentIgnoringDecorative(el: t.ElementT) -> str: - str = el.text or "" - for child in childElements(el): - if child.get("data-deco") is None: - str += textContentIgnoringDecorative(child) - str += child.tail or "" - return str + s = el.text or "" + for child in childNodes(el): + if isinstance(child, str): + s += child + elif child.get("data-deco") is None: + s += textContentIgnoringDecorative(child) + print(repr(s)) + return s def innerHTML(el: t.ElementT | None) -> str: