attr

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddClass

func AddClass(n *html.Node, classname string)

AddClass add given classname to vlaue of class attribute. sets given classname as value of class attribute if has not class attribute

func Attr

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

Attr if given a 1 argument: treat as the "Key" and returns it value. same as Get if given a 2 argument: treat as the "Key" and "Value",

sets these as the attribute. same as Set

if given a 3 argument: treat as the "Namespace", "Key" and "Value",

sets these as the attribute. same as SetNS

func Get

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

Get returns value given key of attribute

func GetNS

func GetNS(n *html.Node, namespace, key string) string

GetNS

func GetNode

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

GetNode

func GetNodeNS

func GetNodeNS(n *html.Node, namespace, key string) (html.Attribute, bool)

GetNodeNS

func Has

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

Has

func HasClass

func HasClass(n *html.Node, classname string) bool

HasClass returns true if value of class attribute has classname

func HasNS

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

HasNS

func HasNode

func HasNode(n *html.Node, a html.Attribute) bool

HasNode

func HasValue

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

HasValue returns true if it element has value of attribute. first matching key of attribute without considering duplicates

func IndexOf

func IndexOf(n *html.Node, key string) int

IndexOf

func IndexOfNS

func IndexOfNS(n *html.Node, namespace, key string) int

IndexOfNS

func IndexOfNode

func IndexOfNode(n *html.Node, a html.Attribute) int

func Remove

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

Remove

func RemoveClass

func RemoveClass(n *html.Node, classname string)

RemoveClass removes given classname from the value of class attribute

func RemoveNS

func RemoveNS(n *html.Node, namespace, key string)

RemoveNS

func RemoveNode

func RemoveNode(n *html.Node, a html.Attribute)

RemoveNode

func Set

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

Set

func SetNS

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

SetNS

func SetNode

func SetNode(n *html.Node, a html.Attribute)

SetNode

func SetNodeNS

func SetNodeNS(n *html.Node, a html.Attribute)

SetNodeNS

func ToggleClass

func ToggleClass(n *html.Node, classname string)

ToggleClass adds given classname if has not class name or removes it classname if already have class name

Types

This section is empty.

Jump to

Keyboard shortcuts

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