Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Checkbox checked value update is different depending on browser #2604

Closed
anfuerer opened this Issue · 5 comments

3 participants

@anfuerer

If I implement a checkbox view where I access the checkbox value with this.get('checked') I get different values depending on the browser.

See jsfiddle:
http://jsfiddle.net/2Jc3s/3/

@anfuerer

As a workaround I had to implement it using jQuery ìs(':checked')` to have consistent behavior across Chrome and Firefox.

click: function (evt) {
    var isChecked = this.$().is(':checked')
    console.log( 'click changed to %@'.fmt(isChecked) );
}
@anfuerer

Chrome 26, OSX
Firefox 20, OSX

@fivetanley
Collaborator

tl;dr I don't think this is a bug because change should happen after click.

I think this could be because the change event is firing after the click event in Firefox. If you look at the Ember source for Ember.Checkbox you'll see this:

init: function(){
  this._super();
  this.on('change',this,this._updateElementValue);
}

This is just showing you that the event for changing the property happens on change. I forked your fiddle here: http://jsfiddle.net/zqGte/2/ and got consistent results in both browsers by changing the click handler to a change handler.

Does that make sense?

@trek
Owner

I suspect @fivetanley is correct. This is a reported Firefox issue https://bugzilla.mozilla.org/show_bug.cgi?id=843554

@trek trek closed this
@anfuerer

you're right, thanks guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.