-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
KO 3.0.0 bug in IE8 - options/optionsCaption #1208
Conversation
@csainty if you change the code to push all the values at once then it works as expected. viewModel.filterValues.push.apply(viewModel.filterValues, ["1", "2"]); |
@crissdev An interesting observation. I haven't had time to try debug this yet but I am sure that will help pin-point it. |
The problem appears to be related to the fact that the caption The IE-specific issue is that when the selected option is removed, whatever is the first option becomes selected immediately. And IE ignores later code that sets the selection to a different option. The IE-specific problem can be demonstrated without using the caption:
|
Yes, pushing all data at once solves the problem (I am not sure about ko 3.0, but in ko 2.x it also improves the speed)
|
…o fix a selection bug.
My first thought to fix this was to deal with the selection aspect by using Then I realized that the problem stemmed from removing options. Whenever you remove the currently selected option, another one has to be selected. The bug in IE<=8 is that the option that's selected when removing options sticks even when options are added right away. By reversing the steps (adding, then removing), this bug doesn't cause any problems. I'm using the |
Great catch and nice solution. Thanks! |
KO 3.0.0 bug in IE8 - options/optionsCaption
I just ran the test suite in Firefox, and the new test, "Binding: Options Should select first option when removing the selected option and the original first option." fails. I was able to get the test to pass by making the 'beforeRemove' version run on Firefox as well. |
…m with selection when deleting options first.
Looking at upgrading our app to 3.0.0 but it is breaking IE8 for us.
I have a reproduction here http://jsbin.com/orEwOLAW/3/edit
What happens is that when I have a
select
element with bothoptions
andoptionsCaption
then I push more than one item in to the array, instead of the caption being chosen the first option is.In my jsbin, if you change the KO version to 2.3.0, then the bug doesn't appear. Or if you comment out the second filterValues.push() the bug doesn't appear.