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 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 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 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 code-prettify.
Original comment by [email protected]
on 14 May 2009 at 6:00
- Changed state: Accepted
from code-prettify.
@r69
Original comment by [email protected]
on 14 May 2009 at 6:15
- Changed state: Fixed
from 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 code-prettify.
Related Issues (20)
- Add support for Chapel? HOT 2
- [Feature Request] Add diff / patch highlighting support for StackExchange websites. HOT 1
- Add support for Idris
- No GitHub wiki
- Add support for Perl6 HOT 1
- How to use `Google Code Prettifier` to VBA macro in Microsoft Excel ?
- Add support for AppleScript HOT 1
- White space indentation added on Firefox when using linenums class
- Performance problem with "Hit Test" in Chrome HOT 1
- Wrong highlighting on stackoverflow.com vba if default is used HOT 1
- Extra white-space appears on the first line HOT 1
- XSS risks?
- Request: terraform / hcl language support HOT 2
- Golang run-on string when backticks appear to be escaped
- Makefile: is it really supported?
- Request support of ChoiceScript language
- Added 'record' among Java keywords
- How auto justify codes?
- Request support for DigitalMicrograph Scripting language (DM-script)
- Add support to MiniZinc
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 code-prettify.