cmark
My personal build of CMark ✏️
- Commit
- 200ef0233777cbe0d2deefc3365d4f563d31828c
- Parent
- 74f88deac274a3138af13daa76e265cfb93fd509
- Author
- John MacFarlane <jgm@berkeley.edu>
- Date
Don't use array buffer in HTML rendering.
Use straight string `+=` instead. This is supposedly faster
in browsers other than IE 7.
Diffstat
1 file changed, 5 insertions, 5 deletions
Status |
File Name |
N° Changes |
Insertions |
Deletions |
Modified |
js/lib/html.js |
10 |
5 |
5 |
diff --git 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) {