1
0
mirror of https://github.com/ericchiang/pup synced 2025-03-19 16:06:04 +00:00

Allow selectors to work with unknown tags

See https://godoc.org/golang.org/x/net/html#Node for more information
This commit is contained in:
Andre Marianiello 2019-02-23 14:48:31 -05:00
parent 8f884ca28a
commit f811b2e55a
2 changed files with 2 additions and 2 deletions

View File

@ -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 {

View File

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