News for hackers. Stuff that matters.
Re:Snake game in a data: URI by tlrobinson on Friday December 09, 2011 @03:48AM (#3333093)
The most interesting thing about this is you can use plain text in data URIs. For some reason I assumed it had to be base64 encoded, but apparently only for binary data.
Re:Snake game in a data: URI by bytex64 on Friday December 09, 2011 @04:20AM (#3333155)
I thought the same thing until I watched a talk a few weeks ago about HTML5, and the guy demonstrated the world's smallest text editor:

  data:text/html,<pre contenteditable>
Re:Snake game in a data: URI by moontear on Friday December 09, 2011 @05:01AM (#3333217)
Doesn't work for me, but data:text/html,<pre contenteditable>Hello</pre> works for me.
Re:Snake game in a data: URI by rufibarbatus on Friday December 09, 2011 @06:54AM (#3333420)
If the Hello version works, the smaller version should work too. The <pre> will be 1-line high on HTML5 browsers, not window high, so you have to click the very top of the page body for it to focus.

(If that still doesn't work, out of curiosity, what browser are you using?)

Re:Snake game in a data: URI by grayrest on Friday December 09, 2011 @03:20PM (#3335425)

    data:text/html,<pre contenteditable/>
Works in Chrome 15 without content but Firefox requires content.
Re:Snake game in a data: URI by rufibarbatus on Sunday December 11, 2011 @08:57PM (#3341887)
Oh! Looks like we found a most unexciting difference in Fx's and Chrome's HTML5 rendering engines. Someone alert the authorities!

What's happening is in fact a little bit more complex than that. Both browsers create the pre element (you can verify that by typing that URI and hitting the tab key to switch focus from the address bar into it).

Now, where Chrome renders a line-sized pre element even when it's empty, Firefox renders it as a 0px element until you feed text into it (that's probably its standard behaviour for pre elements without a child text node, but I can't be bothered verifying that).

Boy, I love getting a rush out of figuring out something completely irrelevant! :-)

Re:Snake game in a data: URI by calcnerd256 on Friday December 09, 2011 @07:45PM (#3336410)
pshaw, try data:text/html,<textarea>

that's 11 bytes shorter