mirror of
https://github.com/MontFerret/ferret.git
synced 2025-07-15 01:25:00 +02:00
Feature/#220 iframe support (#315)
* Refactored Virtual DOM structure * Added new E2E tests * Updated E2E Test Runner
This commit is contained in:
@ -9,7 +9,7 @@ import (
|
||||
"github.com/MontFerret/ferret/pkg/runtime/values/types"
|
||||
)
|
||||
|
||||
// Element finds an element by a given CSS selector.
|
||||
// GetElement finds an element by a given CSS selector.
|
||||
// Returns NONE if element not found.
|
||||
// @param docOrEl (HTMLDocument|HTMLElement) - Parent document or element.
|
||||
// @param selector (String) - CSS selector.
|
||||
@ -24,14 +24,14 @@ func Element(ctx context.Context, args ...core.Value) (core.Value, error) {
|
||||
return el.QuerySelector(ctx, selector), nil
|
||||
}
|
||||
|
||||
func queryArgs(args []core.Value) (drivers.HTMLNode, values.String, error) {
|
||||
func queryArgs(args []core.Value) (drivers.HTMLElement, values.String, error) {
|
||||
err := core.ValidateArgs(args, 2, 2)
|
||||
|
||||
if err != nil {
|
||||
return nil, values.EmptyString, err
|
||||
}
|
||||
|
||||
err = core.ValidateType(args[0], drivers.HTMLDocumentType, drivers.HTMLElementType)
|
||||
el, err := drivers.ToElement(args[0])
|
||||
|
||||
if err != nil {
|
||||
return nil, values.EmptyString, err
|
||||
@ -43,5 +43,5 @@ func queryArgs(args []core.Value) (drivers.HTMLNode, values.String, error) {
|
||||
return nil, values.EmptyString, err
|
||||
}
|
||||
|
||||
return args[0].(drivers.HTMLNode), args[1].(values.String), nil
|
||||
return el, args[1].(values.String), nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user