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

Added Context to HTML methods (#235)

* Added Context to HTML methods

* Fixed unit tests

* Updated timeout

* Fixed WAIT_CLASS timeout
This commit is contained in:
Tim Voronov
2019-02-20 21:24:05 -05:00
committed by GitHub
parent 34c8c02258
commit 6e15846d0f
45 changed files with 415 additions and 446 deletions

View File

@ -12,7 +12,7 @@ import (
// @param doc (HTMLDocument|HTMLElement) - Parent document or element.
// @param selector (String, optional) - String of CSS selector.
// @returns (String) - Inner text if an element found, otherwise empty string.
func InnerText(_ context.Context, args ...core.Value) (core.Value, error) {
func InnerText(ctx context.Context, args ...core.Value) (core.Value, error) {
err := core.ValidateArgs(args, 1, 2)
if err != nil {
@ -26,7 +26,7 @@ func InnerText(_ context.Context, args ...core.Value) (core.Value, error) {
}
if len(args) == 1 {
return el.InnerText(), nil
return el.InnerText(ctx), nil
}
err = core.ValidateType(args[1], types.String)
@ -37,5 +37,5 @@ func InnerText(_ context.Context, args ...core.Value) (core.Value, error) {
selector := args[1].(values.String)
return el.InnerTextBySelector(selector), nil
return el.InnerTextBySelector(ctx, selector), nil
}