Skip to content

Commit

Permalink
opt: formatToJSFunc use string plus (#1101)
Browse files Browse the repository at this point in the history
  • Loading branch information
somnus-L authored Aug 19, 2024
1 parent 945ca02 commit 0096e53
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion page_eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (e *EvalOptions) ByPromise() *EvalOptions {

func (e *EvalOptions) formatToJSFunc() string {
js := strings.Trim(e.JS, "\t\n\v\f\r ;")
return fmt.Sprintf(`function() { return (%s).apply(this, arguments) }`, js)
return `function() { return (` + js + `).apply(this, arguments) }`
}

// Eval is a shortcut for [Page.Evaluate] with AwaitPromise, ByValue set to true.
Expand Down

0 comments on commit 0096e53

Please sign in to comment.