From e20d649dee45f63dcfb61feb71a6fc42d1333f03 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 9 Dec 2013 12:54:10 -0500 Subject: [PATCH] FIX: Performance issue with `[\]` characters. --- vendor/assets/javascripts/better_markdown.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vendor/assets/javascripts/better_markdown.js b/vendor/assets/javascripts/better_markdown.js index b80a1d069..38e3ef782 100644 --- a/vendor/assets/javascripts/better_markdown.js +++ b/vendor/assets/javascripts/better_markdown.js @@ -655,7 +655,7 @@ if ( consumed >= text.length ) { // No closing char found. Abort. - return null; + return [consumed, null, nodes]; } var res = this.dialect.inline.__oneElement__.call(this, text.substr( consumed ), patterns ); @@ -1264,8 +1264,10 @@ var res = inline_until_char.call( this, text.substr(1), "]" ); // No closing ']' found. Just consume the [ - if ( !res ) - return [ 1, "[" ]; + if ( !res[1] ) { + var size = res[0] + 1; + return [ size, text.charAt(0) + res[2].join('') ]; + } var consumed = 1 + res[ 0 ], children = res[ 1 ],