However code examples that appear on the book's site obviously have no such constraint, and as such may just be formatted as per the author's personal taste. Either way, no one is happy :)
Speaking of the book itself, it's not bad. Though I thought they glossed over the Canvas too quickly, and could have spent more time on helper libraries, like jQuery, etc.