Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Converted from using new Ember.Handlebars.SafeString to `Ember.Stri…
Browse files Browse the repository at this point in the history
…ng.htmlSafe` to resolve deprecation warnings with Ember 2.8.
  • Loading branch information
Wesley Workman committed Aug 30, 2016
1 parent 0e610ad commit ecd8fe0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions addon/utils/i18n/compile-template.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Ember from "ember";

const SafeString = Ember.Handlebars.SafeString;
const htmlSafe = Ember.String.htmlSafe;
const get = Ember.get;
const escapeExpression = Ember.Handlebars.Utils.escapeExpression;
const tripleStache = /\{\{\{\s*(.*?)\s*\}\}\}/g;
Expand All @@ -21,6 +21,6 @@ export default function compileTemplate(template, rtl = false) {

const wrapped = rtl ? `\u202B${result}\u202C` : result;

return new SafeString(wrapped);
return htmlSafe(wrapped);
};
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"ember-disable-prototype-extensions": "^1.0.1",
"ember-disable-proxy-controllers": "^1.0.1",
"ember-export-application-global": "^1.0.3",
"ember-string-ishtmlsafe-polyfill": "^1.0.0",
"ember-try": "0.0.8"
},
"keywords": [
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/utils/i18n/default-compiler-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Ember from 'ember';
import { module, test } from 'qunit';
import { compileTemplate } from 'ember-i18n';
import isHTMLSafe from 'ember-string-ishtmlsafe-polyfill';

module('compile-template');

Expand Down Expand Up @@ -55,7 +56,7 @@ test('it treats triple-stache interpolations as HTML-safe', function(assert) {

test('it returns HTML-safe strings', function(assert) {
const result = compileAndEval('Roast the hazelnuts');
assert.ok(result instanceof Ember.Handlebars.SafeString);
assert.ok(isHTMLSafe(result));
});

// Right-to-Left Support
Expand Down

0 comments on commit ecd8fe0

Please sign in to comment.