diff options
-rw-r--r-- | dist/handlebars.js | 4 | ||||
-rw-r--r-- | lib/handlebars/compiler/compiler.js | 4 | ||||
-rw-r--r-- | spec/qunit_spec.js | 4 |
3 files changed, 10 insertions, 2 deletions
diff --git a/dist/handlebars.js b/dist/handlebars.js index afdb0b9..d7f140e 100644 --- a/dist/handlebars.js +++ b/dist/handlebars.js @@ -1971,7 +1971,9 @@ JavaScriptCompiler.prototype = { .replace(/\\/g, '\\\\') .replace(/"/g, '\\"') .replace(/\n/g, '\\n') - .replace(/\r/g, '\\r') + '"'; + .replace(/\r/g, '\\r') + .replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 + .replace(/\u2029/g, '\\u2029') + '"'; }, setupHelper: function(paramSize, name, missingParams) { diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index 196ba18..b028076 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -1130,7 +1130,9 @@ JavaScriptCompiler.prototype = { .replace(/\\/g, '\\\\') .replace(/"/g, '\\"') .replace(/\n/g, '\\n') - .replace(/\r/g, '\\r') + '"'; + .replace(/\r/g, '\\r') + .replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 + .replace(/\u2029/g, '\\u2029') + '"'; }, setupHelper: function(paramSize, name, missingParams) { diff --git a/spec/qunit_spec.js b/spec/qunit_spec.js index 9832d60..6c44e4e 100644 --- a/spec/qunit_spec.js +++ b/spec/qunit_spec.js @@ -1408,6 +1408,10 @@ test('GH-458: Scoped this identifier', function() { shouldCompileTo('{{./foo}}', {foo: 'bar'}, 'bar'); }); +test('GH-375: Unicode line terminators', function() { + shouldCompileTo('\u2028', {}, '\u2028'); +}); + suite('Utils'); test('escapeExpression', function() { |