Skip to content

Instantly share code, notes, and snippets.

@GavinJoyce
Created April 4, 2016 20:56
Show Gist options
  • Save GavinJoyce/07b6f55e92bd89082171afa06d05a2aa to your computer and use it in GitHub Desktop.
Save GavinJoyce/07b6f55e92bd89082171afa06d05a2aa to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
maxlength: undefined,
size: undefined,
actions: {
setValues: function() {
this.setProperties({
maxlength: 5,
size: 30
});
},
setUndefined: function() {
this.setProperties({
maxlength: undefined,
size: undefined
});
}
}
});
<h3>This demonstrates a possible bug with the input helper</h3>
<hr />
{{input type='text' maxlength=maxlength size=size}}
<hr />
<button {{action 'setValues'}}>1 Set values</button><br />
<button {{action 'setUndefined'}}>2 Set undefined</button>(will raise <span style="background-color: yellow">`Uncaught IndexSizeError: Failed to set the 'size' property on 'HTMLInputElement': The value provided is 0, which is an invalid size.`</span>, see console)
<hr />
maxlength={{maxlength}}, size={{size}}
{
"version": "0.7.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"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.3/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