Difference between revisions of "Rationale"
(→General Rationale: Added new section "Why stick to semantics...")
(→Grouping content: reformatted heading in form of a question)
|Line 112:||Line 112:|
=== Grouping content ===
=== Grouping content ===
==== <code>blockquote</code> ====
==== <code>blockquote</code> ====
and inline citations inside the <code>blockquote</code> element
the specification does not consider to be part of block quote proper.<ref>http://developers.whatwg.org/grouping-content.html#the-blockquote-element</ref> In other words, the <code>blockquote</code> element represents only the quote itself.
=== Text-level semantics ===
=== Text-level semantics ===
Revision as of 15:33, 15 February 2013
This rationale document is supplemental to the WHATWG HTML Living Standard specification. It is a work-in-progress.
- 1 General Rationale
- 1.1 One Vendor, One Veto
- 1.2 Using elements where scripts "work"
- 1.3 It isn't just about web browsers
- 1.4 Experimenting with features
- 1.5 Versioning the spec
- 1.6 Modifying existing semantics
- 1.7 What is the purpose of defining elements semantically?
- 1.8 Why is it important to stick to the semantics as defined in the spec?
- 2 Specific Elements
- 2.1 The DOCTYPE (Document Type Declaration)
- 2.2 Document metadata
- 2.3 Sections
- 2.4 Grouping content
- 2.5 Text-level semantics
- 2.6 Embedded content
- 2.7 Forms
- 2.8 Interactive elements
- 3 HTML parsing
- 4 Rejected proposals
- 5 Other Pages
- 6 References
One Vendor, One Veto
Part of the the goal of the WHATWG is to document how web browsers actually handle HTML. As such, browser vendors already have veto power—by not following the standard. The W3C and WHATWG do not have any enforcement power and can only write what browsers are willing to implement. Not removing features from the HTML standard that at least one browser vendor has stated they are unwilling to implement causes the HTML spec to not accurately document reality.. The veto isn’t a power that we grant browsers; it’s a right that they earn on their own by virtue of having users. The minimum market share for a veto is somewhere around 1%.
Using elements where scripts "work"
It isn't just about web browsers
Web browsers are not the only programs that use HTML. Sometimes elements and features are needed even when browsers won't use them in any meaningful way. Document authoring tools, validators, search engines, screen readers, outliners, researchers, etc. all need and can use more information than a browser can. Furthermore if you provide more information than is currently used by browsers it opens up room for innovation.
Experimenting with features
New unknown and untested features are unlikely to get accepted into the WHATWG spec. Browsers and browser extensions (like Google Gears) are expected to first establish use cases and implementation possibilities before the spec is changed. 
Versioning the spec
Most authors don't care about whether or not an implementation supports an entire, full specification; they just want to know "Can I use this feature in this browser?" So saying that all major implementations support much of CSS 2 to a high degree of correctness is useless for knowing if, say, the author can use display: run-in. In other words, the feature tables are what web authors would actually use in real life.
Modifying existing semantics
Some elements have different semantics than what HTML 4 users would expect. Semantic markup isn’t very useful if most pages use elements in a manner that conflicts with the defined semantics. For example, if a search engine treated
dd as enclosing a term being defined, for the purposes of searching for definitions, it would not find many definitions, and it would misclassify things.
What is the purpose of defining elements semantically?
Semantic definitions allow HTML processors, such as Web browsers or search engines, to present and use documents and applications in a wide variety of contexts that the author might not have considered.
Consider a Web page written by an author who only considered desktop computer Web browsers. Because HTML conveys meaning, rather than presentation, the same page can also be used by a small browser on a mobile phone, without any change to the page. Instead of headings being in large letters as on the desktop, for example, the browser on the mobile phone might use the same size text for the whole the page, but with the headings in bold.
The same page could equally be used by a blind user using a browser based around speech synthesis, which instead of displaying the page on a screen, reads the page to the user, e.g., using headphones. Instead of large text for the headings, the speech browser might use a different volume or a slower voice.
Since the browsers know which parts of the page are the headings, they can create a document outline that the user can use to quickly navigate around the document, using keys for “jump to next heading” or “jump to previous heading”. Such features are especially common with speech browsers, where users would otherwise find quickly navigating a page quite difficult.
Even beyond browsers, software can make use of this information. Search engines can use the headings to more effectively index a page, or to provide quick links to subsections of the page from their results. Tools can use the headings to create a table of contents (that is in fact how the table of contents of the WHATWG HTML specification is generated).
This example has focused on headings, but the same principle applies to all of the semantics in HTML.
Why is it important to stick to the semantics as defined in the spec?
Not adhering to the spec’s semantics prevents software that assumes and relies on said semantics from correctly processing the document.
For example, the following document is non-conforming, despite being syntactically correct:
<!DOCTYPE HTML> <html lang="en-GB"> <head> <title> Demonstration </title> </head> <body> <table> <tr> <td> My favourite animal is the cat. </td> </tr> <tr> <td> <a href="http://example.org/~ernest/"><cite>Ernest</cite></a>, in an essay from 1992 </td> </tr> </table> </body> </html>
…because the data placed in the cells is clearly not tabular data (and the
cite element is misused). This would make software that relies on these semantics fail. For example, a speech browser that allowed a blind user to navigate tables in the document would report the quote above as a table, confusing the user; similarly, a tool that extracted titles of works from pages would extract “Ernest” as the title of a work, even though it’s actually a person’s name, not a title.
A corrected version of this document might be:
<!DOCTYPE HTML> <html lang="en-GB"> <head> <title> Demonstration </title> </head> <body> <blockquote> <p> My favourite animal is the cat. </p> </blockquote> <p> —<a href="http://example.org/~ernest/">Ernest</a>, in an essay from 1992 </p> </body> </html>
The DOCTYPE (Document Type Declaration)
Because HTML has moved to an unversioned model, the
DOCTYPE does not a have version number. The inclusion of a document type declaration is necessary merely for legacy browsers that will operate in quirks mode (a non-spec compliant rendering mode) if a
DOCTYPE is absent.
charset attribute on the
meta element in XML documents
charset attribute on the
meta element has no effect in XML documents; it is only allowed in order to facilitate migration to and from XHTML.
Inclusion of the
User agents may want to use the Web application name in UI in preference to the page’s
title, as the title might include status messages and the like relevant to the status of the page at a particular moment in time instead of just being the name of the application.
On the continued inclusion of the
Considering that the
keyword value has historically been used unreliably and even misleadingly as a way to spam search engine results (i.e., to garner higher search engine rankings), why is this feature still included in the spec? Because a content management system, for example, can use the keyword information of pages within the system to populate the index of a site-specific search engine. In short, keywords have use beyond the large-scale content aggregators (e.g., Google) that pervade the Web.
hgroup and other heading elements
The point of
hgroup is to hide the subtitle from the outlining algorithm.
The primary purpose of these elements is merely to help the author write self-explanatory markup that is easy to maintain and style; they are not intended to impose specific structures on authors.
===== Why is it non-conforming to place attributions and inline citations inside the
Because the specification does not consider attributions and inline citations to be part of a block quote proper. In other words, the
blockquote element represents only the quote itself.
On the status of
image element is treated as an alternate (but invalid) name for
img. This is because some sites (around 0.2%) make this mistake. It is already treated as an image by most major browsers.
img element and alternate (
On certain types of pages adding alternate text (with the
alt attribute) is impossible (e.g., sites where the user can upload but with no mechanism to supply a description). Because of this, the
alt attribute is optional. 
A longdesc attribute is not needed 
The text area defaults to soft wrapping of the text area. The attribute @wrap can have one of the following values: soft, hard, or off.. "off" is considered a non-conforming value because it appears to have no purpose other than a visual presentational effect. 
progress (are not the same thing)
meter is not just a special case of
meter element represents a scalar measurement within a known range, such as storage quota usage, a relative popularity rating or relevance indicator. The control allows for the indication of high and low ranges, or minimum, maximum and optimal levels.
progress element, on the other hand, represents the completion progress of a task. This could be a real time indicator for background processing task (e.g. using Web Workers or a file upload).
progress elements can also be in the indeterminate state, indicating that something is in progress, but its completion progress is unknown.
See Re: <progress> draft for details.
details element is needed to provide an accessible way of reflecting a
common application widget in HTML-based applications without requiring authors
to use extensive scripting, ARIA, and platform-specific CSS to get the same
@DEFER and @ASYNC
ASYNC tells the browsers to run the script with its following content at the SAME time(namely, asynchronously). DEFER tells the browsers to run the script LATER, and to run the following content first(the browsers will run the script until the page is ready).
The HTML parser has the following behavior difference in quirks mode:
- A start tag whose tag name is "table"
- If the Document is not set to quirks mode, and the stack of open elements has a p element in scope, then act as if an end tag with the tag name "p" had been seen.
ignored white space before head
White space before the
<head> tag is ignored. The main reason is that, given the markup
<!DOCTYPE html> <html> <head> <title>Sample page</title> ...,
some people expect
to return the
Why isn’t there a dedicated element for user comments? (e.g.,
There is no dedicated element for marking up user comments, i.e., content composed by users in response to a newspaper or magazine article, blog entry, discussion topic, status update, image, video, etc. The spec suggests using nested
Several arguments have been put forth in favor adding a
comment element to the spec . Arguments and counterarguments run as follows:
Argument: Comments are not articles according to the commonly understood (dictionary) definition of “article.” Articles are relatively “long” pieces of writing, and they are not responses to what others have written. It’s clear that comments are not articles.
Counterargument: The element name “article” isn’t intended to carry the same meaning as its corresponding dictionary entry or any colloquial understanding of the term. A composition’s length and whether or not it’s authored by a site’s owner/staff or by it’s readers is completely irrelevant.
Argument: Comments are not articles according to the specification’s definition because, in general, articles are clearly not complete, self-contained, independently distributable or reusable pieces of writing. They depend on the context of what they are responding to. For example, “LOL” or “Yeah, especially when talking about your lobbyist friends!” are, on their own, unintelligible.
Counterargument: The definition of
article does not require that a piece of writing be fully intelligible on its own. The terms “complete,” “self-contained,” and “independent” are really meant to convey the idea of separateness. Comments are separate from what they are commenting on—they are not part of the piece of writing they are referring to. Therefore they can be independently distributed or reused. An example of this is the website reddit (consider, for example, http://www.reddit.com/r/bestof/, where every post is an example of a comment that was independently syndicated). It’s largely a matter of the author’s intent as to whether or not a piece of writing is something unto itself or part of a larger whole.
Argument: Comments can appear in reference to things that are not articles, such as blog posts, forum topics, social network status updates, images, videos, links, etc., which should not have to be marked up as articles just so the comments can be marked up as nested articles.
Counterargument: All the content types mentioned above are in fact articles according to the spec’s definition.
Argument: Robots and plugins can extract comments from web pages more easily if they have their own element. Comments can then be more easily syndicated, displayed, hidden, styled, etc.
Counterargument: There’s no compelling argument that a separate element would make this meaningfully easier than than nested
Argument: Comments sometimes appear in a different region of the page than the item they are referencing, hence the markup for comments should not have to be contained within the markup of the item.
Counterargument: No evidence has been put forth to suggest that this is a significant authorship issue.
Why isn’t there a dedicated element for advertisements? (e.g.,
There is no dedicated advertisement element (
<advert>, etc.) because it would give users a relatively easy method for hiding or otherwise disabling ads, in which case the element would very likely end up not being used by content authors. The
aside element is probably the closest semantic fit for advertisements.
Why isn’t there a
sandbox attribute on the
Various proposals have come up with the idea of being able to determine if a certain feature is available. These fail for a variety of reasons: Part of the problem is that browser vendors will be economical with the truth. Marketing people always have an over-optimistic view of the compliance of their product, and will always give themselves the benefit of the doubt in borderline cases. Also, changing the compliance statement, to remove false claims that are exposed, is likely to a very low priority for the developers. With regard to CSS feature compliance: Remember that CSS provides hints and implementations don't have to accept those hints, and hardware may sometimes prevent their being implemented. Some other reasons can be found in the footnotes.
custom HTML elements
Custom elements make it impossible for search engines, developers, and browsers to understand the semantics of a page.
- HTML Design Principles
- Why no namespaces
- Why no script implements
- Why not reuse legend or another mini-header element.
- XHTML2 versus HTML5
- <meta http-equiv=content-language>
- earlier page started with the same purpose.
- rationale for some new HTML5 elements
- WHATWG FAQ
- http://lists.w3.org/Archives/Public/public-html/2009Jul/0257.html -- Re: Codecs for <video> and <audio></a>
- http://lists.w3.org/Archives/Public/www-archive/2009Jul/0075.html --Formal Objection to One vendor, One Veto
- Email from Ian Hickson; comment in spec source
- [whatwg] several messages about the tree construction stage of HTML parsing