Giter VIP home page Giter VIP logo

Comments (7)

GoogleCodeExporter avatar GoogleCodeExporter commented on May 25, 2024
I can't repeat the error on either Firefox 2 or IE 6.

I added the following to the unittest and it passes for me.
Am I misunderstanding the bug?

$ svn diff tests/prettify_test.html
Index: tests/prettify_test.html
===================================================================
--- tests/prettify_test.html    (revision 34)
+++ tests/prettify_test.html    (working copy)
@@ -458,7 +458,12 @@
 <p>And another one inside the end tag</p<!-- GOTCHA!! -->>
 </pre>

+<h1>Bug 20 - missing blank lines</h1>
+<pre class="prettyprint" id="issue20"
+><html>

+<head></pre>
+
 </body>

 <script type="text/javascript">
@@ -1051,7 +1056,11 @@
       '`COM<!-- There\'s an `END<acronym title="tag soup">`COMHTML`END' +
            '</acronym>`COM comment in my comment -->`END`PLN<br>' +
       '`END`PUN<`END`TAGp`END`PUN>`END`PLNAnd another one inside the end
tag`END' +
-      '`PUN</`END`TAGp`END`PUN>`END')
+      '`PUN</`END`TAGp`END`PUN>`END'),
+  issue20: (
+      '`PUN<`END`TAGhtml`END`PUN>`END`PLN<br>' +
+      '<br>' +
+      '`END`PUN<`END`TAGhead`END`PUN>`END')
 };

Original comment by [email protected] on 23 Oct 2007 at 1:39

from code-prettify.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 25, 2024
I do not know why you cannot reproduce it. I KNOW that every blank line was 
being 
ignored/removed when Prettify ran. Note that there is nothing on the lines, not 
even 
a <br>.

My editing platform is Windows XP, using Visual Studio 2003. So, line breaks 
are a 
CR LF pair (\r\n). And I was using the 22 May 2007 version of Prettify.

Original comment by [email protected] on 24 Oct 2007 at 1:57

from code-prettify.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 25, 2024
After some testing, I confirm that IE browsers collapse multiple adjacent <br>s 
(e.g.
<br><br><br>) into 1 line break. 

prettify.js (revision 39) passes the "Bug 20" test in prettify_test.html on IE6,
simply because all <br>s have been replaced with 
document.createTextNode('\r\n').
This problem will still show up in IE7. I attach a test file to further 
illustrate
this issue.

A possible workaround is to add ' ' in front of every <br>. This workaround 
also
seems to work along with other browsers (tested on FF3, Opera9.5, Safari3.1.2). 

Here's a patch of the workaround:

--- prettify.js (revision 39)
+++ prettify.js (working copy)
@@ -1158,6 +1158,11 @@
                     document.createTextNode('\r\n'), lineBreak);
               }
             }
+            // IE collapses multiple adjacient <br>s into 1 line break.
+            // Prefix every <br> with ' ' can prevent such IE's behavior.
+            if (!isIE6) {
+              cs.innerHTML = cs.innerHTML.replace(/(<br[^>]*>)/ig, ' $1');
+            }
           }
         }
       }

Original comment by teohuiming on 7 Jul 2008 at 3:20

Attachments:

from code-prettify.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 25, 2024
Would you please accept this patch? With IE8, this issue is still there. And 
for 
languages support multiple lines string (Ruby, Python, Perl...), this issue 
will 
break the code.

Original comment by [email protected] on 8 Mar 2009 at 4:33

from code-prettify.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 25, 2024

Original comment by [email protected] on 14 May 2009 at 6:00

  • Changed state: Accepted

from code-prettify.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 25, 2024
@r69

Original comment by [email protected] on 14 May 2009 at 6:15

  • Changed state: Fixed

from code-prettify.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 25, 2024
Has this fix been put into production yet? I'm still seeing problem with IE8, 
for 
example, the following displays fine in Firefox 3, but all of the indentation 
whitespace is collapsed in IE8:

http://code.google.com/p/gaevfs/source/browse/trunk/src/com/newatlanta/commons/v
fs/pr
ovider/gae/GaeVfsServlet.java

I got here by following links from this issue:

http://code.google.com/p/support/issues/detail?id=1947

Original comment by [email protected] on 24 Jun 2009 at 11:36

from code-prettify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.