-
-
Notifications
You must be signed in to change notification settings - Fork 155
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
Implement Inspect protocol for HTMLTree #547
Implement Inspect protocol for HTMLTree #547
Conversation
c0c20d1
to
ce4cf2f
Compare
f849b0b
to
3a0eb98
Compare
5109def
to
43b7829
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great! 🎉
I added some refactoring suggestions :)
test/floki/html_tree_test.exs
Outdated
html_tree = %HTMLTree{ | ||
root_nodes_ids: [2, 1], | ||
node_ids: [2, 1], | ||
nodes: %{ | ||
1 => %Text{content: "hello", node_id: 1}, | ||
2 => %Text{content: " world", node_id: 2} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After thinking for a while, I believe the parser won't produce such tree, because the Text
would be collapsed. So I would change this to one
Text` node, or maybe adding a tag in between.
test/floki/html_tree_test.exs
Outdated
} | ||
|
||
assert inspect(html_tree) == | ||
~s|%HTMLTree{<html>start of the stack<a class="link"><b>click me</b></a><span></span></html>}| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We forgot to format the comment. The suggestions I made is changing that. But the output here will be different.
PS: try to add a |> dbg()
to line 292 and see the beauty of the output :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!! :D
Thank you! 💜
No description provided.