mirror of
https://github.com/ericchiang/pup
synced 2025-03-22 01:15:42 +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:
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…
Reference in New Issue
Block a user