Summary: | Ability to serialize an element subtree (into clipboard?) from the DOM inspector | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Eric Seidel (no email) <eric> | ||||||
Component: | Web Inspector (Deprecated) | Assignee: | Timothy Hatcher <timothy> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Enhancement | CC: | ap, mitz | ||||||
Priority: | P2 | ||||||||
Version: | 420+ | ||||||||
Hardware: | All | ||||||||
OS: | All | ||||||||
Attachments: |
|
Description
Eric Seidel (no email)
2006-12-31 20:03:14 PST
Created attachment 17165 [details]
Patch
Created attachment 17166 [details]
Patch
Comment on attachment 17166 [details]
Patch
r=me with the comment clarification Alexey mentioned in #webkit.
Comment on attachment 17166 [details]
Patch
+ and it's subtree is copied to the clipboard. If the node has no
Typo: it's -> its
+ var data = this.focusedDOMNode.outerHTML;
+ if (!data)
+ data = this.focusedDOMNode.nodeValue;
You should be able to use || for this.
+ if (this.currentFocusElement.handleCopyEvent)
+ event.preventDefault();
+ else if (this.currentFocusElement.id && this.currentFocusElement.id.length && WebInspector[this.currentFocusElement.id + "Copy"])
+ event.preventDefault();
I think this would be clearer with || instead of else if, though I suppose this way the code is more similar to documentCopy.
r=me
I've been playing with this feature to see if it lets one copy text from password fields (it apparently doesn't), and noticed a quirk - copying via a context menu gives different results than copying via a keyboard shortcut. E.g. when copying an input element from the tree, I just get "input". Right clicking selects the word under the mouse. And since there is a selection, we allow the normal copy path. I guess we should make this smarter somehow, but it will be tricky. The word being selected on right-click is actually in the breadcrumb, not right under the mouse! |