Source File
iter.go
Belonging Package
golang.org/x/net/html
// Copyright 2024 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.//go:build go1.23package htmlimport// Ancestors returns an iterator over the ancestors of n, starting with n.Parent.//// Mutating a Node or its parents while iterating may have unexpected results.func ( *Node) () iter.Seq[*Node] {_ = .Parent // eager nil checkreturn func( func(*Node) bool) {for := .Parent; != nil && (); = .Parent {}}}// ChildNodes returns an iterator over the immediate children of n,// starting with n.FirstChild.//// Mutating a Node or its children while iterating may have unexpected results.func ( *Node) () iter.Seq[*Node] {_ = .FirstChild // eager nil checkreturn func( func(*Node) bool) {for := .FirstChild; != nil && (); = .NextSibling {}}}// Descendants returns an iterator over all nodes recursively beneath// n, excluding n itself. Nodes are visited in depth-first preorder.//// Mutating a Node or its descendants while iterating may have unexpected results.func ( *Node) () iter.Seq[*Node] {_ = .FirstChild // eager nil checkreturn func( func(*Node) bool) {.descendants()}}func ( *Node) ( func(*Node) bool) bool {for := range .ChildNodes() {if !() || !.() {return false}}return true}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux 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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |