diff --git a/publisher/htmlElementsCollector.go b/publisher/htmlElementsCollector.go
index e1c743eab..1bc1a09bc 100644
--- a/publisher/htmlElementsCollector.go
+++ b/publisher/htmlElementsCollector.go
@@ -152,21 +152,18 @@ type htmlElementsCollectorWriter struct {
}
// Write collects HTML elements from p.
-func (w *htmlElementsCollectorWriter) Write(p []byte) (int, error) {
+func (w *htmlElementsCollectorWriter) Write(p []byte) (n int, err error) {
+ n = len(p)
w.input = p
+ w.pos = 0
for {
w.r = w.next()
if w.r == eof {
- break
+ return
}
w.state = w.state(w)
}
-
- w.pos = 0
- w.input = nil
-
- return len(p), nil
}
func (l *htmlElementsCollectorWriter) backup() {