Obsolete vs. Deprecated HTML

后端 未结 4 384
甜味超标
甜味超标 2021-01-11 16:50

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..

相关标签:
4条回答
  • 2021-01-11 17:40

    The dictionary tells the story pretty well:

    Deprecated: Express disapproval of.

    Obsolete: No longer produced or used; out of date.

    It is recommended that you don't use deprecated elements, because they will likely not be supported in the future, whereas obsolete elements have already been discontinued from use.

    0 讨论(0)
  • 2021-01-11 17:43

    In your question, you reference a blog post that subsequently links to the W3 specification regarding obsolete elements.

    http://www.w3.org/TR/html5/obsolete.html#obsolete

    So as the blog you linked to eludes, obsolete elements should never be used, there are alternatives available. For deprecated elements, browsers will generally still support and render them for backwards-compatibility, but your page will not pass conformance validation.

    0 讨论(0)
  • 2021-01-11 17:44

    Obsolete generally means that it has been replaced with something else.

    Deprecated means that future developments may not support it.

    0 讨论(0)
  • 2021-01-11 17:52

    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.

    0 讨论(0)
提交回复
热议问题