Copy in the right-click menu in the DOM inspector nodeName/nodeValue doesn't work

RESOLVED FIXED

Status

RESOLVED FIXED
15 years ago
12 years ago

People

(Reporter: klassphere, Assigned: jason.barnabe)

Tracking

Trunk
x86
Windows XP
Bug Flags:
blocking-aviary1.5 -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 obsolete attachments)

(Reporter)

Description

15 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a) Gecko/20040505 Firefox/0.8.0+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a) Gecko/20040505 Firefox/0.8.0+

Copy in the right-click menu in the DOM inspector nodeName/nodeValue doesn't work.

Reproducible: Always
Steps to Reproduce:
1. Go to http://www.google.com/ and open the DOM inspector
2. See the node #document -> HTML -> HEAD -> META
3. Hilight a row, "content" or "http-equiv" in the nodeName/nodeValue grid
4. Right-click and select Copy
Actual Results:  
The clipboard contains nothing

Expected Results:  
The clipboard should contain a nodeName/nodeValue pair.

Comment 1

15 years ago
On Linux with nightly version 20040812 of Mozilla.

When I do "Copy" from the context menu and paste into KEdit, the previous contents
of the clipbard are returned.... in my case "http://www.google.com/".

If I do copy XML, the following is returned:
"<META content="text/html; charset=UTF-8" http-equiv="content-type"/>"
This appears to be correct.

Updated

14 years ago
Status: UNCONFIRMED → NEW
Ever confirmed: true
Product: Core → Other Applications
(Reporter)

Updated

14 years ago
Flags: blocking-aviary1.1?
Reporter:  Please explain what you expect to be in the clipboard.  The clipboard
can only be reasonably expected to hold one thing at a time.  Do you mean
something like:

"target='foo'"?

Also, why should this block aviary1.1?
(Reporter)

Comment 3

14 years ago
(In reply to comment #2)
> Reporter:  Please explain what you expect to be in the clipboard.  The clipboard
> can only be reasonably expected to hold one thing at a time.  Do you mean
> something like:
> 
> "target='foo'"?

I think it's sufficient ("target='foo'"). But when you choose "Edit" in the same
context menu, the edit box only picks up nodeValue.

> Also, why should this block aviary1.1?

Because there's "Copy" in the context menu and it does nothing. VERY apparent
bug, IMHO. 

Updated

14 years ago
Flags: blocking-aviary1.1? → blocking-aviary1.1-

Comment 4

14 years ago
(In reply to comment #3)

> Because there's "Copy" in the context menu and it does nothing. VERY apparent
> bug, IMHO. 

Actually, it does do something. The node is copied and can be pasted elsewhere.
If you select a node in the document tree and then "copy", that node can be
pasted at another location in the tree. When copying a node in the object pane,
that node can be pasted to another object. It seems copy and paste only work
within the scope of the DOM inspector.

Comment 5

13 years ago
Alex,

The clipboard can hold multiple flavors of a piece of data at the same time (see
[Introduction To The Clipboard and Drag &
Drop](http://www.mozilla.org/xpfe/xptoolkit/introClipDD.html) and [Using the
Clipboard](http://www.xulplanet.com/tutorials/xultu/clipboard.html)). Right now,
DOM Inspector only uses one flavor at a time, in this case "inspector/dom-node".

Fixing this bug entails adding additional data to the clipboard when name/value
pairs are copied from the DOM Node view, with a flavor of "text/unicode" and
data like "foo='bar'".  In the future, you may also want to make panelset's
clipboard attributes aware of multi-flavored data, but this does not seem to be
necessary (yet).
(Assignee)

Comment 6

13 years ago
Created attachment 213413 [details] [diff] [review]
patch v1

The DOM Inspector doesn't actually use the clipboard for moving attributes around itself - it just stores them in variables. I was going to make it use the clipboard for all clipboard operations, but nsITransferable requires that you provide the length of the data to copy, and how do you get the length of a DOM node?

Instead, this patch keeps the DOM node as an internal variable but also copies a string in the form nodeName="nodeValue" to the clipboard.

This patch also cleans up some stuff related to Undo. It makes Undo not affect the clipboard and makes Copy not count as a transaction that can be Undone.
Assignee: dom-inspector → jason_barnabe
Status: NEW → ASSIGNED
Attachment #213413 - Flags: review?(timeless)
(Assignee)

Comment 7

13 years ago
Created attachment 213505 [details] [diff] [review]
patch v2

timeless give r+ over IRC on the condition that I move the clipboard helper and charTable somewhere that they don't have to be recreated every time.
Attachment #213413 - Attachment is obsolete: true
Attachment #213505 - Flags: superreview?(neil)
Attachment #213505 - Flags: review+
Attachment #213413 - Flags: review?(timeless)
Comment on attachment 213505 [details] [diff] [review]
patch v2

>+var kEntityConverter;
Please change this back to gEntityConverter; k is for Konstant.

>+    const entityVersion = Components.interfaces.nsIEntityConverter.entityW3C;
It looks odd to declare this after it's used!

>+    var str = text;
No idea what this is for; please fix to use the same variable throughout.
Attachment #213505 - Flags: superreview?(neil) → superreview+
(Assignee)

Comment 9

13 years ago
Created attachment 214094 [details] [diff] [review]
patch v3

Updated to comments.
Attachment #213505 - Attachment is obsolete: true

Comment 10

13 years ago
Comment on attachment 214094 [details] [diff] [review]
patch v3

mozilla/extensions/inspector/resources/content/viewers/domNode/domNode.js 	1.18
mozilla/extensions/inspector/resources/content/viewers/dom/dom.js 	1.38
mozilla/extensions/inspector/resources/content/utils.js 	1.12
mozilla/extensions/inspector/resources/content/inspector.xml 	1.19
Attachment #214094 - Attachment is obsolete: true
(Assignee)

Updated

13 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → FIXED
(Assignee)

Comment 11

13 years ago
*** Bug 328201 has been marked as a duplicate of this bug. ***
QA Contact: timeless → dom-inspector
You need to log in before you can comment on or make changes to this bug.