1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-12-11 22:47:08 +02:00

Merge branch 'master' into cleanup/fix-naming-convention

This commit is contained in:
David Landry
2018-10-05 17:42:28 -04:00
committed by GitHub
42 changed files with 571 additions and 162 deletions

View File

@@ -1,12 +1,12 @@
package static
import (
"crypto/sha512"
"encoding/json"
"github.com/MontFerret/ferret/pkg/runtime/core"
"github.com/MontFerret/ferret/pkg/runtime/values"
"github.com/MontFerret/ferret/pkg/stdlib/html/driver/common"
"github.com/PuerkitoBio/goquery"
"hash/fnv"
)
type HTMLElement struct {
@@ -53,22 +53,21 @@ func (el *HTMLElement) Unwrap() interface{} {
return el.selection
}
func (el *HTMLElement) Hash() int {
h := sha512.New()
func (el *HTMLElement) Hash() uint64 {
str, err := el.selection.Html()
if err != nil {
return 0
}
out, err := h.Write([]byte(str))
h := fnv.New64a()
if err != nil {
return 0
}
h.Write([]byte(el.Type().String()))
h.Write([]byte(":"))
h.Write([]byte(str))
return out
return h.Sum64()
}
func (el *HTMLElement) Clone() core.Value {