JS1k love logo - by @nodejitsu

JS1k: The JavaScript code golfing competition

2012 - Love

Home   Rules   Demos   Submit

Signup to the mailing list for general updates, demo notifications, and perhaps news on a conference (all configurable)

  1. All submissions must not be bigger than 1k

    1k means 1024 bytes. Note that we're not counting in characters. JavaScript uses 16bit unicode values internally. The server will enforce this restriction and reject your submission if you try anyways.
  2. No externals

    That means no linking, no including and so no using of any external resources. You are free to submit your 5 minute intro video or coffeescript interpreter in your submission though, as long as the server permits you to. And no, you may not use another submission in your submission. Your submissions should be able to be put in a single script tag (see the shim) and should work offline from the start.
  3. Deadline is Wednesday 14th of March 2012

    The submissions automatically close at midnight my time (CET, which is UTC+1)
  4. Only one submission will compete per person

    But you are free to submit as many demo's or updates as you want (but try not to make me mad please, I manually check and ok these submissions). Judges can submit but their entries will not compete (they're aware :). The jury will only consider your LAST submitted entry! And you obviously can't submit an entry after the deadline passes.
  5. Anything goes for golfing

    Do not worry about Crockford's wrath. Your submission does not need to pass jslint, style guides or anything like that. You may compress your submission in any way you can, as long as the result still runs in the browser. It MUST run in the browser, in the provided shim. That (and the other rules on this page) is pretty much the only restriction.
  6. Your demo should work in current browsers (ex. IE)

    This means your browser should should run without problems (syntax errors or otherwise). Speed of individual browsers is not my concern, I leave that to the judges. Internet Explorer is excluded because that only works on Windows 7+. Safari is in because that runs on Windows and OSX (but not Linux, unfortunately). Chrome and Opera work on all platforms. For the perfectionists; Specific browser versions where your demo should work in are:

    • Firefox 10
    • Chrome 16
    • Opera 11.61
    • Safari 5.1

    And it would be nice if they also worked in IE10. I mean, come on. That browser has come a long way. Please don't bitch about minor deviations. Overall your demo should just work in current browsers. When push comes to shove the jury can apply browser versions for a verdict. These rules are in place to prevent dirty browser specific hacks in hopes of the result being a "pure and generic" js demo. Not just something that works because one browser implemented something (like sharp variables in Firefox).
  7. Your demo must work in the shim

    The entire submission will be put in the provided shim. All demo's do this so we're all on the same level. The shim provides three variables. The shim is very simple and provides a canvas element. The a variable contains a reference to the context (canvas.getContext('2d')) of this canvas. Var b contains a reference to document.body and c contains a reference to the canvas tag.
  8. Your demo should just work

    • Must not crash in any of these browsers (no syntax or DOM errors)
    • Should behave approximately equal in all browsers (your rating depends heavily on this!)
    • Platform shouldn't really matter (especially since it should work in all browsers)
    • Speed is not my concern, but might impact a jury verdict
  9. Other things you should know

    • Your demo does not need to be visually appealing (certainly not to be submitted and listed on the site!)
    • Your entire submission will be put in the script tag in the provided shim (the above rules assume this)
    • Your script may not mess with the frameset, break out of its frame, read/write anything that's not in its own frame, force a reload of the page or redirect the user to another site
    • Your script may not "phone home". That includes saving high scores etc. The exception is a button/link to tweet, if you have room left for it
    • Do not submit HTML soup. It will be rejected. Your entire submission should work inside script tags (don't be smart, you cannot use </script>...<script> either)
    • Test your minified script result in the (entire!) shim. There's a reason we provide it. Paste your script in the proper position before you do. The a, b and c variables are fixed, so make sure tools like Closure don't change their name.
    • Audio and video are in. WebGL is out. Be careful, there's no single video codec that works in all browsers...
    • The theme Love is only a suggestion, it's not a requirement
  10. I have a final say in things

    I think I'm reasonable enough but I reserve the right to reject anything. This hasn't happened before and I don't think it will this time, so don't worry :)
  11. Tips & Tricks

    • document.body will be available when your code executes!
    • document.body.children is available
    • When minifying, beware that the boiler plate variables must remain the same! Make sure you test your submission in the same before actually submitting
    • Firefox does NOT support exposing element id's as globals. Please don't assume this again and again.