Fix IE8 issues
- Fix error that happens on load: 'tokens' is null or not an object - Syntax highlighting didn't actually work due to IE8 match semantics being different (empty string, not undefined, returned unmatched capturing groups)
This commit is contained in:
parent
a8fc812bad
commit
dae577b086
2 changed files with 3 additions and 2 deletions
|
|
@ -227,7 +227,8 @@ var Text = function(parentEl) {
|
|||
style.width = config.width + "px";
|
||||
|
||||
var html = [];
|
||||
this.$renderLine(html, row, tokens[row-firstRow].tokens);
|
||||
if (tokens.length > row-firstRow)
|
||||
this.$renderLine(html, row, tokens[row-firstRow].tokens);
|
||||
// don't use setInnerHtml since we are working with an empty DIV
|
||||
lineEl.innerHTML = html.join("");
|
||||
fragment.appendChild(lineEl);
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ var Tokenizer = function(rules) {
|
|||
}
|
||||
|
||||
for ( var i = 0; i < state.length; i++) {
|
||||
if (match[i + 1] !== undefined) {
|
||||
if (match[i + 1] !== undefined && match[i + 1].length) {
|
||||
if (typeof state[i].token == "function") {
|
||||
type = state[i].token(match[0]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue