Allow selectors to work with unknown tags

See https://godoc.org/golang.org/x/net/html#Node for more information
pull/107/head
Andre Marianiello 5 years ago
parent 8f884ca28a
commit f811b2e55a

@ -272,7 +272,7 @@ func jsonify(node *html.Node) map[string]interface{} {
} }
} }
} }
vals["tag"] = node.DataAtom.String() vals["tag"] = node.Data
children := []interface{}{} children := []interface{}{}
for child := node.FirstChild; child != nil; child = child.NextSibling { for child := node.FirstChild; child != nil; child = child.NextSibling {
switch child.Type { switch child.Type {

@ -86,7 +86,7 @@ func (s CSSSelector) Match(node *html.Node) bool {
return false return false
} }
if s.Tag != "" { if s.Tag != "" {
if s.Tag != node.DataAtom.String() { if s.Tag != node.Data {
return false return false
} }
} }

Loading…
Cancel
Save