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

When trying to use this in Safari 12.3, I get the following error #62

Closed
mfranzke opened this issue Jun 13, 2019 · 4 comments
Closed

When trying to use this in Safari 12.3, I get the following error #62

mfranzke opened this issue Jun 13, 2019 · 4 comments
Assignees

Comments

@mfranzke
Copy link
Owner

When trying to use this in Safari 12.3, I get the following error: [Error] TypeError: The HTMLInputElement.list getter can only be used on instances of HTMLInputElement.

It's pointing to this line constructor.prototype.list === undefined.

  // Emulate the two properties regarding the datalist and input elements
  // list property / https://developer.mozilla.org/en/docs/Web/API/HTMLInputElement
  (function(constructor) {
    if (
      constructor &&
      constructor.prototype &&
      constructor.prototype.list === undefined
    ) {

The solution was to use WKWebView instead of UIWebView since it supports datalist. However, it's to note that this polyfill could be extended to work for all versions of Safari.

Screen Shot 2019-06-03 at 5 41 15 PM

Originally posted by @jscho13 in #47 (comment)

@mfranzke mfranzke changed the title When trying to use this in Safari 12.3, I get the following error: [Error] TypeError: The HTMLInputElement.list getter can only be used on instances of HTMLInputElement. When trying to use this in Safari 12.3, I get the following error Jun 13, 2019
@mfranzke mfranzke self-assigned this Jun 13, 2019
@mfranzke
Copy link
Owner Author

@jscho13, thanks a lot for your feedback.

To my understanding, this is mainly about using a datalist element within a HTML website embedded in a webview within an app, in which the polyfill is included as well, isn't it?
And the solution that you're suggesting is about mentioning within the README that WKWebView should get used instead of UIWebView, right?

@jscho13
Copy link

jscho13 commented Jun 13, 2019

Correct. It has no action on your part.

For users that have problems with datalist in an embedded webview within an app, they should be using WKWebView instead of UIWebView. I just wanted to inform them of the support newer HTML website shave.

@jscho13
Copy link

jscho13 commented Jun 13, 2019

I can delete the comment in the original issue if you'd like.

@mfranzke
Copy link
Owner Author

sure, probably makes sense to clean up a little bit. Thank you !

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

No branches or pull requests

2 participants