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

Commit 28ba1c5

Browse files
author
mikesamuel
committed
Fix bugs 46 and 47 - copy&paste and xmp tags on IE6
1 parent 6f4a2d6 commit 28ba1c5

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

README.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ <h3>How do I specify which language my code is in?</h3>
8585
<p>You don't need to specify the language since <code>prettyprint()</code>
8686
will guess. You can specify a language by specifying the language extension
8787
along with the <code>prettyprint</code> class like so:</p>
88-
<code class="prettyprint lang-html">
89-
&lt;pre class=&quot;prettyprint <b>lang-html</b>&quot;&gt;<br>
90-
&nbsp; The lang-* class specifies the language file extensions.<br>
91-
&nbsp; Supported file extensions include<br>
92-
&nbsp; &nbsp; "c", "cc", "cpp", "cs", "cyc", "java", "bsh", "csh", "sh",<br>
93-
&nbsp; &nbsp; "cv", "py", "perl", "pl", "pm", "rb", "js",<br>
94-
&nbsp; &nbsp; "html", "html", "xhtml", "xml", "xsl".<br>
95-
&lt;/pre&gt;</code>
88+
<pre class="prettyprint lang-html"
89+
>&lt;pre class=&quot;prettyprint <b>lang-html</b>&quot;&gt;
90+
The lang-* class specifies the language file extensions.
91+
Supported file extensions include
92+
"c", "cc", "cpp", "cs", "cyc", "java", "bsh", "csh", "sh",
93+
"cv", "py", "perl", "pl", "pm", "rb", "js",
94+
"html", "html", "xhtml", "xml", "xsl".
95+
&lt;/pre&gt;</pre>
9696

9797
<h3>It doesn't work on <tt>&lt;obfuscated code sample&gt;</tt>?</h3>
9898
<p>Yes. Prettifying obfuscated code is like putting lipstick on a pig

src/prettify.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,14 +1147,19 @@ function pr_isIE6() {
11471147
for (var i = 0; i < cs.attributes.length; ++i) {
11481148
var a = cs.attributes[i];
11491149
if (a.specified) {
1150-
pre.setAttribute(a.name, a.value);
1150+
var aname = a.name.toLowerCase();
1151+
if (aname === 'class') {
1152+
pre.className = a.value; // For IE 6
1153+
} else {
1154+
pre.setAttribute(a.name, a.value);
1155+
}
11511156
}
11521157
}
11531158
pre.innerHTML = newContent;
11541159

11551160
// remove the old
11561161
cs.parentNode.replaceChild(pre, cs);
1157-
pre = cs;
1162+
cs = pre;
11581163
}
11591164

11601165
// Replace <br>s with line-feeds so that copying and pasting works

0 commit comments

Comments
 (0)