Things have changed and are much harder to use

22 views
Skip to first unread message

tn77

unread,
Jul 19, 2016, 1:40:02 AM7/19/16
to Google Chrome Developer Tools
OK, I have no idea how to use the Chrome Developer Tools any more. Things are incredibly difficult when they used to be simple; I've been devleoping web apps for years and years with Chrome's help.

I have a function on a page that I want to test, for example a generic function called toggle_div();

Previously, I could just open Chrome Developer Tools and type toggle_div() and the function would run.

Now, I get errors.

Uncaught ReferenceError: toggle_div is not defined
    at <anonymous>:1:1

What is the problem here? The function exists, and it works when called from the clicks on the page. Why can't I run functions from Chrome Developer Console any more?

PhistucK

unread,
Jul 19, 2016, 2:00:58 AM7/19/16
to Google Chrome Developer Tools
What is your version of Chrome?
I am using Chrome 51 and never had this problem.

Is it possible that toggle_div is defined within a different functional context (say, within an immediately-invoked function expression - (function () { }());)?

Did you verify that the context of the console is correct? There is a selection box above the console, it usually says "top" (which is the context of the top frame) but recently, a feature was implemented so that when you focus on an element (in the Elements panel) that forms (or that is from) a different context (say, an <iframe>, or an element within an <iframe>) it automatically changes to that context.

I just realized that focusing on an <iframe> is enough to change contexts, which seems excessive and counterintuitive - the <iframe> itself is in the context of the document that contains it, so why does it change to the context of the <iframe>?


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/383cdc13-f306-43ca-b4e4-6f710a89e5a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages