tylerlong / google-code-prettify

Automatically exported from code.google.com/p/google-code-prettify
Apache License 2.0
0 stars 0 forks source link

IE6 copy-paste issue for <xmp> #46

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. edit prettify_test.html
2. change pr_isIE6() to return true: function pr_isIE6() { return true; }
3. open prettify_test.html in IE6
4. highlight and copy the code block under "HTML using XMP"
5. paste it into a text editor

(Please include HTML, not just your source code)

What is the expected output?  What do you see instead?

[Expected Output]
<html>
  <head>
    <title>Fibonacci number</title>
  </head>
  <body>
    <noscript>
      <dl>
        <dt>Fibonacci numbers</dt>
...
</html>

[Actual Output]
<html>  <head>    <title>Fibonacci number</title>  </head>  <body>   
<noscript>      <dl>        <dt>Fibonacci numbers</dt> ... </html>

What version are you using?  On what browser?
Prettify revision 39 on IE6.

Please provide any additional information below.

looks like it's a tiny logic error in prettify.js :-) 

'cs' variable is not updated after <xmp> is replaced by new <pre> element.
Here's a patch to resolve the issue:

--- prettify.js (revision 39)
+++ prettify.js (working copy)
@@ -1142,7 +1142,7 @@

               // remove the old
               cs.parentNode.replaceChild(pre, cs);
-              pre = cs;
+              cs = pre;
             }

             // Replace <br>s with line-feeds so that copying and pasting works

Original issue reported on code.google.com by teohuiming on 6 Jul 2008 at 8:26

GoogleCodeExporter commented 9 years ago

Original comment by mikesamuel@gmail.com on 7 Jul 2008 at 5:44

GoogleCodeExporter commented 9 years ago

Original comment by mikesamuel@gmail.com on 13 Jul 2008 at 10:55