diff --git a/html.go b/html.go index 2320dbf..ef55e5c 100644 --- a/html.go +++ b/html.go @@ -28,6 +28,16 @@ func ParseNode(r io.Reader) (*Node, error) { return &Node{n[0]}, nil } +func NewTextNode(text string) *Node { + return &Node{ + Node: &html.Node{ + Type: html.TextNode, + DataAtom: 0x0, + Data: text, + }, + } +} + func (n *Node) QuerySelector(selector string) *Node { if strings.HasPrefix(selector, "#") { return n.GetElementById(selector[1:])