diff --git a/CHANGELOG.md b/CHANGELOG.md index f44ac14b..d39c28c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Changelog master (unreleased) ------------------- +* Fix: [Breaking Change] filter.escape should not escape SafeString(#168). v2.2.0 (Nov 23 2015) -------------------- diff --git a/src/filters.js b/src/filters.js index 10f939d9..a7ba8b6f 100644 --- a/src/filters.js +++ b/src/filters.js @@ -116,8 +116,7 @@ var filters = { }, escape: function(str) { - if(typeof str === 'string' || - str instanceof r.SafeString) { + if(typeof str === 'string') { return lib.escape(str); } return str; diff --git a/tests/filters.js b/tests/filters.js index 09d59d63..be035fd4 100644 --- a/tests/filters.js +++ b/tests/filters.js @@ -91,6 +91,12 @@ finish(done); }); + it('escape skip safe', function(done) { + var res = render('{{ "" | safe | escape }}', {}, { autoescape: false }); + expect(res).to.be(''); + finish(done); + }); + it('dictsort', function(done) { // no real foolproof way to test that a js obj has been transformed // from unsorted -> sorted, as its enumeration ordering is undefined