mirror of
https://github.com/MontFerret/ferret.git
synced 2025-06-25 00:37:26 +02:00
New type system (#232)
* New type system * Fixed dot notation for HTML elements
This commit is contained in:
@ -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"
|
||||
)
|
||||
|
||||
// InnerText returns inner text string of a given or matched by CSS selector element
|
||||
@ -18,7 +19,7 @@ func InnerText(_ context.Context, args ...core.Value) (core.Value, error) {
|
||||
return values.EmptyString, err
|
||||
}
|
||||
|
||||
err = core.ValidateType(args[0], core.HTMLDocumentType, core.HTMLElementType)
|
||||
err = core.ValidateType(args[0], types.HTMLDocument, types.HTMLElement)
|
||||
|
||||
if err != nil {
|
||||
return values.None, err
|
||||
@ -30,7 +31,7 @@ func InnerText(_ context.Context, args ...core.Value) (core.Value, error) {
|
||||
return node.InnerText(), nil
|
||||
}
|
||||
|
||||
err = core.ValidateType(args[1], core.StringType)
|
||||
err = core.ValidateType(args[1], types.String)
|
||||
|
||||
if err != nil {
|
||||
return values.None, err
|
||||
|
Reference in New Issue
Block a user