console.log(object) does not show a property when its name is an empty string

RESOLVED DUPLICATE of bug 996691

Status

RESOLVED DUPLICATE of bug 996691
5 years ago
2 months ago

People

(Reporter: igor, Unassigned)

Tracking

25 Branch

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
In Firefox 25 Beta console.log does not show an empty-string property name in an object. For example, console.log({"": 1}) printed [object Object]. When I clicked on that and expanded to see properties that just listed __proto__ without any mentioning of the empty string property with the value 1. Similarly console.log({"": 1, a: 2}) listed only "a" as a property without any mentioning of "".
(Reporter)

Updated

5 years ago
Summary: console.log does not show empty properties → console.log(object) does not show a property when its name is an empty string
(Reporter)

Comment 1

5 years ago
Another issue is that when a property name is whitespace, its value is not shown, even if the property listing reserves a space for it. console.log({"   ": 1, "\t": 2, a: 3}) shows space for 3 properties, but the values for "   " and "\t" are not given.
(Reporter)

Comment 2

5 years ago
Yet another issue is that properties with unprintable characters like "\x00" are shown as a whitespace. I think for debugging it would be better if any property that requires "" in the object literal should be shown as uneval(name).
My idea of why this would be useful is that you may be debugging code that creates objects and does not correctly set the name of a property.
Component: Developer Tools: Console → Developer Tools: Object Inspector

Updated

5 years ago
OS: Windows 7 → All
Hardware: x86 → All
This should be fixed by bug 808371 landing.
Depends on: 808371
(In reply to Brandon Benvie [:benvie] from comment #4)
> This should be fixed by bug 808371 landing.

Unfortunately, it doesn't look like it did get fixed; the object summary in the console lists the property, but the object inspector doesn't.
Duplicate of this bug: 1089462
(In reply to Igor Bukanov from comment #0)
> In Firefox 25 Beta console.log does not show an empty-string property name
> in an object.

I fixed that in bug 996691.

(In reply to Igor Bukanov from comment #1)
> Another issue is that when a property name is whitespace, its value is not
> shown

I fixed that in bug 997219.

(In reply to Igor Bukanov from comment #2)
> Yet another issue is that properties with unprintable characters like "\x00"
> are shown as a whitespace.

I think that was fixed as a result of bug 909344
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 996691

Updated

2 months ago
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.