Skip to content

Value() on text node is useless #20

@bterrier

Description

@bterrier

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} ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions