Closed
Bug 113793
Opened 23 years ago
Closed 23 years ago
Node type should display human readable name, not value
Categories
(Other Applications :: DOM Inspector, enhancement)
Other Applications
DOM Inspector
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla0.9.8
People
(Reporter: caillon, Assigned: caillon)
References
()
Details
Attachments
(2 files, 2 obsolete files)
2.03 KB,
patch
|
Details | Diff | Splinter Review | |
3.67 KB,
patch
|
bzbarsky
:
review+
hewitt
:
superreview+
|
Details | Diff | Splinter Review |
Inspector should report human readable values for Node type. At the least
ELEMENT_NODE, ATTRIBUTE_NODE, TEXT_NODE, etc. but preferably 'Element',
'Attribute', 'Text', etc.
Assignee | ||
Comment 1•23 years ago
|
||
Taking. some good old fashioned JS magic can fix this.
Assignee: hewitt → caillon
Assignee | ||
Comment 2•23 years ago
|
||
Assignee | ||
Comment 3•23 years ago
|
||
The patch I just uploaded takes care of this for both the DOM Object viewer and
Javascript Object viewer, within the DOM window and inspecting in a new window.
utils.js seemed the best place for the nodeTypeToText function. I also included
more node types than we currently display in that function for completeness. No
sense in re-doing it later to add more node types if we display them in the
future. If anyone disagrees though, I can change it.
bz, would you review please?
![]() |
||
Comment 4•23 years ago
|
||
There is no need to do the toString business and then compare to random
stringified numbers:
switch (nodeType) {
case Node.ELEMENT_NODE: return "Element";
case Node.ATTRIBUTE_NODE: return "Attribute";
...
}
Do that and r=bzbarsky
Another note, though. See
http://lxr.mozilla.org/seamonkey/source/extensions/inspector/base/src/inDOMView.cpp#310
-- that has some code that already does something similar... if that can be
shared somehow, that would be great.
Assignee | ||
Comment 5•23 years ago
|
||
Sorry for the delay in getting this out. I had connectivity issues @home.
Anyway, this patch should do things the "Right Way" (tm). I moved the function
call in jsObject.js up, to prevent nodeType getting cast to a string, and added
the proper constants in the switch.
Attachment #60720 -
Attachment is obsolete: true
![]() |
||
Comment 6•23 years ago
|
||
Comment on attachment 61539 [details] [diff] [review]
Patch v2
r=bzbarsky
Attachment #61539 -
Flags: review+
Comment 7•23 years ago
|
||
This is a great idea for the DOM Node viewer, but I'm against changing nodeType
to a string in the js object viewer - that viewer should always give back
straight values for each property. Also, could you change your if/else syntax
to be like this:
if (1) {
} else {
}
Assignee | ||
Comment 8•23 years ago
|
||
Can we display the constant names as opposed to the int values for the JS Object
viewer then? Node.ELEMENT_NODE, Node.ATTRIBUTE_NODE, etc
Technically it would be a straight value as it's a constant, just not the
numeric representation, and would offer some clue as to the type of node to a
user who doesn't want to (or know how to) figure out what each nodeType is...
The downside is of course that users might not realize it is a constant as
opposed to a string containing text "Node.ELEMENT_NODE" etc, though the fact
that there won't be double quotes surrounding it should alert them to that. I'd
love to have a more visual representation in the JS Object viewer than 1, 2, 3,
but I'll leave the decision to you.
(Yes I do realize the irony of this coming from someone who use 1, 2, 3, etc in
the first version of the patch :)
I'll change the if/else syntax in the next patch.
Assignee | ||
Updated•23 years ago
|
Target Milestone: --- → mozilla0.9.8
Assignee | ||
Comment 9•23 years ago
|
||
This patch is just for DOM Node viewer and fixes the if/else bracketing syntax.
After some thought though, I'm wondering if we should do this in tooltipText.
This way we can still implement this functionality for JS Object Viewer while
keeping the actual value in the <textbox>. The JS Object viewer and DOM viewer
should be consistent IMO, and if they both display tooltips containing their
human readable names, I would be fine with that.
Comments?
Attachment #61539 -
Attachment is obsolete: true
Assignee | ||
Comment 10•23 years ago
|
||
![]() |
||
Comment 11•23 years ago
|
||
Comment on attachment 63634 [details] [diff] [review]
Patch using tooltiptext instead of altering the .value
r=bzbarsky
Attachment #63634 -
Flags: review+
Comment 12•23 years ago
|
||
Comment on attachment 63634 [details] [diff] [review]
Patch using tooltiptext instead of altering the .value
sr=hewitt
Attachment #63634 -
Flags: superreview+
![]() |
||
Comment 13•23 years ago
|
||
checked into trunk
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Updated•20 years ago
|
Product: Core → Other Applications
Updated•18 years ago
|
QA Contact: timeless → dom-inspector
You need to log in
before you can comment on or make changes to this bug.
Description
•