utils

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func After

func After(pivot, n *html.Node) error

After insert after end

func Append

func Append(p, c *html.Node)

Append

func Before

func Before(pivot, n *html.Node) error

Before insert before begin

func ChildNodes

func ChildNodes(n *html.Node) []*html.Node

ChildNodes

func Children

func Children(n *html.Node) []*html.Node

Children returns node type is html.ElementNode

func Clone

func Clone(n *html.Node) *html.Node

Clone cloneNode

func CloneAll

func CloneAll(n *html.Node) *html.Node

CloneAll clone while keeping all descendents

func Count

func Count(n *html.Node) int

Count childElementCount count child element

func Create

func Create(text string) ([]*html.Node, error)

Create create ElementNode from text

func Empty

func Empty(n *html.Node)

Empty remove all of child nodes

func First

func First(n *html.Node) *html.Node

First firstElementChild. returns node type is html.ElementNode

func HTML

func HTML(n *html.Node) string

HTML outerHTML

func Html

func Html(n *html.Node, text ...string) string

Html innerHTML

func Insert

func Insert(position Position, pivot, n *html.Node) error

Insert <!-- beforebegin --> <p>

<!-- afterbegin -->
childnodes
<!-- beforeend -->

</p> <!-- afterend -->

func IsComment

func IsComment(n *html.Node) bool

func IsDoctype

func IsDoctype(n *html.Node) bool

func IsDocument

func IsDocument(n *html.Node) bool

func IsElement

func IsElement(n *html.Node) bool

func IsError

func IsError(n *html.Node) bool

func IsText

func IsText(n *html.Node) bool

func Last

func Last(n *html.Node) *html.Node

Last lastElementChild. returns node type is html.ElementNode

func LastDescendant

func LastDescendant(n *html.Node) *html.Node

LastDescendant if FirstChild is nil returns given html.Node

func Next

func Next(n *html.Node) *html.Node

Next nextElementSibling. returns node type is html.ElementNode

func NextAll

func NextAll(n *html.Node) []*html.Node

NextAll returns all next sibling hhtml.ElementNode

func Parent

func Parent(n *html.Node) *html.Node

Parent parentElement. returns node type is html.ElementNode

func Prepend

func Prepend(pivot, n *html.Node) error

Prepend insert after begin

func Prev

func Prev(n *html.Node) *html.Node

Prev previousElementSibling. returns node type is html.ElementNode

func PrevAll

func PrevAll(n *html.Node) []*html.Node

PrevAll returns all previous sibling html.ElementNode

func Remove

func Remove(n *html.Node)

Remove

func Replace

func Replace(parentNode, newNode, oldNode *html.Node) *html.Node

Replace replaceChild

func Sibling

func Sibling(n *html.Node) []*html.Node

Sibling returns all sibling html.ElementNode

func Text

func Text(n *html.Node, text ...string) string

Text

func Wrap

func Wrap(node, wrapper *html.Node) error

Wrap wraps html.Node of the first argument specified

func WrapAll

func WrapAll(nodes []*html.Node, wrapper *html.Node) error

WrapAll wraps given nodes of the first argument by node of second argument

Types

type Position

type Position int
const (
	Beforebegin Position = iota
	Afterbegin
	Beforeend
	Afterend
)

Jump to

Keyboard shortcuts

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