lhorie/mithril.js — pull request #381 by kayellpeee (2014-12-08 00:28:32+00:00)
Title: Update to IIFEs

Pull request we talked about in issue #376

Changes `new function(){}` pattern into -> `(function(){})`. Most changes are made in documentation, but I also modified how mock window was instantiated.
![screen shot 2014-12-07 at 4 25 22 pm](https://cloud.githubusercontent.com/assets/6556190/5333503/b4d6593e-7e2d-11e4-8d6f-042b7e02e287.png)

Added a different IIFE pattern in components:
![screen shot 2014-12-07 at 3 43 00 pm](https://cloud.githubusercontent.com/assets/6556190/5333322/eed413d4-7e27-11e4-8b3f-506092bca3f5.png)

Normally IIFEs are wrapped in parens so JS will treat it like an expression an evaluate the function. One consequence of this pattern is that the parens will evaluate to undefined, and if you’re chaining IIFEs (rare, but it happens), it will treat the next pair of wrapping parens as a function invocation on the result of the first pair, which happens to be undefined. So to avoid throwing errors, you can add semicolons after each IIFE, or add some operator before the function instead of wrapping it in parens. If you aren’t assigning the result of an IIFE to a variable it’s a pretty powerful pattern. Let me know if it should stay or if I should add some explanation in that part of the docs

Lastly, edited out the uneccesary `.bind(this)` in the getting started guide, and fixed a small error in the page on mithril.render
![screen shot 2014-12-07 at 4 28 05 pm](https://cloud.githubusercontent.com/assets/6556190/5333511/13fc6264-7e2e-11e4-98a6-9057fe5be0e9.png)