From f811b2e55a5d8c5c0fceda11dc6696039854ae40 Mon Sep 17 00:00:00 2001 From: Andre Marianiello Date: Sat, 23 Feb 2019 14:48:31 -0500 Subject: [PATCH] Allow selectors to work with unknown tags See https://godoc.org/golang.org/x/net/html#Node for more information --- display.go | 2 +- selector.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/display.go b/display.go index 0be946c..8fffd82 100644 --- a/display.go +++ b/display.go @@ -272,7 +272,7 @@ func jsonify(node *html.Node) map[string]interface{} { } } } - vals["tag"] = node.DataAtom.String() + vals["tag"] = node.Data children := []interface{}{} for child := node.FirstChild; child != nil; child = child.NextSibling { switch child.Type { diff --git a/selector.go b/selector.go index 6249f77..693430e 100644 --- a/selector.go +++ b/selector.go @@ -86,7 +86,7 @@ func (s CSSSelector) Match(node *html.Node) bool { return false } if s.Tag != "" { - if s.Tag != node.DataAtom.String() { + if s.Tag != node.Data { return false } }