package cascadia

Import Path
	github.com/andybalholm/cascadia (on go.dev)

Dependency Relation
	imports 7 packages, and imported by one package

Involved Source Files Package cascadia is an implementation of CSS selectors. selector.go specificity.go
Package-Level Type Names (total 20, in which 5 are exported)
/* sort exporteds by: | */
Matcher is the interface for basic selector functionality. Match returns whether a selector matches n. ( T) Match(n *html.Node) bool Sel (interface) Selector SelectorGroup func Filter(nodes []*html.Node, m Matcher) (result []*html.Node) func Query(n *html.Node, m Matcher) *html.Node func QueryAll(n *html.Node, m Matcher) []*html.Node
Sel is the interface for all the functionality provided by selectors. It is currently the same as Matcher, but other methods may be added in the future. ( T) Match(n *html.Node) bool ( T) Specificity() Specificity T : Matcher func Parse(sel string) (Sel, error)
A Selector is a function which tells whether a node matches or not. This type is maintained for compatibility; I recommend using the newer and more idiomatic interfaces Sel and Matcher. Filter returns the nodes in nodes that match the selector. Match returns true if the node matches the selector. MatchAll returns a slice of the nodes that match the selector, from n and its children. MatchFirst returns the first node that matches s, from n and its children. T : Matcher func Compile(sel string) (Selector, error) func MustCompile(sel string) Selector
A SelectorGroup is a list of selectors, which matches if any of the individual selectors matches. Match returns true if the node matches one of the single selectors. T : Matcher func ParseGroup(sel string) (SelectorGroup, error)
Specificity is the CSS specificity as defined in https://www.w3.org/TR/selectors/#specificity-rules with the convention Specificity = [A,B,C]. ( T) Add(other Specificity) Specificity returns `true` if s < other (strictly), false otherwise func Sel.Specificity() Specificity func Specificity.Add(other Specificity) Specificity func Specificity.Add(other Specificity) Specificity func Specificity.Less(other Specificity) bool
Package-Level Functions (total 31, in which 7 are exported)
Compile parses a selector and returns, if successful, a Selector object that can be used to match against html.Node objects.
Filter returns the nodes that match m.
MustCompile is like Compile, but panics instead of returning an error.
Parse parses a selector.
ParseGroup parses a selector, or a group of selectors separated by commas.
Query returns the first node that matches m, from the descendants of n. If none matches, it returns nil.
QueryAll returns a slice of all the nodes that match m, from the descendants of n.
Package-Level Variables (total 3, none are exported)