duckduckgo / zeroclickinfo-spice

DuckDuckGo Instant Answers based on JavaScript (JSON) APIs
https://duckduckhack.com/
Other
548 stars 942 forks source link

Timer: doesn't always appear in production, but ok in DuckPAN #1389

Closed mattr555 closed 9 years ago

mattr555 commented 9 years ago

It probably has something to do with the hidden attribute setting here, as the html is loaded, but the hidden attribute is set:

screenshot - 01012015 - 10 28 44 pm

This appears to be a race condition, as it works sometimes (notably on refresh). I'm not convinced the flash of unstyled content is really a bug... cc @jagtalon @kethinov

kethinov commented 9 years ago

Looks like the JS (https://duckduckgo.com/share/spice/timer/1078/timer.spice.js) is loading prior to the CSS (https://duckduckgo.com/share/spice/timer/1078/timer.css), which isn't the case in DuckPAN.

Due to that, the line you noted never executes because the element the load event is supposed to attach to isn't yet present in the DOM.

I just submitted a fix here: https://github.com/duckduckgo/zeroclickinfo-spice/pull/1390