aboutsummaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/net/html/token.go
diff options
context:
space:
mode:
authorale <ale@incal.net>2021-07-12 17:29:19 +0000
committerale <ale@incal.net>2021-07-12 17:29:19 +0000
commitef2c410063d3be2632ad7449cab6f51511face6b (patch)
tree9d2e82374a063f3b568110e83ccb1b285f3247f1 /vendor/golang.org/x/net/html/token.go
parent877afafd950b84242204499b3ed8c1b2c8c75f31 (diff)
parent557f9d889812976293b4a668c190e0e1e0332857 (diff)
downloadcrawl-ef2c410063d3be2632ad7449cab6f51511face6b.tar.gz
crawl-ef2c410063d3be2632ad7449cab6f51511face6b.zip
Merge branch 'renovate/github.com-puerkitobio-goquery-1.x' into 'master'
Update module github.com/PuerkitoBio/goquery to v1.7.1 See merge request ale/crawl!3
Diffstat (limited to 'vendor/golang.org/x/net/html/token.go')
-rw-r--r--vendor/golang.org/x/net/html/token.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/vendor/golang.org/x/net/html/token.go b/vendor/golang.org/x/net/html/token.go
index e3c01d7..877709f 100644
--- a/vendor/golang.org/x/net/html/token.go
+++ b/vendor/golang.org/x/net/html/token.go
@@ -296,8 +296,7 @@ func (z *Tokenizer) Buffered() []byte {
// too many times in succession.
func readAtLeastOneByte(r io.Reader, b []byte) (int, error) {
for i := 0; i < 100; i++ {
- n, err := r.Read(b)
- if n != 0 || err != nil {
+ if n, err := r.Read(b); n != 0 || err != nil {
return n, err
}
}
@@ -347,6 +346,7 @@ loop:
break loop
}
if c != '/' {
+ z.raw.end--
continue loop
}
if z.readRawEndTag() || z.err != nil {
@@ -1067,6 +1067,11 @@ loop:
// Raw returns the unmodified text of the current token. Calling Next, Token,
// Text, TagName or TagAttr may change the contents of the returned slice.
+//
+// The token stream's raw bytes partition the byte stream (up until an
+// ErrorToken). There are no overlaps or gaps between two consecutive token's
+// raw bytes. One implication is that the byte offset of the current token is
+// the sum of the lengths of all previous tokens' raw bytes.
func (z *Tokenizer) Raw() []byte {
return z.buf[z.raw.start:z.raw.end]
}