News for hackers. Stuff that matters.
Re:Breakout in 30 lines of JavaScript by dkordik on Monday November 18, 2013 @12:08PM (#6755338)
TIL: DOM elements with IDs are automatically available as properties of window. (ball, paddle, etc.)
Re:Breakout in 30 lines of JavaScript by dkordik on Monday November 18, 2013 @12:28PM (#6755492)
A couple of findings:

- This stackoverflow answer has a good back story on this: (TLDR, it's not standard... yet) http://stackoverflow.com/a/3434388/1339100

but it is in this HTML 5.1 draft: http://www.w3.org/html/wg/drafts/html/master/browsers.html#n...

- It's slower than document.getElementById, somehow: http://jsperf.com/implicit-dom-element-variables

Re:Breakout in 30 lines of JavaScript by jonahx on Monday November 18, 2013 @12:12PM (#6755372)
Me too. Anyone know what browser support is like?
Re:Breakout in 30 lines of JavaScript by dmak on Monday November 18, 2013 @12:11PM (#6755364)
I was surprised too. I thought you would have to explicitly select it with getElementById()