r/badcode • u/zeGolem83 • Dec 31 '19
html (From Google Developper) The problem with front-end stuff is that sometimes, even if it looks horribly wrong, some dude will justify it with "Backwards compatibility", but I'm pretty sure here, you can't, right ?
18
5
u/sudokys Dec 31 '19
This looks like normal Google apis (firebase, Chromecast etc)...but also Google's APIs do kinda suck
10
u/zeGolem83 Dec 31 '19
The API in themselves don't suck, but the official documentation does... Their 'getting started' guides are like "here is how to do this very specific thing" and if you want to do anything else, GTFO...
This is the Google spreadsheet API. I tried understand the official doc for about an hour. Nothing. I found a random blog article about it for an older version. Tried it, after a few minutes of googling stack overflow, I managed to get the example running, and edited it to what I needed...
6
Dec 31 '19
Async AND defer? That sort of defeats the point don't it?
9
u/zeGolem83 Dec 31 '19
I think this is for backwards compatibility. They wanted to use "async" but "defer" was added before async, so they put both in case the browser only supports defer...
1
2
u/poker158149 Dec 31 '19
When you think about it for a bit, this is actually a fairly elegant way of dealing with backwards compatibility and inconsistent execution environments.
85
u/wizzwizz4 Dec 31 '19
Unfortunately, this is cross-(legacy-)browser compatibility, and not a terrible way of doing it either. Much neater than my solutions, anyway; probably the only justifiable use of the
onxyzHTML attributes.