GoogleChrome / dialog-polyfill

Polyfill for the HTML dialog element
BSD 3-Clause "New" or "Revised" License
2.45k stars 245 forks source link

strange safari troubles #148

Closed ray007 closed 3 years ago

ray007 commented 7 years ago

Dialog polyfill seemed to work fine at first, until I tried safari (iOS 10) in production mode (scripts compiled with uglify2). Then I got an exception in DialogManager:updateStacking() (line 495). No idea why so far. After replacing all occurencies of .dialog with .dialog_ in dialog-polyfill.js, things seem to work again...

samthor commented 7 years ago

Line 495 is pretty innocuous—

for (var i = 0, dpi; dpi = this.pendingDialogStack[i]; ++i) {

I'll take a look again soon on iOS though. Can you give me a link to your compiled source—is this something running in production?

ray007 commented 7 years ago

Not yet in production, but soon enough I hope. But looking through the source, I can't see how the .dialog property without the _ at the end would make sense... I'll see about the compiled source soon...

samthor commented 7 years ago

Re-reading your comment, it sounds like this might be a problem with Uglify and the polyfill. Can you post the compiled source of the polyfill, or the steps you're taking to compile it?

ray007 commented 7 years ago

Hmm, it's not the compilation it seems. But after adding some sanity checkes, never on first load, only after navigating through a few pages of my app. Testing with uncompiled dialog-polyfill.js, with and without my changes, iOS Safari still sometimes seems to miss a dialog tag... But trying all the same steps with FireFox on the desktop, everything seems to work fine. With our without my changes. Even with the touch-emulation active. Waiting now for our mac to finish updating, hopefully the debug tools there will give me better answers.

ray007 commented 7 years ago

Hmm, I generously sprinkled some more ev.preventDefault() around in my code and added some more async decoupling to my code, and now it also works on safari. I really hope that company learns how to make a browser one of these days... What still confuses me a bit is the .dialog vs. .dialog_ issue. I'm currently still running the version with my replacement changes applied, and all seems to be fine...

samthor commented 7 years ago

Can you please show me some code where this problem is occurring?

Unfortunately it's really hard to understand the problem from your comments.