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

fix input binding fails if type declared last #3849

Conversation

AlbertLucianto
Copy link
Contributor

Should fix #3828

If type attribute is declared after the binding, evaluating parent.get_static_attribute_value('type') in Binding returns null because type hasn't been pushed to the attributes list. As a result, type is null and type === 'file' is false, which is used to determine whether it's readonly and to prevent assigning input.files.

Forcing all Attributes and Spreads to be evaluated before Binding can fix the issue, and I suppose it does not create any kind of side effect. Let me know if there's any problem may arise that I'm not aware of.

Really appreciate for your review!

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR relates to an outstanding issue, so please reference it in your PR, or create an explanatory one for discussion. In many cases features are absent for a reason.
  • This message body should clearly illustrate what problems it solves. If there are related issues, remember to reference them.
  • Ideally, include a test that fails without this PR but passes with it. PRs will only be merged once they pass CI. (Remember to npm run lint!)

Tests

  • Run the tests tests with npm test or yarn test)

@Rich-Harris
Copy link
Member

Thanks! I don't think there are any problems that would arise from this; if it turns out there are we can always find a slightly different solution — the important thing is we now have a test.

@Rich-Harris Rich-Harris merged commit 70de6a2 into sveltejs:master Nov 6, 2019
@AlbertLucianto AlbertLucianto deleted the fix/file-input-binding-declared-last branch November 6, 2019 12:33
@quantuminformation
Copy link
Contributor

Nicely done, I guess the expected . js file is the only way to check the compiler out put. Must be pain though to update if the compiler output goes a different direction.

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 this pull request may close these issues.

File input binding fails if type declared last
3 participants