RESOLVED FIXED20695
Inspector should display Array lengths in the property lists
https://bugs.webkit.org/show_bug.cgi?id=20695
Summary Inspector should display Array lengths in the property lists
Oliver Hunt
Reported 2008-09-07 01:22:57 PDT
When looking at arrays in the scope pane their contents are sorted lexically rather than numerically. Would also be helpful to have length info presented early.
Attachments
Add lengths to the description of Arrays, NodeLists, and HTMLCollections in the Inspector property lists (1.16 KB, patch)
2010-02-14 10:53 PST, Jessie Berlin
no flags
Add lengths to the description of Arrays, NodeLists, and HTMLCollections in the Inspector property lists (and not in the console as well) (2.32 KB, patch)
2010-02-14 13:54 PST, Jessie Berlin
no flags
Add lengths to the description of Arrays, NodeLists, and HTMLCollections in the Inspector property lists (Fixed issues cited in comments) (2.33 KB, patch)
2010-02-14 18:50 PST, Jessie Berlin
timothy: review+
Joseph Pecoraro
Comment 1 2009-09-14 13:33:35 PDT
The array sorting was fixed in: https://bugs.webkit.org/show_bug.cgi?id=27329 However, listing the "length" doesn't currently happen. Is this still wanted?
Timothy Hatcher
Comment 2 2009-09-14 13:44:01 PDT
I think we should show length, but not mixed with the number properties. But as a number next to the object name. We could/should do this for anythign with a length I think, so NodeLists, etc. So it would look like this: forBar: Array (2) 0: "def" 1: "abc" Or: myElement: HTMLDivElement childNodes: NodeList (2) 0: HTMLDivElement 1: HTMLDivElement ...
Brian Weinstein
Comment 3 2009-10-30 17:14:23 PDT
Do we show the name anymore? This would be straightforward, but with some tests I'm not sure the best place to put it: > a [5, 4, 3, 2, 3, 3, 3] Should it look something like: > a Length: 5 [5, 4, 3, 2, 3, 3, 3] or > a 5 Items [5, 4, 3, 2, 3, 3, 3] I'm just not sure the best way to put this in the UI, now that we don't explicitly state Array - however, we could do that.
Timothy Hatcher
Comment 4 2009-10-30 17:23:18 PDT
For property lists we still show the name (Array), or we should. So my proposal would still stand: Array (2), etc. You are thinking of logging. I don't think we need to show the lenght when logging an array like you did. Only if you do: dir(a) would we show what I mention and what this bug is about.
Jessie Berlin
Comment 5 2010-02-14 10:53:30 PST
Created attachment 48729 [details] Add lengths to the description of Arrays, NodeLists, and HTMLCollections in the Inspector property lists
Brian Weinstein
Comment 6 2010-02-14 11:03:52 PST
(In reply to comment #5) > Created an attachment (id=48729) [details] > Add lengths to the description of Arrays, NodeLists, and HTMLCollections in the > Inspector property lists There arensome inspector layout tests that can test the console output (and output of console.dir). Does this break any tests/could this be tested?
Jessie Berlin
Comment 7 2010-02-14 12:09:27 PST
Comment on attachment 48729 [details] Add lengths to the description of Arrays, NodeLists, and HTMLCollections in the Inspector property lists I need to make sure that the length doesn't get appended to the description in the console as well.
Timothy Hatcher
Comment 8 2010-02-14 13:27:00 PST
I think length in console would be useful.
Jessie Berlin
Comment 9 2010-02-14 13:54:02 PST
Created attachment 48731 [details] Add lengths to the description of Arrays, NodeLists, and HTMLCollections in the Inspector property lists (and not in the console as well)
Jessie Berlin
Comment 10 2010-02-14 13:55:56 PST
(In reply to comment #8) > I think length in console would be useful. Same format as in the properties list?
Timothy Hatcher
Comment 11 2010-02-14 14:02:51 PST
I guess we don't have a good place in the console to show it. Nevermind for now.
Timothy Hatcher
Comment 12 2010-02-14 14:07:49 PST
Comment on attachment 48731 [details] Add lengths to the description of Arrays, NodeLists, and HTMLCollections in the Inspector property lists (and not in the console as well) > diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog > + if (result.type == "array") Use ===. > + if (this.property.value.propertyLength !== undefined) Should be: typeof this.property.value.propertyLength !== "undefined"
Jessie Berlin
Comment 13 2010-02-14 18:50:32 PST
Created attachment 48738 [details] Add lengths to the description of Arrays, NodeLists, and HTMLCollections in the Inspector property lists (Fixed issues cited in comments)
Jessie Berlin
Comment 14 2010-02-16 18:28:50 PST
Thanks for the review! Committed in r54856: http://trac.webkit.org/changeset/54856
Note You need to log in before you can comment on or make changes to this bug.