Javascript Console - Prototype Inheritance Chain

247 views
Skip to first unread message

Bruce Rosenberg

unread,
Nov 26, 2010, 10:42:00 PM11/26/10
to Chromium-discuss
Hello,

I noticed when both logging Javascript variables to Chrome's console
and viewing Javascript variables in the script debugger, that Chrome
does not display inherited object properties from the prototype
inheritance chain; only those defined in the derived object. Is this
'as designed' behavior or a bug or is there some way to turn the
feature on? At the moment I'm having to fall back to Firefox/Firebug
to get the full picture of my running code. I'm using Chrome
8.0.552.210 beta.

Thanks.

Ben

unread,
Nov 26, 2010, 10:59:21 PM11/26/10
to Bruce Rosenberg, Chromium-discuss
On Fri, 26 Nov 2010 21:42:00 -0600, Bruce Rosenberg <t00b...@gmail.com>
wrote:

Is what you're looking for the __proto__ property? Seems to be on most
objects, and looks like it shows stuff that's inherited. Try, for
instance, document.body.__proto__, or foo.__proto__, where foo is pretty
much any object.

--
Ben

Ben

unread,
Nov 27, 2010, 1:05:34 AM11/27/10
to Bruce Rosenberg, Ben, Chromium-discuss
On Fri, 26 Nov 2010 21:59:21 -0600, Ben <benj...@gmail.com> wrote:

>
> Is what you're looking for the __proto__ property? Seems to be on most
> objects, and looks like it shows stuff that's inherited. Try, for
> instance, document.body.__proto__, or foo.__proto__, where foo is pretty
> much any object.
>


On Fri, 26 Nov 2010 23:25:57 -0600, Bruce Rosenberg <t00b...@gmail.com>
wrote:

> Thanks Ben, that's exactly it.
>
> I'm using ExtJS and there are many levels of inheritance, so I had to
> navigate a fair way up the tree to find the property I was looking
> for.
> Being so used to Firebug it just wasn't obvious to me that __proto__
> contained the parent properties at first, but now it makes sense.
>
> Compared to Firebug's console I think that's a good feature because it
> indicates the actual prototype inheritance chain for the object being
> examined.
> That said, the option of a flat view of the object would probably be a
> good feature as well for those times when you simply quickly want to
> view a property.
>
> Thanks,
> Bruce.
>

No problem, glad I could help.

P.S.: Make sure you keep the list CC'd, so others can hear what you have
to say. ;-)
(Usually clicking "reply to all", or "reply to list" is enough, if your
mail client has them. Opera tends to put the list in the "To" field--don't
know if that's a bad thing or not, but I just copy it to the CC field
manually.)

--
Ben

Reply all
Reply to author
Forward
0 new messages