Debugger DOM Element "<function scope>" Property

116 views
Skip to first unread message

dsh...@embarqmail.com

unread,
Feb 19, 2016, 11:46:30 AM2/19/16
to Google Chrome Developer Tools
Using the Chrome (Version 48.0.2564.109 m) debugger I select an IMG element from the DOM that has an event listener defined from a extension content script.  I look at the onload property of the IMG element and see the following:

  1. onload: onload(event)
    1. arguments: null
    2. caller: null
    3. length: 1
    4. name: "onload"
    5. prototype: onload
    6. toString: ()
    7. __proto__: ()
    8. <function scope>
      1. With Block: img.rg_i
      2. With Block: Object
      3. With Block: document
      4. Global: Window

I can find no explanation of "<function scope>" in the chrome developer web pages.  I assume it has something to do with wrapping the web page's DOM elements to create a protected copy for the extension content script to play with.  Can someone explain what this display is telling me?  Could it be the scope chain that is in force when the function is called?

PhistucK

unread,
Feb 19, 2016, 5:13:55 PM2/19/16
to Google Chrome Developer Tools
First, you can file a documentation issue at https://github.com/google/WebFundamentals/issues. This will help everyone in the future, once it is resolved.

Second, <function scope> simply shows the variables and objects in scope for the listener function. The "With Block" sections (based on the horrible with {} blocks in JavaScript) within it show the objects of which properties will look like variables to the listener function, so if the DOM element has a property named "naturalHeight" and you in your function you have "console.log(naturalHeight * 2);", it will log the property of the DOM element, times 2.
So I guess the answer is yes to the last question.


PhistucK

--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-develo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-chrome-developer-tools/1bb49efb-5f2a-4c81-acb4-bb4735e7cc77%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages