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

Commit ed2bf56

Browse files
fix line numbers on IE. On IE String.match returns a different value for unmatched groups and IE uses margin-left to indent lists.
1 parent 01b3777 commit ed2bf56

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/prettify.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
pre.prettyprint { padding: 2px; border: 1px solid #888; display: list }
1515

1616
/* Specify class=linenums on a pre to get line numbering */
17-
ol.linenums { margin: 0 }
17+
ol.linenums { margin-top: 0; margin-bottom: 0 } /* IE indents via margin-left */
1818
li.L0,
1919
li.L1,
2020
li.L2,

src/prettify.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,8 @@ window['_pr_isIE6'] = function () {
11131113
for (var i = 0; i < 10; ++i) {
11141114
lineBreaks[i] = lineBreakHtml + '</li><li class="L' + i + '">';
11151115
}
1116-
var lineNum = numberLines[1] - 1 || 0; // Lines are 1-indexed
1116+
var lineNum = numberLines[1] && numberLines[1].length
1117+
? numberLines[1] - 1 : 0; // Lines are 1-indexed
11171118
html.push('<ol class="linenums"><li class="L', (lineNum) % 10, '"');
11181119
if (lineNum) {
11191120
html.push(' value="', lineNum + 1, '"');

0 commit comments

Comments
 (0)