[whatwg] Giving the <body> tag a new meaning.

Ian Hickson ian at hixie.ch
Thu Jun 9 11:08:47 PDT 2011


On Tue, 1 Mar 2011, usuario wrote:
>
> According to the spec:
> The body element represents the body of a document (as opposed to the
> document’s metadata).
> 
> I think definition is a bit ambiguous.
> 
> We may think in giving it a more explicit meaning, and freeing it for
> semantic availability (just an example):
> 
> <!DOCTYPE html>
> <html>
>     <head> <!--<metadata>, <system>, <config> -->
>         <meta></meta>
>         <script></script>
>         <link></link>
>     </head>
>     <markup> <!-- <window>, <render>, <main>, <app>, <structure> -->
>         <header>
>             <h1></h1>
>             <p></p>
>         </header>
>         <body>
>             <p></p>
>             <p></p>
>         </body>
>         <footer>
>             <p></p>
>         </footer>
>     </markup>
> </html>

What problem would this solve?

How would you deal with the legacy parsing issue? (If you omit <body> in 
the source, it's implied by the parser anyway.)


On Tue, 1 Mar 2011, usuario wrote:
>
> The real issue is with change, never is too late.
> Many of the new elements in html5 are for semantic purposes. Being now a
> <header> and a <footer>, there is only one left thing that's pretty obvious.
> 
> I am not proposing the body tag for disappear, but allow it for a new
> implementation. And perhaps in say 10 years, discontinue it as document
> start element, when the change be widely spread.
> 
> The reason? a better semantics advantages.

What does "a better semantics advantages" mean?


On Tue, 1 Mar 2011, usuario wrote:
> 
> Everything inside a word document IS CONTENT (not body). In that 
> document we may have or not a header, or a footer, but we always 
> "should" have a body, in this word document, for convenience purposes 
> text by default is intended to be body (hence no need to mark it as 
> that).

If your concern is just that the element has a confusing name, then I 
wouldn't worry about it. There's all kinds of elements in HTML whose names 
aren't very descriptive of what they mean.


> In HTML, as you say, everything by default is body (about the same a a 
> word document). But the thing is that in HTML5, WE ARE making 
> distinctions among *header* and *footer* content. My only counter here 
> is why aren't we making distinctions of body content too?

The "body"ness that <body>'s name is referring to is in contrast with the 
<head> element, which gives the document metadata. It's not in contrast to 
the document's visible header or footer -- they are both part of the 
document's "body" here.


> Is this semantic to you?
> <body>
>     <header></header>
>     <footer></footer>
> </body>
> There is an obvious (may be not dangerous) semantic issue there. Why in the
> world a footer can be inside a body, aren't they siblings of a document?

<body> is just another word for "visible part of the document" here.


> I've been requested to solve a problem. Former has never been a problem, 
> web as worked well in that way. I just am setting out a new way of 
> thinking about html. Being more declarative.

We try not to solve non-problems... we have enough problems to deal with 
as it is! :-)


On Tue, 1 Mar 2011, usuario wrote:
> 
> Here is a use case:
> <html>
>     <body>
>         Hi, I'm the most important content of this page, I'm kind of an
> article, and in HTML4 I can be considered the page's body, firstly because
> I'm inside that tag, and lastly because there aren't any other tags (hello
> header, hello footer) that could break my logic.
>     </body>
> </html>
>
> <html>
>     <body>
>         Hi, I'm the most important content of this page, I'm kind of an
> article but strictly speaking I can't be considered the page's body, because
> although I'm inside the body tag, I'm over the header tag. And a page body
> can't be over the page footer, or isn't it? I'm confused.
>         <header>Page title</header>
>         <footer>disclaimer, copyright</footer>
>     </body>
> </html>

Your example for HTML4 is wrong -- HTML4 can have page titles and 
copyrights too:

 <html>
     <body>
         Hi, I'm the most important content of this page, I'm kind of an
 article, and in HTML I can be considered the page's body.
         <h1>Page title</h1>
         <p>disclaimer, copyright</p>
     </body>
 </html>

But both examples are wrong because they're missing the <head>:


 <html>
     <head>
         <title>This is metadata (the page title)</title>
         <meta name=foo content=bar>
     </head>
     <body>
         Hi, I'm the most important content of this page, I'm kind of an
 article, and in HTML I can be considered the page's body.
         <h1>Page title</h1>
         <p>disclaimer, copyright</p>
     </body>
 </html>

It is this <head> that the <body> is defined in contrast to, not the 
<header> or <footer>.


> How long ago was html created?

1990.


> at that time sites where not as complex as now are, browsers were more 
> like a mail-man that had a message that contained a head (sender's name, 
> adress ...) and a body (senders real message). Now sites a more like 
> electronic brochures, we want them to have <header>s <footer>s, 
> <nav>igational elements, <or>dered and <un>ordered lists. And all those 
> things are web content, not web <body>. That's my point.

I don't see why they're not <body>, given how <body> is defined.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the whatwg mailing list