Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.

Commit 42ec81b

Browse files
documentation
1 parent da98ba0 commit 42ec81b

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

CHANGES.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,5 +137,19 @@ <h2>4 March 2011</h2>
137137
<li>Added support for XQuery courtesy Patrick Wied, Nemerle
138138
courtesy Zimin A.V., and Latex support courtesy Martin S.</li>
139139
</ul>
140+
<h2>29 March 2011</h2>
141+
<ul>
142+
<li>Fixed IE newline issues, and copying/pasting of prettified
143+
source code from IE. This required significant internal changes
144+
but involves no API changes.
145+
<b>Caveat:</b> <code>prettyPrintOne</code> injects the HTML
146+
passed to it into a <code>&lt;pre&gt;</code> element.
147+
If the HTML comes from a trusted source, this may allow XSS.
148+
Do not do this. This should not be a problem for existing apps
149+
since the standard usage is to rewrite the HTML and then inject
150+
it, so anyone doing that with untrusted HTML already has an XSS
151+
vulnerability. If you sanitize and prettify HTML from an
152+
untrusted source, sanitize first.
153+
</ul>
140154
</body>
141155
</html>

js-modules/recombineTagsAndDecorations.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ function recombineTagsAndDecorations(job) {
6969
var textNode = spans[spanIndex + 1];
7070
if (textNode.nodeType !== 1) { // Don't muck with <BR>s or <LI>s
7171
var styledText = source.substring(sourceIndex, end);
72+
// This may seem bizarre, and it is. Emitting LF on IE causes the
73+
// code to display with spaces instead of line breaks.
74+
// Emitting Windows standard issue linebreaks (CRLF) causes a blank
75+
// space to appear at the beginning of every line but the first.
76+
// Emitting an old Mac OS 9 line separator makes everything spiffy.
7277
if (isIE) { styledText = styledText.replace(newlineRe, '\r'); }
7378
textNode.nodeValue = styledText;
7479
var document = textNode.ownerDocument;

0 commit comments

Comments
 (0)