mirror of
https://github.com/PuerkitoBio/goquery
synced 2025-10-10 11:10:08 +08:00
28 lines
456 B
Go
28 lines
456 B
Go
package goquery
|
|
|
|
import (
|
|
"exp/html"
|
|
)
|
|
|
|
type Selection struct {
|
|
Nodes []*html.Node
|
|
document *Document
|
|
prevSel *Selection
|
|
}
|
|
|
|
func (this *Selection) Size() int {
|
|
return this.Length()
|
|
}
|
|
|
|
func (this *Selection) Length() int {
|
|
return len(this.Nodes)
|
|
}
|
|
|
|
func newEmptySelection(doc *Document) *Selection {
|
|
return &Selection{nil, doc}
|
|
}
|
|
|
|
func newSingleSelection(node *html.Node, doc *Document) *Selection {
|
|
return &Selection{[]*html.Node{node}, doc}
|
|
}
|