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

Value() on text node is useless #20

Open
bterrier opened this issue Nov 19, 2024 · 0 comments
Open

Value() on text node is useless #20

bterrier opened this issue Nov 19, 2024 · 0 comments

Comments

@bterrier
Copy link

Sorry for the offensive title, but I do not know how to describe it otherwise.

My issue is with this line:
Node{Data: fmt.Sprintf("%v", v), Type: TextNode, level: level, value: fmt.Sprintf("%v", v)}

the result is that on text nodes Data and Value() both contains the exact same string representation of the underlying value. Meaning that in practice when I encounter a text node, to get its value if have to do node.Parent.Value().

So why not do: Node{Data: fmt.Sprintf("%v", v), Type: TextNode, level: level, value: v} ?

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

No branches or pull requests

1 participant