Bug 10273 - Copy and Paste of Javascript from the Inspector doesn't work properly
Summary: Copy and Paste of Javascript from the Inspector doesn't work properly
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: http://www.google-analytics.com/urchi...
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-05 14:35 PDT by Gavin Sherlock
Modified: 2014-01-12 10:37 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gavin Sherlock 2006-08-05 14:35:16 PDT
Open Webkit nightly.
Attach Drosera.
Go to : http://webkit.opendarwin.org/
In Drosera, look at source for http://www.google-analytics.com/urchin.js
Copy multiple lines, and Paste to Microsoft Word.

Expected Results:

Code, with syntax coloring will be pasted
Actual Results:

A blank table is pasted, with as many rows as there were line of code.

Workaround : Paste one line at a time.
Comment 1 Gavin Sherlock 2006-08-05 14:44:32 PDT
Additional workaround:

Use Paste Special, and select Styled Text.  However, the syntax coloring is then incorrect, with the colors being shifted forward with respect to the text that they are coloring.
Comment 2 Alexey Proskuryakov 2006-08-14 10:43:37 PDT
I can confirm the behavior, but it's not clear whether the issue is within WebKit.

The problem with styled text might well be an entirely separate one (at a first glance, looks like 'ustl' clipboard flavor is generated incorrectly).
Comment 3 Timothy Hatcher 2008-05-17 09:06:24 PDT
Is this an issue with the Web Inspector's code views?
Comment 4 Gavin Sherlock 2008-05-17 11:51:33 PDT
Alas, there is no syntax coloring in the Web Inspector's view of the code, so the bug is now irrelevant.  However, loss of syntax coloring is a step backwards.  Should I file a bug on that?  It would also be nice if the javascript code were pretty printed in the Web Inspector - should I file a bug for that too?
Comment 5 Gavin Sherlock 2008-05-17 11:55:05 PDT
I should note  that I was testing with r33475 in case this behavior has changed since then (though this was the latest downloadable revision).
Comment 6 Timothy Hatcher 2008-05-25 14:07:20 PDT
We have bugs about those two issues.
Comment 7 Timothy Hatcher 2008-08-19 11:42:47 PDT
Now that we have syntax highlighting again, does it reproduce in the Inspector?
Comment 8 Gavin Sherlock 2008-08-19 11:55:30 PDT
Testing with r35814, I still see this bug.

For this case, I went to:

http://smd.stanford.edu/js/ontology/v1/ExampleProduction.html

Selected:

http://smd.stanford.edu/js/ontology/v1/OntologyTreeBrowser.js

in the Resources list, then copied and pasted, using Paste Special->Styled Text, to Word, the following code snippet:

function OntologyTreeBrowser(uid) {
      this.tree = new YAHOO.widget.TreeView ('treediv'+uid);
      this.uid = uid;
      /** now there is a div to store the highlighted id as in div id='highlight'+uid, value= **/
      
  }

From this.tree, the syntax highlighting starts to veer off.

Comment 9 Gavin Sherlock 2008-08-19 16:06:44 PDT
Updated title to reflect Inspector, rather than Drosera.
Comment 10 Joseph Pecoraro 2009-10-02 22:38:35 PDT
(In reply to comment #8)
> Testing with r35814, I still see this bug.
> 
> For this case, I went to:
> http://smd.stanford.edu/js/ontology/v1/ExampleProduction.html
> 
> Selected:
> http://smd.stanford.edu/js/ontology/v1/OntologyTreeBrowser.js
> 
> in the Resources list, then copied and pasted, using Paste Special->Styled
> Text, to Word, the following code snippet:
> 
> function OntologyTreeBrowser(uid) {
>       this.tree = new YAHOO.widget.TreeView ('treediv'+uid);
>       this.uid = uid;
>       /** now there is a div to store the highlighted id as in div
> id='highlight'+uid, value= **/
> 
>   }
> 
> From this.tree, the syntax highlighting starts to veer off.

I just played with this in Pages with r49008. It pasted with and without style perfectly in Pages. Is this an issue specific to Microsoft Word?  Does anyone have Word and can verify if this is still an issue?
Comment 11 Gavin Sherlock 2009-10-03 00:11:14 PDT
It still has the buggy behavior exactly as described in comment #8 with Word 2008 with r49032.  I tried with Pages 09, and it kind of works, in that the syntax highlighting is correct, but the text is still pasted as a table, rather than just as lines of styled text.  Oddly, copying and pasting the table from Pages then into Word works correctly....
Comment 12 Alexander Pavlov (apavlov) 2011-09-06 09:01:22 PDT
As of r94572, the text is pasted as a single flow, but all leading spaces are not preserved (presumably, due to the fact that all whitespace is collapsed in HTML, unlike  )
Comment 13 BJ Burg 2014-01-12 10:37:23 PST
The inspector now uses CodeMirror as its text editor widget. Please re-open if this is still relevant on recent nightlies.