cascadia

package module
v0.0.0-...-54abbbf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2015 License: BSD-2-Clause Imports: 7 Imported by: 0

README

The Cascadia package implements CSS selectors for use with the parse trees produced by the html package.

Documentation

Overview

The cascadia package is an implementation of CSS selectors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Selector

type Selector func(*html.Node) bool

A Selector is a function which tells whether a node matches or not.

func Compile

func Compile(sel string) (Selector, error)

Compile parses a selector and returns, if successful, a Selector object that can be used to match against html.Node objects.

func MustCompile

func MustCompile(sel string) Selector

MustCompile is like Compile, but panics instead of returning an error.

func (Selector) Filter

func (s Selector) Filter(nodes []*html.Node) (result []*html.Node)

Filter returns the nodes in nodes that match the selector.

func (Selector) Match

func (s Selector) Match(n *html.Node) bool

Match returns true if the node matches the selector.

func (Selector) MatchAll

func (s Selector) MatchAll(n *html.Node) []*html.Node

MatchAll returns a slice of the nodes that match the selector, from n and its children.

func (Selector) MatchFirst

func (s Selector) MatchFirst(n *html.Node) *html.Node

MatchFirst returns the first node that matches s, from n and its children.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL