3 ms·
From the comments > I believe it's Google Closure compiler putting commas in there. Someone else linked to an explanation of why > http://blog.vjeux.com/2011
by samarudge 14y ago
From the comments
> I believe it's Google Closure compiler putting commas in there.
Someone else linked to an explanation of why
> http://blog.vjeux.com/2011/javascript/javascript-comma-trick.html http://blog.vjeux.com/2011/javascript/javascript-comma-trick...
</fact><opinion>
So from the looks of it, the problem is in Opera's javascript implementation.
I'm not sure how much Google uses Closure Compiler internally but I wouldn't have thought they would use code they knew to cause issues in some browsers. I guess that ether means the Opera implementation is wrong and the code should work fine, or Google didn't test this as fully as they should have done
- tseabrooks 14y agoIs it a bug though? Sounds like a conscious design limitation in the parser. A bad limitation, but not a bug. Sounds like it's behaving "as expected".
- icebraining 14y agoThey consider it a bug: We already knew that we had a limitation that other browsers don't have in the parser, and it was already considered important to fix. Breaking Twitter of course raises the profile of this bug.
- mistercow 14y agoECMAScript is a language with an ISO standard behind it. Any time a parser doesn't comply with that standard, it's a bug.
- gamache 14y agoThat "explanation of why", when you take the trouble of reading it, is just an explanation of how. The article ends with: Conclusion - Using the comma trick to do { }-less indentation is far from viable. However this may still be useful for debugging and overall it is fun to try new coding styles!
- seppo0010 14y agoReading the article and the comments made it more clear to me. Twitter is using some minification tool (maybe Google Closure) which attempts to reduce the number of characters used. Using commas you can reduce two characters by avoiding some brackets. if(true){dothis();dothat();} if(true)dothis(),dothat();
- paulirish 14y agoUglify uses the comma trick a lot, and from my experience, Closure Compiler doesn't rely on it very often. Regardless, the actual bug is in Opera as the resulting javascript is legit, even if its absolutely crazy to have 4MB of script be only a single javascript statement.