Documentation ¶
Overview ¶
Package xhtml makes x/net/html easier
Index ¶
- Variables
- func AdoptChildren(dst, src *html.Node)
- func All(n *html.Node) iter.Seq[*html.Node]
- func AppendText(n *html.Node, text string)
- func Attr(n *html.Node, name string) string
- func ChildNodes(n *html.Node) iter.Seq[*html.Node]
- func Clone(n *html.Node) *html.Node
- func Closest(n *html.Node, match func(*html.Node) bool) *html.Node
- func DeleteAttr(n *html.Node, key string)
- func InnerHTML(n *html.Node) string
- func InnerHTMLBlocks(n *html.Node) string
- func IsBalanced(s string) bool
- func LastChildOrNew(p *html.Node, tag string, attrs ...string) *html.Node
- func Map[T any](tbl TableNodes, f func(*html.Node) T) [][]T
- func New(tag string, attrs ...string) *html.Node
- func OuterHTML(n *html.Node) string
- func Parents(n *html.Node) iter.Seq[*html.Node]
- func RemoveAll(nodes []*html.Node)
- func ReplaceWith(old, new *html.Node)
- func Select(n *html.Node, match func(*html.Node) bool) *html.Node
- func SelectAll(n *html.Node, match func(*html.Node) bool) iter.Seq[*html.Node]
- func SelectSlice(n *html.Node, match func(*html.Node) bool) []*html.Node
- func SetAttr(n *html.Node, key, value string)
- func SetInnerHTML(n *html.Node, s string) error
- func Tables(root *html.Node) iter.Seq2[*html.Node, TableNodes]
- func TextContent(n *html.Node) string
- func ToBuffer(n *html.Node) *bytes.Buffer
- func UnnestChildren(n *html.Node)
- func WithAtom(a atom.Atom) func(n *html.Node) bool
- type TableNodes
Constants ¶
This section is empty.
Variables ¶
View Source
var WithBody = WithAtom(atom.Body)
Functions ¶
func AdoptChildren ¶
func AppendText ¶
func ChildNodes ¶
ChildNodes returns a seq of the immediate children of n.
func DeleteAttr ¶
func InnerHTMLBlocks ¶
InnerHTMLBlocks is the same as InnerHTML, but it separates top level nodes with a line break.
func IsBalanced ¶
IsBalanced reports whether every opening tag has a closing pair.
func RemoveAll ¶
RemoveAll orphans the nodes it is passed. It ignores a node if the node is nil or already an orphan.
func ReplaceWith ¶
func SelectSlice ¶
SelectSlice returns a slice of child nodes matched by the selector.
func TextContent ¶
TextContent joins and trims the text node children of n.
func UnnestChildren ¶
UnnestChildren has all of the children of node adopted by its parent, and then it removes the node.
Types ¶
type TableNodes ¶
func (TableNodes) Label ¶
func (rows TableNodes) Label() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.