Skip to content

Instantly share code, notes, and snippets.

@GavinJoyce
Last active April 21, 2016 21:15
Show Gist options
  • Save GavinJoyce/33e506329f8176ae874422644d4cc08c to your computer and use it in GitHub Desktop.
Save GavinJoyce/33e506329f8176ae874422644d4cc08c to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
name: 'Ben',
result: '',
didInsertElement() {
let input = this.$('input')[0];
this.set('result', `
input.selectionStart: ${input.selectionStart},
input.selectionEnd: ${input.selectionEnd}`
);
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<span style="background-color: yellow;">In Chrome, the `input.selectionStart` and `input.selectionEnd` will have correct values of 3 after the component renders. In Firefox, they are both 0.</span>
<hr />
{{input-component}}
input: {{input type="text" value=name}}
<hr />
<pre>{{result}}</pre>
{
"version": "0.7.2",
"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.4/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.4/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment