Source File
node.go
Belonging Package
golang.org/x/net/html
package html
import (
)
type NodeType uint32
const (
ErrorNode NodeType = iota
TextNode
DocumentNode
ElementNode
CommentNode
var scopeMarker = Node{Type: scopeMarkerNode}
func ( *Node) (, *Node) {
if .Parent != nil || .PrevSibling != nil || .NextSibling != nil {
panic("html: InsertBefore called for an attached child Node")
}
var , *Node
if != nil {
, = .PrevSibling,
} else {
= .LastChild
}
if != nil {
.NextSibling =
} else {
.FirstChild =
}
if != nil {
.PrevSibling =
} else {
.LastChild =
}
.Parent =
.PrevSibling =
.NextSibling =
}
func ( *Node) ( *Node) {
if .Parent != nil || .PrevSibling != nil || .NextSibling != nil {
panic("html: AppendChild called for an attached child Node")
}
:= .LastChild
if != nil {
.NextSibling =
} else {
.FirstChild =
}
.LastChild =
.Parent =
.PrevSibling =
}
func ( *Node) ( *Node) {
if .Parent != {
panic("html: RemoveChild called for a non-child Node")
}
if .FirstChild == {
.FirstChild = .NextSibling
}
if .NextSibling != nil {
.NextSibling.PrevSibling = .PrevSibling
}
if .LastChild == {
.LastChild = .PrevSibling
}
if .PrevSibling != nil {
.PrevSibling.NextSibling = .NextSibling
}
.Parent = nil
.PrevSibling = nil
.NextSibling = nil
}
func (, *Node) {
for {
:= .FirstChild
if == nil {
break
}
.RemoveChild()
.AppendChild()
}
}
func ( *nodeStack) ( *Node) {
:= .index()
if == -1 {
return
}
copy((*)[:], (*)[+1:])
:= len(*) - 1
(*)[] = nil
* = (*)[:]
}
type insertionModeStack []insertionMode
func ( *insertionModeStack) () ( insertionMode) {
:= len(*)
= (*)[-1]
* = (*)[:-1]
return
}
func ( *insertionModeStack) () insertionMode {
if := len(*); > 0 {
return (*)[-1]
}
return nil
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |