Closed
Bug 1244916
Opened 8 years ago
Closed 8 years ago
JSON Viewer: empty arrays should hide the zero count
Categories
(DevTools :: JSON Viewer, defect)
DevTools
JSON Viewer
Tracking
(firefox50 fixed)
RESOLVED
FIXED
Firefox 50
Tracking | Status | |
---|---|---|
firefox50 | --- | fixed |
People
(Reporter: clarkbw, Assigned: dalimil)
References
Details
Attachments
(1 file, 1 obsolete file)
3.44 KB,
patch
|
Honza
:
review+
|
Details | Diff | Splinter Review |
Helen, what do you think about hiding the size count when the size is zero? via bug 1223143 comment 7 > ## JSON tab - misleading representation of empty arrays > > Empty arrays are represented as: > > key_name [0] > > (or "key_name: [0]" in object summaries) > > This, and the syntax coloring used (the zero is green, like a number literal > in the Console) suggests that the value for key_name is an array with one > value, the number 0. Yet the value is an *empty* array. > > It should probably be represented as "key_name: []". > > For the record, empty objects are: "key_name { }". I wouldn't characterize the 0 as misleading, however it does seem superfluous given the colouring and that an empty array would give just as much meaning without confusing the eye.
Reporter | ||
Updated•8 years ago
|
Summary: JSON VIewer: empty arrays should hide the zero count → JSON Viewer: empty arrays should hide the zero count
Assignee | ||
Comment 1•8 years ago
|
||
I made a patch that removes the array length from the brackets when it's equal to 0.
Reporter | ||
Comment 2•8 years ago
|
||
Comment on attachment 8770156 [details] [diff] [review] rev1 Awesome work! I'm going to re-assign this to Honza who can do the review.
Attachment #8770156 -
Flags: review?(clarkbw) → review?(odvarko)
Comment 3•8 years ago
|
||
Lin, I like this and it's also inline with how the Console works now. Just one little thing. The console displays two spaces between the brackets: Logging: `[]` produces: `Array [ ]` I think there shouldn't be space at all (Chrome works that way too, ah and no `Array` title): Logging: `[]` produces: `[]` What do you think? Honza
Flags: needinfo?(lclark)
Comment 5•8 years ago
|
||
Comment on attachment 8770156 [details] [diff] [review] rev1 Review of attachment 8770156 [details] [diff] [review]: ----------------------------------------------------------------- Thanks for the patch! Please see my inline comments. Honza ::: devtools/client/shared/components/reps/array.js @@ +127,5 @@ > let items; > > if (mode == "tiny") { > + let isEmpty = object.length === 0; > + items = DOM.span({className: "length"}, isEmpty ? "" : object.length); The same thing needs to be done also for GripArray rep (grip-array.js) We have two since, there are two kinds of reps: 1) For JS objects that are directly accessible 2) For remote JS objects that are accessible through RDP/grips And I guess, tests also need to be adopted. There are two tests: devtools/client/shared/components/test/mochitest/test_reps_array.html devtools/client/shared/components/test/mochitest/test_reps_grip-array.html Honza
Attachment #8770156 -
Flags: review?(odvarko)
Assignee | ||
Comment 6•8 years ago
|
||
I changed the grip-array.js and the tests. Although I am still not quite sure where I can see the grip-array being used in the browser...
Attachment #8770156 -
Attachment is obsolete: true
Attachment #8771437 -
Flags: review?(odvarko)
Comment 7•8 years ago
|
||
Comment on attachment 8771437 [details] [diff] [review] rev2 Review of attachment 8771437 [details] [diff] [review]: ----------------------------------------------------------------- Nice! > Although I am still not quite > sure where I can see the grip-array being used in the browser... E.g. in the DOM panel (can be enabled in the Options panel) Honza
Attachment #8771437 -
Flags: review?(odvarko) → review+
Comment 8•8 years ago
|
||
Push to try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=d837b0adc0af Honza
Assignee | ||
Updated•8 years ago
|
Keywords: checkin-needed
Pushed by ryanvm@gmail.com: https://hg.mozilla.org/integration/fx-team/rev/f4c0b8d3e348 JSON Viewer: empty arrays should hide the zero count. r=odvarko
Keywords: checkin-needed
Comment 10•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/f4c0b8d3e348
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox50:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 50
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•