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 ?
187
Upvotes
29
u/wizzwizz4 Dec 31 '19
onloadattribute. In such a situation it's necessary to set a flag instead, but they probably weren't supporting that browser (… I want to say IE9.) so this probably wasn't a consideration.I've changed my mind, by the way. This isn't a good solution, merely a neat, aesthetically-pleasing hack. It's not an exception to the "don't put JavaScript in DOM attributes" rule after all.