Skip to content

Conversation

@karlseguin
Copy link
Collaborator

In their current implementation, both the NodeIterator and TreeWalker would skip over ignored nodes. However, while the node itself should have been ignored its children should still be iterated.

For example, when going over:

<div id="container">
  <!-- comment1 -->
  <span>
    <!-- comment2 -->
  </span>
</div>

With SHOW_COMMENT, the previous version would completely skip over container and its children. Now the code still won't emit the container div itself, it will still iterate through its children (and thus emit the two comments).

This change relates to ongoing react compatibility.

In their current implementation, both the NodeIterator and TreeWalker would
skip over ignored nodes. However, while the node itself should have been ignored
its children should still be iterated.

For example, when going over:

```
<div id="container">
  <!-- comment1 -->
  <span>
    <!-- comment2 -->
  </span>
</div>
```

With `SHOW_COMMENT`, the previous version would completely skip over `container`
and its children. Now the code still won't emit the `container` div itself,
it will still iterate through its children (and thus emit the two comments).

This change relates to ongoing react compatibility.
@karlseguin karlseguin merged commit 18c851e into main Oct 15, 2025
10 checks passed
@karlseguin karlseguin deleted the iterators_and_walker_fix branch October 15, 2025 07:58
@github-actions github-actions bot locked and limited conversation to collaborators Oct 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants