Closed Bug 1121351 Opened 7 years ago Closed 3 years ago
Use outputted objects in the Dev
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 Build ID: 20150112004004 Steps to reproduce: The objects which are ouputted to the console should be accessible within the console for further manipulation. Say, I console.log()'ed an array [2,3,4], and it is outputted on the console, and can be inspected, then I should be able to right click on that Array output and say "Use in Console", which would make it available in the $0 variable (or something similar), and then I can do array operations like $0.push(10); This is incredibly useful when I output DOM nodes selected via document.qsa or jquery, and then I need to do some operations on that node. It can be the case that the node is not directly accessible via the webpage, or takes a lot of work to access it, thus making this route much more feasible. This functionality has been there in firebug for quite some time now, and I believe everyone would benefit from this nifty feature.
FYI in bug 792063 we've implemented the convention of setting $_ to the result of the last expression - while this does not cover all of your use cases, you may find it useful.
Status: UNCONFIRMED → NEW
Ever confirmed: true
@Jeff Sorry for the delay in this reply. This $_ thing just doesn't cut it for most of my use cases. $_ *only* works if I had that object as the result of the *last expression*. This means, + I can't get the object of any expression but the last + I can't manipulate or use objects I outputted from my code. (Especially painful if the output is from an operation which may be non-idempotent, say a success callback from an AJAX request)
(In reply to Kumar Harsh from comment #2) > @Jeff Sorry for the delay in this reply. This $_ thing just doesn't cut it > for most of my use cases. $_ *only* works if I had that object as the result > of the *last expression*. This means, > > + I can't get the object of any expression but the last > + I can't manipulate or use objects I outputted from my code. (Especially > painful if the output is from an operation which may be non-idempotent, say > a success callback from an AJAX request) FYI We've been considering two additional features, logged as bugs today: * bug 1154363 Use $variable in console * bug 1154359 Set $1 ... $n to recent expression results
Can't find the bug where it was introduced, but we now have a "Store as global variable" context menu entry which then allow you to have a reference to said object (e.g. temp0)
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.