Re: RDFa in HTML vs XHTML

On Sat, Nov 12, 2011 at 10:45 PM, Jeni Tennison <jeni@jenitennison.com> wrote:
> (Henri, question for you embedded in here: aside from the movement of <link> and <meta> which we know about,

What movement are you referring to? In HTML5 once the </head> end tag
has been seen but before the <body> start tag has been seen, <link>
and <meta> move to the head. Rumors about other <link> or
<meta>-specific movements while true of some legacy browsers are
untrue of the HTML(5) parsing algorithm.

<link> and <meta> do move in situations where almost everything moves.
More below.

> is being a valid HTML5 document enough to avoid unanticipated movement of elements that might result in changes to a publisher's intended microdata/RDFa/microformats?)

Yes. In fact, it is enough for the document to be free of Parse
Errors. Even better, it's enough for the document to be free of the
kind of Parse Errors that Firefox Nightly happens to report, so if you
View Source in a build from the Firefox Nightly channel and View
Source, there are no unanticipated element movements if you see no red
text when viewing source (there may be unanticipated text movement,
though, due to limitations in the current reporting capabilities of
View Source).

> It looks as though this is something that hits microdata too. If you have:
>
>  <div itemscope itemid="#foo" itemtype="http://schema.org/CreativeWork">
>    <table itemscope itemid="#bar" itemtype="http://schema.org/CreativeWork">
>      <p itemprop="title">Hello World</p>
>    </table>
>  </div>

Regarding movement of <link> and <meta>, they'd be hoisted above the
table, too, if you did
<table><link><meta></table>

Likewise, stuff after the </body> tag will be hoisted into the body
element. (Including whitespace, which shocks people from time to
time.)

Additionally, if you want to use Microdata or RDFa, you really want to
avoid triggering element cloning and reparenting by the Adoption
Agency Algorithm.

>  <!DOCTYPE html>
>  <html>
>  <head><title></title></head>
>  <h1>Hello World</h1>
>  <p>A global greeting for all.</p>
>  </html>
>
> as a valid HTML5 document despite it not having a <body> element, but perhaps that's a validator.nu bug…)

It is not a bug. The document has a body *element* it just doesn't
have a <body> *tag* which is optional in this case. See
http://www.whatwg.org/specs/web-apps/current-work/#optional-tags for
the cases where tags are optional. Most of the optional tags have been
inherited from HTML4, except </rp> and </rt> being optional is legacy
from IE5.

-- 
Henri Sivonen
hsivonen@iki.fi
http://hsivonen.iki.fi/

Received on Tuesday, 15 November 2011 08:46:32 UTC