jonnybot0 commented on code in PR #274:
URL: https://github.com/apache/groovy-geb/pull/274#discussion_r2164513621


##########
module/geb-core/src/main/groovy/geb/js/JavascriptInterface.groovy:
##########
@@ -67,7 +68,21 @@ class JavascriptInterface {
             throw new GebException("driver '$driver' can not execute 
javascript")
         }
 

Review Comment:
   Hrm. I reckon this works, but it seemed a little hacky.
   
   What about having a method with an explicit type signature?
   ```
       def exec(Navigator navigator, String script) {
           def element = navigator.size() == 1 ? navigator.singleElement() : 
navigator.allElements()
           def args = [element].toArray()
           execjs(script, args)
       }
   ```
   
   I guess the problem there is that you couldn't pass in arbitrary arguments 
in any order, and order matters for interpolation. 🤔 
   
   Can't think of a better way, given the underlying API, though filtering 
arguments by type after the fact feels dodgy. :) 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to