{"action":"created","issue":{"url":"https://api.github.com/repos/whatwg/html/issues/100","labels_url":"https://api.github.com/repos/whatwg/html/issues/100/labels{/name}","comments_url":"https://api.github.com/repos/whatwg/html/issues/100/comments","events_url":"https://api.github.com/repos/whatwg/html/issues/100/events","html_url":"https://github.com/whatwg/html/issues/100","id":104859192,"number":100,"title":"Consider aligning WHATWG main element definition with W3C definition","user":{"login":"stevefaulkner","id":835859,"avatar_url":"https://avatars.githubusercontent.com/u/835859?v=3","gravatar_id":"","url":"https://api.github.com/users/stevefaulkner","html_url":"https://github.com/stevefaulkner","followers_url":"https://api.github.com/users/stevefaulkner/followers","following_url":"https://api.github.com/users/stevefaulkner/following{/other_user}","gists_url":"https://api.github.com/users/stevefaulkner/gists{/gist_id}","starred_url":"https://api.github.com/users/stevefaulkner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevefaulkner/subscriptions","organizations_url":"https://api.github.com/users/stevefaulkner/orgs","repos_url":"https://api.github.com/users/stevefaulkner/repos","events_url":"https://api.github.com/users/stevefaulkner/events{/privacy}","received_events_url":"https://api.github.com/users/stevefaulkner/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/whatwg/html/labels/normative%20change","name":"normative change","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":118,"created_at":"2015-09-04T09:39:52Z","updated_at":"2015-10-02T19:52:06Z","closed_at":null,"body":"The main element was designed and implemented based on the concept of there being a single instance within a document, the markup pattern was based on data of [id value usage](http://www.w3.org/TR/html-main-element/#notes) in the wild. The whatwg definition differs markedly from the orginal definition. This leads to [confusion for developers](https://twitter.com/peeja/status/639451464608432128).\r\nThe [W3C nu html checker](https://validator.w3.org/nu/), which is used by many, throws an error when main is used as per whatwg. Data derived from [webdevdata.org](http://webdevdata.org/) shows that >97% of usage of the &lt;main> element is as per the W3C definition and anecdata from users that consume the semantics suggests that one main element per page is the expected and most useful pattern. In general consumers landmark semantics report that the utility of landmarks is reduced as the number/instances of landmark elements in a document increases. \r\nThe alignment would involve changes to the main and body element definitions.\r\ncurrent W3C definitions:\r\n* [main element](http://www.w3.org/TR/html51/semantics.html#the-main-element)\r\n* [body element](http://www.w3.org/TR/html51/semantics.html#the-body-element)\r\n"},"comment":{"url":"https://api.github.com/repos/whatwg/html/issues/comments/145139550","html_url":"https://github.com/whatwg/html/issues/100#issuecomment-145139550","issue_url":"https://api.github.com/repos/whatwg/html/issues/100","id":145139550,"user":{"login":"sideshowbarker","id":194984,"avatar_url":"https://avatars.githubusercontent.com/u/194984?v=3","gravatar_id":"","url":"https://api.github.com/users/sideshowbarker","html_url":"https://github.com/sideshowbarker","followers_url":"https://api.github.com/users/sideshowbarker/followers","following_url":"https://api.github.com/users/sideshowbarker/following{/other_user}","gists_url":"https://api.github.com/users/sideshowbarker/gists{/gist_id}","starred_url":"https://api.github.com/users/sideshowbarker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sideshowbarker/subscriptions","organizations_url":"https://api.github.com/users/sideshowbarker/orgs","repos_url":"https://api.github.com/users/sideshowbarker/repos","events_url":"https://api.github.com/users/sideshowbarker/events{/privacy}","received_events_url":"https://api.github.com/users/sideshowbarker/received_events","type":"User","site_admin":false},"created_at":"2015-10-02T19:52:06Z","updated_at":"2015-10-02T19:52:06Z","body":">  @sideshowbarker, are you doing any work on the validator, and what's the general thinking on emitting messages when something may be wrong but isn't necessarily so?\r\n\r\nShort answer: The thinking is that it’s doable and has precedent. In this specific case, I could imagine the checker could emit a message something like this:\r\n\r\n> **Warning:** Document contains more than one `main` element. Documents must not use the `main` element to mark up content that is not the main content of the document. Ensure that this document is using the `main` element correctly.\r\n\r\nBut if we were to do that, I think we should add some language in the spec to tie that back to; so, something added the spec section on the `main` element like this:\r\n\r\n> Documents must not use the `main` element to mark up content that is not the main content of the document.\r\n\r\n-----\r\n#### Longer answer\r\nAs @stevefaulkner mentions, there are a limited number of cases where I’ve experimentally added warnings to the HTML checker that aren’t strictly required by any spec. I consider the question of what particular warnings (as opposed to errors) the checker should emit to be an area where I and other checker implementors have some discretion; that is, I think we can add them when we believe they’re useful, even if we can’t tie them to some specific requirement/language in the spec.\r\n\r\nThat said, I’d prefer to always have something in the spec to which a particular warning could be tied.\r\n\r\nSo in the case, for example, we could add a statement to the spec something like this:\r\n\r\n> Documents must not use the `main` element to mark up content that is not the main content of the document.\r\n\r\nIt could reasonably argued that would be restating the following [statement from the spec](https://html.spec.whatwg.org/multipage/dom.html#semantics-2):\r\n\r\n> Authors must not use elements, attributes, or attribute values for purposes other than their appropriate intended semantic purpose, as doing so prevents software from correctly processing the page.\r\n\r\nBut I think there are cases with particular elements and attributes where it’s useful to more explicitly state what the particular intended semantic purpose of a given element or attribute is, and this seems to me like one of those cases.\r\n\r\nAnyway, as far as the checker behavior goes, the “Documents must not use the `main` element to mark up content that is not the main content of the document.” is not machine-testable, so I couldn’t have the checker emit an error for it. But I could have it emit a warning along these lines:\r\n\r\n> Warning: Document contains more than one `main` element. Documents must not use the `main` element to mark up content that is not the main content of the document. Ensure that this document is using the `main` element correctly."}}