Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home for chromium.org
« Groups Home
Devtools: How can I access the most recently selected element?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jason Mitcheson  
View profile  
 More options Nov 13 2012, 10:14 pm
From: Jason Mitcheson <ja...@pixeljet.net>
Date: Tue, 13 Nov 2012 19:14:22 -0800 (PST)
Local: Tues, Nov 13 2012 10:14 pm
Subject: Devtools: How can I access the most recently selected element?

I've done a lot of my own research but I'm really stuck here; could use
some help.

Here is what I am calling from inside devtools.js

chrome.devtools.panels.elements.onSelectionChanged.addListener(function() {
      chrome.devtools.inspectedWindow.eval("$0", function (res) {
      port.postMessage(res);

});

But res evaluates to an error string: "Object has too long reference
chain(must not be longer than 1000)"

From what I can tell from Googling, this is the way that one is supposed to
get the selected element? This is the same behaviour in canary and the
current user version of Chrome..

Thanks

- Jason


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joe Marini  
View profile  
 More options Nov 15 2012, 1:19 am
From: Joe Marini <joemar...@google.com>
Date: Wed, 14 Nov 2012 22:19:05 -0800
Local: Thurs, Nov 15 2012 1:19 am
Subject: Re: [crx] Devtools: How can I access the most recently selected element?

You can only request JSON-stringifyable objects. We can't pass live objects
across the contexts so we serialize them. So you need to process the result
within the eval and return a payload you can interpret on the call site
later.

--
Joe Marini
Developer Advocate / Chrome
joemar...@google.com | +Joe Marini |
@joemarini<https://twitter.com/#!/joemarini>

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jason Mitcheson  
View profile  
 More options Nov 15 2012, 7:25 pm
From: Jason Mitcheson <ja...@pixeljet.net>
Date: Thu, 15 Nov 2012 16:25:48 -0800 (PST)
Local: Thurs, Nov 15 2012 7:25 pm
Subject: Re: Devtools: How can I access the most recently selected element?

OK, I understand. Thanks for the reply


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jason Mitcheson  
View profile  
 More options Nov 17 2012, 4:21 am
From: Jason Mitcheson <ja...@pixeljet.net>
Date: Sat, 17 Nov 2012 01:21:12 -0800 (PST)
Local: Sat, Nov 17 2012 4:21 am
Subject: Re: Devtools: How can I access the most recently selected element?

I need some more help please.

Is it possible *at all* to programatically access the '$0' element? It
seems to only work when I actually evaluate it from the console. If I write
a function to evaluate it, then it complains that it isn't defined. Here is
a small test http://jsfiddle.net/JPeGT/. I have access both to the
extension and the code running on the actual page.

The event
<https://developer.chrome.com/extensions/devtools.panels.html#event-El...>exists,
so surely you must be able to actually figure out what the element is..

Thanks

- Jason


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jason Mitcheson  
View profile  
 More options Nov 18 2012, 5:30 am
From: Jason Mitcheson <ja...@pixeljet.net>
Date: Sun, 18 Nov 2012 02:30:17 -0800 (PST)
Local: Sun, Nov 18 2012 5:30 am
Subject: Re: Devtools: How can I access the most recently selected element?

Ok, I figured it out. $0 isn't in scope inside a function, but it's in
scope if it's passed in as a parameter..  I can call this code from inside
my devtools page

inside actual tab, running as user JS

function onSelectionChanged(element) {
// element should be $0 / last selected element

}

inside devtools page

chrome.devtools.inspectedWindow.eval("window.qf.onSelectionChanged($0)",
function (res) {

}

Figuring that out was torturous.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Кемаль Смайлов  
View profile   Translate to Translated (View Original)
 More options Feb 18, 4:12 am
From: Кемаль Смайлов <pento1...@gmail.com>
Date: Mon, 18 Feb 2013 01:12:56 -0800 (PST)
Local: Mon, Feb 18 2013 4:12 am
Subject: Re: Devtools: How can I access the most recently selected element?

Hello, Jason Mitcheson! You could solve the problem? If you could, share
code please


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »