Skip to content

Commit

Permalink
WIP - a comment in an idl block is real fucked up, now that I preserv…
Browse files Browse the repository at this point in the history
…e comments a little longer. childNodes() seems to treat comments wrong somehow
  • Loading branch information
tabatkins committed Dec 8, 2023
1 parent 41e24ba commit 3eeffb6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions bikeshed/h/dom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 3eeffb6

Please sign in to comment.