Closed Bug 924295 Opened 11 years ago Closed 8 years ago

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

Categories

(DevTools :: Object Inspector, defect)

25 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 996691

People

(Reporter: igor, Unassigned)

References

Details

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 "".
Summary: console.log does not show empty properties → console.log(object) does not show a property when its name is an empty string
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.
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
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.
(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
Closed: 8 years ago
Resolution: --- → DUPLICATE
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.