Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TreeWalker when the root element is a TextNode #286

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

kasperskei
Copy link
Contributor

@kasperskei kasperskei commented Sep 17, 2024

Fixes #285

@@ -42,7 +42,7 @@ export class TreeWalker {
end = documentElement[END];
}
const nodes = [];
while (next !== end) {
while (next !== end && next != null) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternative option

Suggested change
while (next !== end && next != null) {
while (next !== end && next.nodeType !== NODE_END) {

@@ -43,7 +43,7 @@ class TreeWalker {
end = documentElement[END];
}
const nodes = [];
while (next !== end) {
while (next !== end && next != null) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while (next && next !== end) maybe?

@WebReflection
Copy link
Owner

I think worker.js is an artifact so there's no point in providing a diff of such artifact but then again, all looks good and the change feels minimal enough. Let CI provide its results and I'll merge this.

@WebReflection WebReflection merged commit 73ee30a into WebReflection:main Sep 17, 2024
2 checks passed
@WebReflection
Copy link
Owner

Up and running 👋

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TreeWalker doesn't work when the root element is a TextNode
2 participants