DEV: Remove 'htmlSafe' string prototype extensions (#141)

Context: https://deprecations.emberjs.com/v3.x/#toc_ember-string-prototype_extensions
This commit is contained in:
Isaac Janzen 2022-06-01 10:22:06 -05:00 committed by GitHub
parent ee24868df3
commit 203330e174
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -1,22 +1,23 @@
import Component from "@ember/component"; import Component from "@ember/component";
import { computed } from "@ember/object"; import { computed } from "@ember/object";
import { htmlSafe } from "@ember/template";
export default Component.extend({ export default Component.extend({
classNameBindings: [":progress", ":progress-striped", "active"], classNameBindings: [":progress", ":progress-striped", "active"],
active: computed("percent", function() { active: computed("percent", function () {
return parseInt(this.get("percent"), 10) !== 100; return parseInt(this.get("percent"), 10) !== 100;
}), }),
barStyle: computed("percent", function() { barStyle: computed("percent", function () {
let percent = parseInt(this.get("percent"), 10); let percent = parseInt(this.get("percent"), 10);
if (percent > 0) { if (percent > 0) {
if (percent > 100) { if (percent > 100) {
percent = 100; percent = 100;
} }
return ("width: " + this.get("percent") + "%").htmlSafe(); return htmlSafe("width: " + this.get("percent") + "%");
} }
return "".htmlSafe(); return htmlSafe("");
}) }),
}); });