Skip to content

Commit

Permalink
fix antchfx/htmlquery#52 Skip the current node(Self:false) for the ne…
Browse files Browse the repository at this point in the history
…xt descendants nodes.
  • Loading branch information
zhengchun committed Sep 19, 2022
1 parent dfece7e commit ba368a6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion build.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ func (b *builder) processAxisNode(root *axisNode) (query, error) {
}
return v
}
qyOutput = &descendantQuery{Input: qyGrandInput, Predicate: filter, Self: true}
// fix `//*[contains(@id,"food")]//*[contains(@id,"food")]`, see https://github.com/antchfx/htmlquery/issues/52
// Skip the current node(Self:false) for the next descendants nodes.
_, ok := qyGrandInput.(*contextQuery)
qyOutput = &descendantQuery{Input: qyGrandInput, Predicate: filter, Self: ok}
return qyOutput, nil
}
}
Expand Down

0 comments on commit ba368a6

Please sign in to comment.