Author: Simon Sarris
Reviewer: Ian Elliot
HTML5 Unleashed? What could this possibly mean?
This particular book majors on one particular new component of HTML5 - the Canvas element. Of its 380 pages or so of text, 170 are about Canvas. What this means is that if 2D graphics aren't of any interest to you, neither is a lot of this book.
The book starts off with a quick look at the history of the web and how we got to HTML5. Chapter 2 pushes on with a look at what the principles of HTML5 are - basically don't break anything if you can avoid it - and how it adds new features without making HTML more difficult to use. It mentions shims and polyfills and feature testing without providing any practical guidance to your future use of HTML5.
Chapter 3 is where the book gets started in an "unleashing" sense. This tells you about semantic tags, forms and drag and drop. These topics are really the core of the changes to HMTL as a markup language. Here you do find some guidance on using the Webshims library and some other hints and tips. One piece of advice I'd take issue with is the "Omit tags or don't" comment which says that it is a stylistic grey area to not bother to close tags when the standard allows it. This isn't stylistic, it's just lazy; you should always close tags. From here we learn about the basic new tags but we don't learn much - partly because there isn't much that isn't obvious. Things get a big more interesting when we start to move into the form based elements - <meter>, <progress>, the new input types and finally we finish off with a longer look at drag-and-drop.
Chapter 5 moves on to the book's main topic Canvas in 2D. The first of the four chapters is a big introduction to all aspects of using Canvas. The presentation is a slightly haphazard in that there are some fairly advanced comments - e.g. about using data URLs for graphics - and a fairly advanced discussion of how Canvas differs from SVG. These are the sorts of topics that beginners accounts of Canvas often just ignore. The explanations and discussions do tend to get the important points but sometimes you feel that they miss out on using appropriate level concepts. For example in the discussion of SVG v Canvas the ideas of bitmap v vector, retained mode graphics and graphics objects aren't used to get the ideas across. Of course if these terms mean nothing to you then you will much prefer the book's approach.
This is a good introduction to Canvas as it attempts to point out the operational principles and how you might get things wrong. It does a nice job of explaining arcTo and Bezier curves for example. Once you have finished this long chapter you should have a good grasp of Canvas.
Chapter 6 focuses on making Canvas interactive and stateful - in other words, how to get users to interact with Canvas and how to animate using requestAnimationFrame, which is the modern way to do animation. This whole chapter works its way towards a single big example of using Canvas to implement a simple graphics editor. The final listing is long but fairly easy to understand.
Chapter 7 has Canvas hints and tips for performance and "peculiarities" - some of the strange things that happen. The performance part is handled by using Benchmark.js and there are a lot of suggestions fo how to make things faster. This is well worth reading
The final chapter on Canvas looks at 3D WebGL graphics and at the future of Canvas. This is mostly about new features that have been added to the 2012 spec. Then WebGL is introduced by way of Three.js. This is very reasonable as not many people really need to use WebGL raw. Even so the single example is very short and really only indicates what you might be able to do.
Chapter 9 gets off the Canvas topic and starts a section that deals with odds-and-ends of the HTML5 APIs. First off we have the geolocation API. Next, Chapter 10 goes over the progress being made in storage. Starting with cookies we move on to Web Storage, IndexedDB, the File System API and the application cache. There is a lot in this chapter that is in a state of rapid change. Chapter 11 is about messaging and web workers while Chapter 12 is about websockets and XMLHttpRequest level 2. The book finishes with a short and more or less off-topic look at microdata and a brief list of topics not covered.
If you are looking for a book that tells you how to use HTML5 to create web pages then this probably isn't the book for you - as you do need CSS. If you want an overview of HTML plus some of its APIs and a big focus on Canvas, then it should be on your "possible" list and will probably be added to HTML5 Books on our Programmers Bookshelf at the next revision.