Comments (7)
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 google-code-prettify.
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 google-code-prettify.
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 google-code-prettify.
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 google-code-prettify.
Original comment by [email protected]
on 14 May 2009 at 6:00
- Changed state: Accepted
from google-code-prettify.
@r69
Original comment by [email protected]
on 14 May 2009 at 6:15
- Changed state: Fixed
from google-code-prettify.
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 google-code-prettify.
Related Issues (20)
- Perl syntax highlighting does not recognize POD and highlights quotes in comments
- Bash "$#" treated as comment HOT 1
- Integration for Presentation
- Patch for /trunk/src/lang-css.js
- "><img src=x onerror=prompt(1);> HOT 2
- Feature request: AspectJ syntax highlighting.
- gzip disabled
- Patch for /trunk/js-modules/run_prettify.js
- Patch for /trunk/src/lang-vb.js
- Line numbers carry over in clipboard using IE 11.
- Patch for /trunk/src/awkirin.css
- Problem with backslash in VB
- FLOW_CONTROL_KEYWORDS should not contain `do`
- Syntax Highlighting for Rebol (and Red) programming languages
- Patch for /trunk/styles/sons-of-obsidian.css
- Syntax highlight for Robot Framework syntax
- Patch for /trunk/src/prettify.css HOT 1
- Inconsist TCL Syntax higlighter
- Patch for /trunk/src/lang-sql.js
- Patch for /trunk/styles/sons-of-obsidian.css
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google-code-prettify.