githubramakrishnan / google-code-prettify

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

New lines created with <br> aren't retained when copying and pasting in IE9 #188

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create an element that contains <br> tags, for instance:
    <pre class="prettyprint lang-java">public class Empty{<br>}</pre>
2. Call prettyPrint()
3. Open the page in IE9
4. Try to copy and paste the code into a text editor, and note that the line 
break is lost

Replacing the <br> with a newline seems to fix the problem. For instance, using 
a bit of jQuery:

    $(".prettyprint br").each(function(index, element) {
      $(element).replaceWith(document.createTextNode("\n"));
    });

A simple example is attached.

Original issue reported on code.google.com by michael....@red-gate.com on 6 Feb 2012 at 11:53

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by mikesamuel@gmail.com on 30 Mar 2012 at 4:16