chemerisuk / better-dateinput-polyfill

input[type=date] polyfill
http://chemerisuk.github.io/better-dateinput-polyfill/
MIT License
259 stars 58 forks source link

Uncaught TypeError: this._picker.toggleState is not a function #121

Closed jackbentley closed 3 years ago

jackbentley commented 5 years ago

It looks like there's some sort of race condition due to the way better-dom seems to handle "DOM extension".

I tried using this on my webpage - and after inserting the JS and clicking the input, I get this:

Uncaught TypeError: this._picker.toggleState is not a function
    at a._focusInput (better-dateinput-polyfill.js:228)
    at m.handleEvent (better-dom.min.js:8)
_focusInput @ better-dateinput-polyfill.js:228
handleEvent @ better-dom.min.js:8

This happens all the time on my webpage. There's no other JS on the page.

I'm able to reproduce this on the demo consistently by just adding a breakpoint in the initialization code - suggesting it's a race condition.

https://imgur.com/a/z3Nf2wm

better-dom-datepicker

chemerisuk commented 3 years ago

Version 4 does not have dependency on better-dom. The error should be solved. Check demo at http://chemerisuk.github.io/better-dateinput-polyfill/