Skip to content

Instantly share code, notes, and snippets.

@jansegre
Created March 20, 2016 04:42
Show Gist options
  • Save jansegre/025ef43233839f400dce to your computer and use it in GitHub Desktop.
Save jansegre/025ef43233839f400dce to your computer and use it in GitHub Desktop.
htmlSafe bug
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<div class="container">
<div class="bar" style="{{my-helper "33"}}">
&nbsp;
</div>
</div>
<br>
import Ember from 'ember';
export function myHelper(params/*, hash*/) {
return Ember.String.htmlSafe(`width: ${params[0]}%`);
}
export default Ember.Helper.helper(myHelper);
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
}
.container {
width: 100px;
background: blue;
}
.bar {
background: red;
}
{
"version": "0.6.5",
"EmberENV": {
"FEATURES": {}
},
"options": {
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.3/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.4.0/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.3/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment