1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-06-23 00:28:10 +02:00

New type system (#232)

* New type system

* Fixed dot notation for HTML elements
This commit is contained in:
Tim Voronov
2019-02-13 12:31:18 -05:00
committed by GitHub
parent b3bcbda3b9
commit 1af8b37a0f
185 changed files with 1379 additions and 820 deletions

View File

@ -5,6 +5,7 @@ import (
"github.com/MontFerret/ferret/pkg/runtime/core"
"github.com/MontFerret/ferret/pkg/runtime/values"
"github.com/MontFerret/ferret/pkg/runtime/values/types"
)
// WaitClassAll waits for a class to appear on all matched elements.
@ -21,21 +22,21 @@ func WaitClassAll(_ context.Context, args ...core.Value) (core.Value, error) {
}
// document only
err = core.ValidateType(args[0], core.HTMLDocumentType)
err = core.ValidateType(args[0], types.HTMLDocument)
if err != nil {
return values.None, err
}
// selector
err = core.ValidateType(args[1], core.StringType)
err = core.ValidateType(args[1], types.String)
if err != nil {
return values.None, err
}
// class
err = core.ValidateType(args[2], core.StringType)
err = core.ValidateType(args[2], types.String)
if err != nil {
return values.None, err
@ -52,7 +53,7 @@ func WaitClassAll(_ context.Context, args ...core.Value) (core.Value, error) {
timeout := values.NewInt(defaultTimeout)
if len(args) == 4 {
err = core.ValidateType(args[3], core.IntType)
err = core.ValidateType(args[3], types.Int)
if err != nil {
return values.None, err