Skip to content
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

state of select's options is being reseted on simple model update #254

Open
sergey-dev opened this issue Sep 26, 2014 · 2 comments
Open

Comments

@sergey-dev
Copy link

I think i found the issue within stickit plugin, which leads to unexpected behavior with the DOM.

Preconditions:
I've gotten dropdown with some options hidden, that's disabled = true. After change of model, the state of dropdown changes, and after the update, the state of my options with disabled state is being reseted.

Take a look to the line #581:
$el.find('*').remove();

I'm just wondering, why you are doing wipe of all options from the select and then recreating them, if the only thing we need is to select another option on backbone.model.set() event.

I think, normally, you shouldn't affect the state of css, binded events to DOM, or the overal state of attributes except the attribute you need to update.

sergey-dev added a commit to sergey-dev/backbone.stickit that referenced this issue Sep 29, 2014
@sergey-dev
Copy link
Author

Here's the provided fix from my side.
it will not wipe the state of attributes like CSS, disabled states, HTML5 data attributes..
Each time we kill all the dropdowns content in line #581: $el.find('*').remove(); each option's CSS, and other attributes will be preserved, and restored.

Two way bindings works as it worked before, this way we just do not wiping the state of options' attributes on simple sync from backbone.model.set() -> view.

@cancerberoSgx
Copy link

I'm also having this issue and I consider it a big issue: as a user I dont expect that the binding library to resent all my attributes - style, etc. If viable, please accept @sergey-dev PL ! A working example of the issue:

https://jsfiddle.net/cancerbero_sgx/xztuzg0d/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants