You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Greetings, just so you know I was running (in chromium's latest) execute_script with an anonymous function in it that referenced arguments, as such:
execute_script( "const e=arguments[0], i=(function(s){ val = arguments[1] ; ... })(e) ; ...", [ arg0, arg1] )
Turns out that while e is properly defined as taking the value of arg0, once inside the anonymous function arguments is equals to [e] i.e. what was passed to the anonymous function, not [ arg0, arg1] any longer.
That's an unfortunate side-effect of having named your arguments "arguments" I suppose. :)
My workaround was to define an extra variable taking arg1 as its value, before the anonymous function then invoke that variable from within. But ideally there's no having to worry about that array's value being overwritten at execution time.
The text was updated successfully, but these errors were encountered:
Greetings, just so you know I was running (in chromium's latest) execute_script with an anonymous function in it that referenced arguments, as such:
execute_script( "const e=arguments[0], i=(function(s){ val = arguments[1] ; ... })(e) ; ...", [ arg0, arg1] )
Turns out that while e is properly defined as taking the value of arg0, once inside the anonymous function arguments is equals to [e] i.e. what was passed to the anonymous function, not [ arg0, arg1] any longer.
That's an unfortunate side-effect of having named your arguments "arguments" I suppose. :)
My workaround was to define an extra variable taking arg1 as its value, before the anonymous function then invoke that variable from within. But ideally there's no having to worry about that array's value being overwritten at execution time.
The text was updated successfully, but these errors were encountered: