package cascadia

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

Dependency Relation
	imports 8 packages, and imported by one package

Involved Source Files Package cascadia is an implementation of CSS selectors. pseudo_classes.go selector.go serialize.go specificity.go
Package-Level Type Names (total 5)
/* sort by: | */
Matcher is the interface for basic selector functionality. Match returns whether a selector matches n. ( Matcher) Match(n *html.Node) bool Sel (interface) Selector SelectorGroup github.com/PuerkitoBio/goquery.Matcher (interface) 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. ( Sel) Match(n *html.Node) bool Returns a pseudo-element, or an empty string. ( Sel) Specificity() Specificity Returns a CSS input compiling to this selector. Sel : Matcher Sel : expvar.Var Sel : fmt.Stringer func Parse(sel string) (Sel, error) func ParseWithPseudoElement(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. Selector : Matcher Selector : github.com/PuerkitoBio/goquery.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. ( SelectorGroup) String() string SelectorGroup : Matcher SelectorGroup : expvar.Var SelectorGroup : fmt.Stringer func ParseGroup(sel string) (SelectorGroup, error) func ParseGroupWithPseudoElements(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]. ( Specificity) 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 9)
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. Use `ParseWithPseudoElement` if you need support for pseudo-elements.
ParseGroup parses a selector, or a group of selectors separated by commas. Use `ParseGroupWithPseudoElements` if you need support for pseudo-elements.
ParseGroupWithPseudoElements parses a selector, or a group of selectors separated by commas. It supports pseudo-elements.
ParseWithPseudoElement parses a single selector, with support for pseudo-element.
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.