WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
17907
Inspector should support Firebug's magic $0 variable to access inspected node
https://bugs.webkit.org/show_bug.cgi?id=17907
Summary
Inspector should support Firebug's magic $0 variable to access inspected node
Adam Roben (:aroben)
Reported
2008-03-17 21:02:18 PDT
Firebug has a magic $1 variable that's available from the Console to access the inspected node. We should support this variable in the Inspector's Console.
Attachments
not working patch
(1.32 KB, patch)
2008-08-14 09:23 PDT
,
Keishi Hattori
no flags
Details
Formatted Diff
Diff
Implements $0, $1, $n
(3.14 KB, patch)
2009-07-21 15:33 PDT
,
Keishi Hattori
no flags
Details
Formatted Diff
Diff
set history limit to 5
(3.14 KB, patch)
2009-07-21 15:48 PDT
,
Keishi Hattori
no flags
Details
Formatted Diff
Diff
Syntax fixes
(3.14 KB, patch)
2009-07-21 20:49 PDT
,
Keishi Hattori
no flags
Details
Formatted Diff
Diff
No more $n
(3.29 KB, patch)
2009-07-21 21:00 PDT
,
Keishi Hattori
timothy
: review+
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Timothy Hatcher
Comment 1
2008-03-17 21:08:40 PDT
Thats a shame that Firebug uses $1. I was considering doing the gdb $n to refer to previous console results. More people might be familiar with Firebug's concept though.
Adam Roben (:aroben)
Comment 2
2008-06-04 08:29:09 PDT
***
Bug 19390
has been marked as a duplicate of this bug. ***
Anthony Ricaud
Comment 3
2008-06-06 08:33:25 PDT
$1 isn't available in Firebug 1.2b2. I don't know if it's a bug or if they abandoned it. By the way, I've asked other web developers, nobody knew this shortcut. Maybe you could agreed with Firebug developers on a more standard way to do this.
Adam Roben (:aroben)
Comment 4
2008-07-11 14:06:17 PDT
<
rdar://problem/6070208
>
Keishi Hattori
Comment 5
2008-08-14 09:19:12 PDT
According to this old documentation, I think $0 is the inspected node.
http://www.joehewitt.com/software/firebug/docs.php
Keishi Hattori
Comment 6
2008-08-14 09:23:28 PDT
Created
attachment 22794
[details]
not working patch $0 seems to receive the appropriate object, but the security seems to block usage. For example, calling "$0" seems OK, but calling "$0.innerHTML" returns undefined. I tried doing wrapCallback on the node but that doesn't work either.
Maciej Stachowiak
Comment 7
2008-10-01 10:07:16 PDT
Maybe this could have a less obscure name, like console.selectedNode or something. With autocomplete the typing is not a big deal and it is more memorable and less likely to conflict than $0.
Adam Roben (:aroben)
Comment 8
2008-10-01 10:23:40 PDT
(In reply to
comment #7
)
> Maybe this could have a less obscure name, like console.selectedNode or > something.
Putting it on the console object may not be ideal, since it's unlikely we want web pages to have access to this variable.
Keishi Hattori
Comment 9
2009-07-21 15:33:29 PDT
Created
attachment 33221
[details]
Implements $0, $1, $n I've finally figured this out. JSInspectorCallbackWrapper wraps the return value with JSInspectorCallbackWrapper::wrapOutgoingValue. It wraps it as a JSInspectorCallbackWrapper, which blocks getProperty, setProperty, deleteProperty, construct, hasInstance, and getPropertyNames. I think this is overkill for objects from the "inspected window" but a necessary security measure for objects from the "inspector". $0 - Variable containing the most recently inspected object . $1 - Variable containing the next most recently inspected object . $n(n) - Returns the nth most recently inspected object that has been inspected.
Keishi Hattori
Comment 10
2009-07-21 15:48:42 PDT
Created
attachment 33223
[details]
set history limit to 5 The history limit seems to be 5 in firebug.
Timothy Hatcher
Comment 11
2009-07-21 16:59:23 PDT
Comment on
attachment 33223
[details]
set history limit to 5
> + profileEnd: function() { return console.profileEnd.apply(console, arguments) }, \ > + _inspectedNodes: [], \ > + _addInspectedNode: function(node) { \
The indentation is one space off for _inspectedNodes. + var _inspectedNodes = _inspectorCommandLineAPI._inspectedNodes; \ The local variable should not have an underscore prefix.
> + $n: function(n) { return _inspectorCommandLineAPI._inspectedNodes[n] } \
Firebug really adds a $n function? Not just $0, $1, $2, $3 and $4?
Joseph Pecoraro
Comment 12
2009-07-21 18:07:31 PDT
> Firebug really adds a $n function? Not just $0, $1, $2, $3 and $4?
Yah, documentation on this is rather hidden. Its at the bottom of Joe Hewitt's site:
http://joehewitt.com/software/firebug/docs.php
Keishi Hattori
Comment 13
2009-07-21 20:49:53 PDT
Created
attachment 33237
[details]
Syntax fixes $n is pointless. It's only in their old outdated documentation anyway. (The assert* commands seems to have been deprecated) I vote to ditch it.
Timothy Hatcher
Comment 14
2009-07-21 20:51:19 PDT
Lets ditch $n.
Keishi Hattori
Comment 15
2009-07-21 21:00:17 PDT
Created
attachment 33238
[details]
No more $n
Adam Barth
Comment 16
2009-07-24 01:31:41 PDT
Committing to
http://svn.webkit.org/repository/webkit/trunk
... M WebCore/ChangeLog M WebCore/inspector/front-end/Console.js M WebCore/inspector/front-end/ElementsPanel.js Committed
r46338
M WebCore/ChangeLog M WebCore/inspector/front-end/ElementsPanel.js M WebCore/inspector/front-end/Console.js
r46338
= 4e1d680f3088d0cdd0b49c04acba4a47421cc311 (trunk) No changes between current HEAD and refs/remotes/trunk Resetting to the latest refs/remotes/trunk
http://trac.webkit.org/changeset/46338
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug