diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-01-10 14:34:04 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-01-10 14:34:04 -0800 |
commit | 200ef0233777cbe0d2deefc3365d4f563d31828c (patch) | |
tree | b7e216ef1a7dfd2d3e96be817f402cf0cb058149 | |
parent | 74f88deac274a3138af13daa76e265cfb93fd509 (diff) |
Don't use array buffer in HTML rendering.
Use straight string `+=` instead. This is supposedly faster
in browsers other than IE 7.
-rw-r--r-- | js/lib/html.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/js/lib/html.js b/js/lib/html.js index 26c677b..5cf3def 100644 --- a/js/lib/html.js +++ b/js/lib/html.js @@ -26,19 +26,19 @@ var renderNodes = function(block, options) { var tagname; var walker = block.walker(); var event, node, entering; - var buffer = []; + var buffer = ""; var disableTags = 0; var grandparent; var out = function(s) { if (disableTags > 0) { - buffer.push(s.replace(/\<[^>]*\>/g, '')); + buffer += s.replace(/\<[^>]*\>/g, ''); } else { - buffer.push(s); + buffer += s; } }; var esc = this.escape; var cr = function() { - if (buffer.length > 0 && buffer[buffer.length - 1] !== '\n') { + if (buffer.length > 0 && buffer.charAt[buffer.length - 1] !== '\n') { out('\n'); } }; @@ -224,7 +224,7 @@ var renderNodes = function(block, options) { } } - return buffer.join(''); + return buffer; }; var sub = function(s) { |