Merge pull request #1025 from epidemian/patch-1

Add <body> tag to Getting Started guide
This commit is contained in:
Leo Horie 2016-04-21 12:21:43 -04:00
commit f3c225c3f9

View file

@ -22,12 +22,14 @@ Once you have a [copy of Mithril](installation.md), getting started is surprisin
<!doctype html> <!doctype html>
<title>Todo app</title> <title>Todo app</title>
<script src="mithril.min.js"></script> <script src="mithril.min.js"></script>
<body>
<script> <script>
//app goes here //app goes here
</script> </script>
</body>
``` ```
Yes, this is valid HTML 5! According to the specs, the `<html>`, `<head>` and `<body>` tags can be omitted, but their respective DOM elements will still be there implicitly when a browser renders that markup. Yes, this is valid HTML 5! According to the specs, the `<html>` and `<head>` tags can be omitted, but their respective DOM elements will still be there implicitly when a browser renders that markup.
--- ---
@ -426,6 +428,7 @@ Here's the application code in its entirety:
```markup ```markup
<!doctype html> <!doctype html>
<script src="mithril.min.js"></script> <script src="mithril.min.js"></script>
<body>
<script> <script>
//this application only has one component: todo //this application only has one component: todo
var todo = {}; var todo = {};
@ -492,6 +495,7 @@ todo.view = function() {
//initialize the application //initialize the application
m.mount(document.body, {controller: todo.controller, view: todo.view}); m.mount(document.body, {controller: todo.controller, view: todo.view});
</script> </script>
</body>
``` ```
This example is also available as a [jsFiddle](http://jsfiddle.net/fbgypzbr/16/). This example is also available as a [jsFiddle](http://jsfiddle.net/fbgypzbr/16/).