HTML5 Unleashed

Author: Simon Sarris
Publisher: Sams
Pages: 432
ISBN: 978-0672336270
Audience: JavaScript developers interested in graphics programming
Rating: 4
Reviewer: Ian Elliot


HTML5 Unleashed? What could this possibly mean?

 

I was puzzled by the title of this book because there isn't really much about HTML5 that needs unleashing. It's a markup language and it doesn't really go anywhere near "unleashed" unless you put it with its two much more technically-oriented companions, CSS and JavaScript. Unless of course you interpret HTML5 as being all of the new APIs that are associated with it. 

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.

You need to know JavaScript reasonably well to follow what this book is about and you need to want to learn the principles behind what you are doing. This is not for the complete beginner, even though it does cover topics at a level suitable for the complete beginner. 

 

Banner

 

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 4 introduces the difficult topic of Video and Audio elements. The difficult part is making sure that you get files in the correct formats for each of the browsers. It explains how to test for support for the different formats, but it can't really help with solving the problem of what to do if you don't have a video in the only supported format. Audio of course it much simpler in this respect. The last part of the chapter sumerizes the JavaScript API and provides a few examples. The chapter closes with a mention of WebRTC.

 

 

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.

As a book on HTML5 it does its best to tell you some of what you need to know. The problem is that without discussion CSS3 you can't really build an exciting book about HTML5 - it's just markup. With CSS3 included in the mix there is a lot to talk about and most of it without even mentioning JavaScript. 

This book takes approach of doing a quick introduction to the HTML5 tags and then majors on just one new HTML5 element, i.e. Canvas. As a book on Canvas it is quite good. It also covers many of the other HTML5 APIs and does a reasonably good job as well. The real problem is that things have moved on and what we really need is a book that covers the new JavaScript APIs that Mozilla and Google are introducing to push their browsers into serving as operating systems - mostly for mobile devices. 

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.

 

Banner


React Programming

Author: Loren Klingman and Ashley Parker
Publisher: Big Nerd Ranch Guides
Date: April 2023
ISBN:978-0137901760
Print:0137901763
Kindle:B0C4V69S8Z
Audience: Front end devs
Rating: 4
Reviewer: Ian Elliot
React is difficult to master, so a book can really help.



Software Development Pearls

Author: Karl Wiegers
Publisher: Addison-Wesley Professional
Pages: 336
ISBN: 978-0137487776
Print: 0137487770
Kindle: B09BF6CS9T
Audience: General developers
Rating: 2
Reviewer: Ian Elliot
Who can resist a good pearl or two?


More Reviews

 

Last Updated ( Wednesday, 02 October 2013 )