-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected val() event behavior #2046
Comments
I agree - this behavior is inconsistent, and while it does make sense on the surface that val() should trigger a change event, it's trivial to simply trigger the change event manually. I'm considering deprecating |
In our case, we've chosen to modify the 1.13 version to the 1.12 behavior, i.e., val: function (value) {
if (typeof value !== 'undefined') {
this.$element.val(value);
this.render();
return this.$element;
} else {
return this.$element.val();
}
}, In that with this implementation, we can choose to follow a |
Released in v1.13.7! |
@bazineta commented on May 2, 2018, 10:50 PM UTC:
The change introduced in snapappointments/bootstrap-select#1303, such that calling
val()
emits a change event, is inconsistent with common practice, and, at least in our case, induced a lot of breakage, as it tends to introduce events before handlers are ready for them.I'm a bit puzzled as to the rationale for the change;
val()
doesn't typically work this way. As reference, from the canonicalval()
documentation, http://api.jquery.com/val/:I think if something as basic as event behavior is going to be different from how it's worked in the past and different from common practice, there should be much more of a warning present in the change log.
However, frankly, it's not without good reason that that's not normally the way
val()
works, so again, I'm puzzled by what seems to be an odd choice here.This issue was moved by caseyjhol from snapappointments/bootstrap-select-temp#52.
The text was updated successfully, but these errors were encountered: