围城书评
Summary: Luke Stevens has crafted an excellent history as to how HTML5 got to where it is, and the compromises, retreats and reconsiderations that have been made along the way. The book is a critique of this process and its results, and attempts to put together the jigsaw pieces of the HTML5 API spec into a coherent picture. However, Luke's work is definitely not a development manual, and some of its recommendations should be seriously questioned.简介:卢克·史蒂文斯(Luke Stevens)在HTML5如何到达其位置以及沿途做出的妥协,撤退和重新考虑方面,已树立了极好的历史。 该书对这一过程及其结果进行了评论,并试图将HTML5 API规范的各个部分拼凑成一张连贯的图片。 但是,卢克的工作绝对不是开发手册,它的一些建议应该受到严重质疑。
Luke admits up front that The Truth About HTML5 is at least partly a diatribe against the status quo. That’s fine: while I’d almost always prefer to see someone try to change a process from within, there’s always a role for critics. Politics will be present whenever two or more people form an organization, and Luke has assembled a series of references that show how the political process played a part in forming HTML5, without getting too bogged down in detail.
卢克(Luke)预先承认关于HTML5的真相至少在一定程度上是对现状的侮辱。 很好:虽然我几乎总是希望看到有人尝试从内部更改流程,但批评家总是会扮演一个角色。 只要有两个或两个以上的人组成一个组织,就会出现政治问题,卢克(Luke)收集了一系列参考资料,这些参考资料显示了政治进程如何在形成HTML5方面发挥了作用,而又不会过于冗长。
The book begins to falter a little when it suggests an HTML5 web development process. For the most part, the author suggests abandoning many of the new tags that make up the HTML5 spec. His primary objections appear to be:
当它建议HTML5 Web开发过程时,这本书开始有些动摇。 在大多数情况下,作者建议放弃构成HTML5规范的许多新标签。 他的主要反对意见似乎是:
- The syntax is complicated; 语法很复杂。
- Because of that, web developers are misunderstanding / misusing it; 因此,Web开发人员会误解/滥用它。
IE 6 – 8 doesn’t understand it, and JavaScript shims that force it to do so can be circumvented.
IE 6 – 8无法理解它,可以避免强制执行此操作的JavaScript填充 。
On the first two points, I have news for Mr. Stevens: as simple as HTML 4 purports to be, people have been misunderstanding and misusing the language for a decade.
关于前两点,我有史蒂文斯先生的消息:就像HTML 4所声称的那样简单,十年来人们一直在误解和滥用该语言。
Go out to a web site and do View Source on a page sometime. Hell, try to validate most any page. The result is a mess of uninformed code: nested <blockquote>
tags to indent content, <b>
used inside of heading elements to “make them stand out more”, pages with presentational tables (which is still being taught as “the way to do page layout” by web development teachers today).
出门访问网站,并在某个页面上查看源代码 。 地狱,尝试验证大多数任何页面。 结果是一堆乱七八糟的代码:嵌套的<blockquote>
标签用于缩进内容, <b>
在标题元素内部用于“使它们脱颖而出”,带有表示表的页面(至今仍被教导为“进行网页布局”(今天由网络开发老师进行)。
Every version of HTML is complicated. Coding a web page well is hard. HTML5 makes it easier, if the spec is communicated clearly to the developer. To be sure, WHATWG, the W3C, and indeed most resources have done a poor job of that – the lack of good, consistent, up-to-date web development reference material was one of the primary reasons I started this blog. But a paucity of any of these things is not a cause for surrender, only a reason to try harder.
HTML的每个版本都很复杂。 编写好网页很难。 如果将规范清楚地传达给开发人员 , 则 HTML5使其变得更加容易。 可以肯定的是, WHATWG , W3C以及实际上大多数资源都做得很糟糕–缺少好的,一致的,最新的Web开发参考资料是我开始撰写此博客的主要原因之一。 但是,这些事情的匮乏并不是投降的原因,而只是努力的原因。
We use markup because it has meaning – <p>
tags rather than multiple <br>
elements – and because it’s the right thing to do. New elements such as <section>
and <article>
have meaning too, and a place in the web developer’s arsenal. These new tags will become especially important as pages become atomized: using them correctly now “future proofs” your work, to a certain degree.
我们使用标记是因为它具有含义 - <p>
标记而不是多个<br>
元素-并且这样做是正确的。 <section>
和<article>
等新元素也具有意义,并且在Web开发人员的武器库中占有一席之地。 随着页面变得原子化,这些新标签将变得尤为重要:正确使用它们现在可以在一定程度上“证明未来”。
In his defence, Luke suggests a decent intermediate solution: using <div>
tags with added ARIA Landmarks for accessibility. As a compromise for the confused, it makes sense – and the addition of accessibility is to be lauded – but he has neglected one obvious strategy, which I’ll discuss in a moment.
为了捍卫自己,Luke建议了一个不错的中间解决方案:使用<div>
标记并添加ARIA地标以实现可访问性。 作为对困惑的折衷方案,这是有道理的-值得称赞的是可访问性的增加-但他忽略了一个显而易见的策略,我将在稍后讨论。
观众在听 (The Audience Is Listening)
![Pie chart showing browser share of visitors to this site in June 2012](https://i-blog.csdnimg.cn/blog_migrate/eeb6b3dd7404181eb35b02ad6d29232f.png)
ChromeFrame ,则Luke坚持使用具有可访问性的旧的可靠标记的方法对于停留在IE 中的特定受众来说是有意义的数字黑暗时代 。
But by way of comparison, let’s look a chart of visitor’s browser use for this website over the last 30 days: that little aqua segment represents IE users to my blog, less than 4% of this site’s traffic. Of those, only 80 visitors used IE8 or below.
但是,通过比较,让我们看一下过去30天内该网站访问者浏览器的使用情况图表:浅绿色部分代表了我博客的IE用户,不到该网站访问量的4%。 其中,只有80位访客使用IE8或更低版本。
I recognize that this site is something of an outlier: its content caters primary to web developers, who are, for the most part, using modern browsers. Visitors using IE 7 & 8 on this blog are outnumbered more than 20 to 1 by mobile users, most of whom use browsers that follow modern standards.
我认识到该网站有点离谱:它的内容主要面向Web开发人员,而Web开发人员大多使用现代浏览器。 在此博客上使用IE 7和8的访问者在移动用户中所占比例超过20:1,其中大多数使用的是遵循现代标准的浏览器。
The question of “what technology should I deploy in my site?” is answered by “what browsers your visitors use?” Should I drop HTML5 features that have real advantages for users in preference to those who can’t, or won’t, move on? Should I invest in making a responsive site for 2,000 monthly mobile users, or instead use my time to make the site work better for the two lost souls who came in using IE6?
“我应该在网站中部署什么技术?”的问题 回答“您的访客使用什么浏览器?” 我应该放弃对用户真正有利HTML5功能,而不是不能或不会继续使用的功能吗? 我应该投资于为每月2,000个移动用户创建一个响应式网站,还是应该花我的时间使该网站对于使用IE6的两个迷失者更好地工作?
In an ideal world the answer would be “make changes that benefit everyone”, but there’s simply never enough time.
在理想的世界中,答案将是“做出使每个人都受益的更改”,但是根本没有足够的时间。
更好的解决方案 (A Better Solution)
Transferring old habits to new technology is not a way forward. Rather than dropping semantic markup as Luke recommends, my suggestion would be to take the best of both worlds: semantic HTML5 markup with ARIA roles and microdata / microformats, so long as it is appropriate to your audience. The richness, variety and occasionally confusing nomenclature of the specification sometimes makes this difficult. Luke quite correctly points out that outlining an HTML5 document is almost as important as validation, and doing so early and often should be emphasized during your planning and development, together with accessibility. Understanding how modern web technologies fit together is very important, and Luke does a good job of explaining the pieces, but there are few practical examples of how to apply the languages in the book.
将旧习惯转变为新技术并不是前进的道路。 我的建议不是放弃Luke所建议的语义标记,而是要充分利用两全其美:具有ARIA角色和微数据 / 微格式的语义HTML5标记,只要适合您的受众即可。 规范的丰富性,多样性和有时令人困惑的命名有时使这一点变得困难。 Luke相当正确地指出, 概述HTML5文档与验证几乎一样重要,并且在进行规划和开发时应及早进行,并且经常应强调这一点以及可访问性 。 理解现代Web技术如何组合在一起非常重要,Luke很好地解释了这些内容,但是在本书中很少有实际的示例说明如何使用这些语言。
结论 (Conclusion)
Luke deserves credit for self-publishing an ebook on a complex subject. Until an academic historian comes along, The Truth About HTML5 is probably the best book you will find on the complex story behind the creation of modern web technologies. It does best in the realm of “big picture” explanations, but is ignorant of some topics (Luke expresses surprise at discovering the <address>
tag, which has been around since HTML 3.2), while misrepresenting other issues. As an eagle-eye view of the current state of web technologies, it’s fine; for practical, real-world application of code, there are plenty of better, free alternatives such as Dive Into HTML5 and Designing For The Web together with real books like HTML & CSS by Jon Duckett and (I might humbly suggest) this blog.
卢克(Luke)因自己出版有关复杂主题的电子书而获得荣誉。 在学术史学家问世之前, 关于HTML5的真相可能是关于创建现代Web技术背后的复杂故事的最好的书。 它在“大图”解释领域中表现最佳,但对某些主题却一无所知(Luke对发现<address>
标记感到惊讶,该标记自HTML 3.2起就出现了),却误解了其他问题。 作为对Web技术当前状态的鸟瞰,这很好。 对于实际的实际代码应用,有很多更好的免费替代方法,例如Dive Into HTML5和Ding In The Web以及Jon Duckett和HTML(HTML)和CSS这样的真实书籍,以及本博客(我可能会很谦虚地建议)。
翻译自: https://thenewcode.com/561/Book-Review-The-Truth-About-HTML5
围城书评