Runtime.callFunctionOn - scrollIntoView undefined

426 views
Skip to first unread message

t...@yieldmetrics.com

unread,
Nov 8, 2012, 4:14:58 PM11/8/12
to google-chrome-...@googlegroups.com
Hi,

In Chrome version 22.0.1229.94 via the remote debugging protocol I'm attempting to call scrollIntoView via Runtime.callFunctionOn on an html image element.  The call doesn't succeed and I get this response :  "ReferenceError: scrollIntoView is not defined". 

Other pertinent details:
  • If I retrieve this node's properties (through the debugging protocol), I indeed see the function scrollIntoView listed
  • I can successfully call the toString method via this same code (returns "[object HTMLImageElement]")
  • I can call scrollIntoView via the developer tools console on this element
  • Calls to scrollIntoViewIfNeeded fails in the same manner.

I am simply specifying "scrollIntoView" in the functionDeclaration parameter.  Am I specifying the function declaration incorrectly?  Or is there something else I'm not understanding to call this function?

Any pointers would be appreciated.

Thanks,

Tom

Pavel Feldman

unread,
Nov 9, 2012, 12:37:55 AM11/9/12
to t...@yieldmetrics.com, google-chrome-...@googlegroups.com
For greater flexibility, callFunctionOn receives complete function declaration, not a function name. I.e. you should pass something like "function() { this.scrollIntoView(); }" as that argument. This allows calling not only existing functions on the objects, but also small routines composed on the caller side.

Regards
Pavel
Reply all
Reply to author
Forward
0 new messages