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

Redundant input blowback guard? #645

Closed
Rich-Harris opened this issue Jun 16, 2017 · 0 comments · Fixed by #814
Closed

Redundant input blowback guard? #645

Rich-Harris opened this issue Jun 16, 2017 · 0 comments · Fixed by #814

Comments

@Rich-Harris
Copy link
Member

First of a couple of random thoughts I just had:

If you have a template like this...

<input bind:value>

...Svelte generates code like this:

function input_input_handler () {
  input_updating = true;
  component._set({ value: input.value });
  input_updating = false;
}

// later...
if ( !input_updating ) {
  input.value = state.value;
}

IIRC the purpose of the input_updating check is to prevent the cursor jumping about if, say, you edit text at the beginning of the field (I think setting the value causes the cursor to jump to the end).

In inputs without cursors (range, color, etc etc) maybe that's unnecessary?

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

Successfully merging a pull request may close this issue.

1 participant