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

Commit

Permalink
fix line numbers on IE. On IE String.match returns a different value …
Browse files Browse the repository at this point in the history
…for unmatched groups and IE uses margin-left to indent lists.
  • Loading branch information
[email protected] committed Jul 21, 2010
1 parent 01b3777 commit ed2bf56
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/prettify.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
pre.prettyprint { padding: 2px; border: 1px solid #888; display: list }

/* Specify class=linenums on a pre to get line numbering */
ol.linenums { margin: 0 }
ol.linenums { margin-top: 0; margin-bottom: 0 } /* IE indents via margin-left */
li.L0,
li.L1,
li.L2,
Expand Down
3 changes: 2 additions & 1 deletion src/prettify.js
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,8 @@ window['_pr_isIE6'] = function () {
for (var i = 0; i < 10; ++i) {
lineBreaks[i] = lineBreakHtml + '</li><li class="L' + i + '">';
}
var lineNum = numberLines[1] - 1 || 0; // Lines are 1-indexed
var lineNum = numberLines[1] && numberLines[1].length
? numberLines[1] - 1 : 0; // Lines are 1-indexed
html.push('<ol class="linenums"><li class="L', (lineNum) % 10, '"');
if (lineNum) {
html.push(' value="', lineNum + 1, '"');
Expand Down

0 comments on commit ed2bf56

Please sign in to comment.