过时与弃用的HTML [英] Obsolete vs. Deprecated HTML

查看:136
本文介绍了过时与弃用的HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于HTML的术语过时与弃用之间有什么区别?在HTML5中,我似乎看到很多被标记为过时的元素... 在HTML 4.01规范中,条款 4.1定义将不推荐和过时定义为技术术语。简而言之,不推荐使用的功能是您不应该使用的功能,但浏览器应该继续支持它。过时的功能是为了历史目的而列出的,没有定义,并且不需要浏览器支持(尽管在实践中它通常仍然存在)。 HTML 4.01将大多数旧的表示元素和属性声明为不赞成使用。只有少数非常重要的元素被宣布为已过时。



在W3C HTML5草案中,术语是不同的。它根本不使用弃用这个词(除了在HTML 4.01中使用这个词时)。它没有将过时定义为技术术语(如适用于HTML的功能),但它使用了很多字。该词在 11 Obsolete features 部分中隐式定义。该草案指出,取决于功能,色调和特性有所不同,作者不使用过时的功能,但期望浏览器继续支持它们。它还包含其语法和语义的详细描述,部分甚至比旧规范更详细。

在HTML5草案中,大多数过时的功能也被归类为不符合,并声明他们不能被作者使用。这些功能涵盖了HTML 4.01中不赞成使用的大多数功能,还有一些功能,包括根本不在HTML 4.01中的功能。

例如,<$>在HTML 4.01中不推荐使用c $ c> font 元素,而在HTML5中不再使用元素。所以原则上,HTML 4.01你不应该使用,HTML5说你不应该使用它(HTML5验证器被告知发出错误消息,而不仅仅是一个警告)。实际上,差距较小,主要是原则问题。浏览器仍然需要解析元素并将其添加到文档树中,并且需要像以前一样实现它。


What is the difference between the terms "obsolete" and "deprecated" with regards to HTML? I seem to be seeing a lot of elements being flagged as "obsolete" in HTML5...

解决方案

In the HTML 4.01 specification, clause 4.1 Definitions defines "deprecated" and "obsolete" as technical terms. Briefly, a deprecated feature is something that you should not use, but browsers should keep supporting it. An obsolete feature is something that is just listed for historical purposes, not defined, and no browser support is required (though in practice it typically still exists). HTML 4.01 declares most of the old presentational elements and attributes as deprecated. Only a few very elements of little importance are declared as obsolete there.

In the W3C HTML5 draft, the terminology is different. It does not use the word "deprecated" at all (except when referring to the use of this word in HTML 4.01). It does not define "obsolete" as a technical term (as applicable to features of HTML), but it uses the word a lot. The word is implicitly defined in the 11 Obsolete features section. The draft tells, with somewhat varying tones and specialties depending on features, authors not to use obsolete features but expects browsers to keep supporting them. It also contains detailed descriptions of their syntax and semantics, partly even more detailed than in older specifications.

In the HTML5 draft, most of the obsolete features are also classified as "non-conforming", with the statement that they "must not be used by authors". These features cover most of the features that are deprecated in HTML 4.01, and some more, including features that were not in HTML 4.01 at all.

For example, the font element is deprecated in HTML 4.01, obsolete in HTML5. So in principle, HTML 4.01 you should not use, HTML5 says you shall not use it (and HTML5 validators are told to issue error message, not just a warning). In practice, the difference is smaller, mostly just a matter of principle. Browsers are still required to parse the element and add it to the document tree, and they are expected to implement it as before.

这篇关于过时与弃用的HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆