Help us shape the future of Go! Take the 2026 Go Developer Survey

htmlx

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package htmlx holds the small x/net/html node operations shared by the compiler, the document checks and the release audits.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Attr

func Attr(n *html.Node, key string) string

Attr returns the value of an attribute, or "" when absent or n is nil.

func DelAttr

func DelAttr(n *html.Node, keys ...string)

DelAttr removes every listed attribute.

func Dormant

func Dormant(n *html.Node) bool

Dormant reports whether n sits inside an HTML <template>, whose content does not render or execute until a script instantiates it.

func Element

func Element(name, text string) *html.Node

Element creates an HTML element, optionally with one text child.

func HasAttr

func HasAttr(n *html.Node, key string) bool

HasAttr reports whether n carries the attribute, even when empty.

func HasToken

func HasToken(n *html.Node, key, token string) bool

HasToken reports whether a space-separated attribute (such as rel) contains token, case-insensitively.

func Move

func Move(parent, n *html.Node)

Move reparents n as the last child of parent.

func RawText

func RawText(n *html.Node) string

RawText concatenates the direct children's data. It is meant for raw-text elements such as script and style, whose content is a single text node.

func Rel

func Rel(n *html.Node, token string) bool

Rel reports whether n's rel attribute contains token.

func SetAttr

func SetAttr(n *html.Node, key, value string)

SetAttr sets or appends an attribute.

func SetText

func SetText(n *html.Node, value string)

SetText replaces all children with one text node.

func Text

func Text(n *html.Node) string

Text concatenates all descendant text nodes.

func Walk

func Walk(n *html.Node, visit func(*html.Node))

Walk visits every element in document order.

Types

This section is empty.

Jump to

Keyboard shortcuts

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