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

Potentially catch input type assignment for older browsers? #773

Closed
jacobmischka opened this issue Aug 15, 2017 · 5 comments · Fixed by #778
Closed

Potentially catch input type assignment for older browsers? #773

jacobmischka opened this issue Aug 15, 2017 · 5 comments · Fixed by #778

Comments

@jacobmischka
Copy link
Contributor

The new input types are great for progressive enhancement in HTML because if an old browser doesn't support them it just renders a type="text" input, which is perfect. Unfortunately, doing this doesn't work in svelte because (at least in IE9) the input.type = 'search' assignment will throw an error.

If it doesn't make things too filthy it might be nice to try to catch this assignment and fall back to text, but I totally understand if this is considered out of scope and not worth doing.

inputtypesearch

As always, thank you for everything!

@Rich-Harris
Copy link
Member

Gah, didn't realise that caused an error! I wonder if the best solution would be to have a legacy compile option that changed that code to this:

try { input.type = 'search'; } catch (e) {}

// or
setInputType(input, 'search'); // where setInputType does the above

@jacobmischka
Copy link
Contributor Author

That would be perfect!

@PaulBGD
Copy link
Member

PaulBGD commented Aug 16, 2017

+1 for moving to setInputType, previous versions of V8 simply won't optimize functions with try/catch blocks.

Rich-Harris added a commit that referenced this issue Aug 24, 2017
add legacy option, use it for setInputType
@Rich-Harris
Copy link
Member

Forgot #778 was still open — released as 1.31!

@jacobmischka
Copy link
Contributor Author

Woo, thank you!

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.

3 participants