Skip to content
This repository has been archived by the owner on Nov 3, 2020. It is now read-only.

Unexpected val() event behavior #52

Closed
bazineta opened this issue May 2, 2018 · 1 comment
Closed

Unexpected val() event behavior #52

bazineta opened this issue May 2, 2018 · 1 comment
Labels

Comments

@bazineta
Copy link

bazineta commented May 2, 2018

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 canonical val() documentation, http://api.jquery.com/val/:

Setting values using this method (or using the native value property) does not cause the dispatch of the change event. For this reason, the relevant event handlers will not be executed. If you want to execute them, you should call .trigger( "change" ) after setting the value.

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.

@ghost
Copy link

ghost commented Aug 21, 2018

This issue was moved by caseyjhol to snapappointments/bootstrap-select#2046.

@ghost ghost closed this as completed Aug 21, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants