type NodeType … const ErrorNode … const TextNode … const DocumentNode … const ElementNode … const CommentNode … const DoctypeNode … const RawNode … const scopeMarkerNode … var scopeMarker … type Node … // InsertBefore inserts newChild as a child of n, immediately before oldChild // in the sequence of n's children. oldChild may be nil, in which case newChild // is appended to the end of n's children. // // It will panic if newChild already has a parent or siblings. func (n *Node) InsertBefore(newChild, oldChild *Node) { … } // AppendChild adds a node c as a child of n. // // It will panic if c already has a parent or siblings. func (n *Node) AppendChild(c *Node) { … } // RemoveChild removes a node c that is a child of n. Afterwards, c will have // no parent and no siblings. // // It will panic if c's parent is not n. func (n *Node) RemoveChild(c *Node) { … } // reparentChildren reparents all of src's child nodes to dst. func reparentChildren(dst, src *Node) { … } // clone returns a new node with the same type, data and attributes. // The clone has no parent, no siblings and no children. func (n *Node) clone() *Node { … } type nodeStack … // pop pops the stack. It will panic if s is empty. func (s *nodeStack) pop() *Node { … } // top returns the most recently pushed node, or nil if s is empty. func (s *nodeStack) top() *Node { … } // index returns the index of the top-most occurrence of n in the stack, or -1 // if n is not present. func (s *nodeStack) index(n *Node) int { … } // contains returns whether a is within s. func (s *nodeStack) contains(a atom.Atom) bool { … } // insert inserts a node at the given index. func (s *nodeStack) insert(i int, n *Node) { … } // remove removes a node from the stack. It is a no-op if n is not present. func (s *nodeStack) remove(n *Node) { … } type insertionModeStack … func (s *insertionModeStack) pop() (im insertionMode) { … } func (s *insertionModeStack) top() insertionMode { … }