[html5] Processing instruction

Benjamin Hawkes-Lewis bhawkeslewis at googlemail.com
Sun Jan 8 05:43:15 PST 2012

On Sun, Jan 8, 2012 at 12:48 PM, David Leunen <leunen.d at gmail.com> wrote:
> Hi,
> How do I markup a metadata at a specific position in an HTML document ? Not
> *on* elements (I'd use microdata/RDFa for that) but, let's say, *between*
> two of them for example.
> As I understand it, processing instructions are not allowed in HTML5. Am I
> correct ?
> If so, what is the equivalent  ?
>  Should I use :
> - an empty <span data-foo="bar"/> for that ?
> - an empty <hr> ?
> - a comment ?
> - a PIs anyway (because even if not allowed, they seem to be treated like
> comments anyway) ?
> - something else ?
> (The semantic meaning of the metadata is more of less "this is where my
> application may insert comments")

@class, @data-, or RDFa are certainly extension points you could use:




"span" and "div" carry no semantic meaning, so it's fine to use them
as arbitrary data markers.

If your use-case is putting templates directly into your DOM, @hidden
is perhaps the feature best suited, although current support is poor:


For example to indicate where to add a comment, you might do something like:

      <address>John Doe</address>
      <p>Hello world!</p>
   <article hidden data-yourappname-template-populate="comment">
      <address data-yourappname-template-populate="author"></address>
      <div data-yourappname-template-replace="text"></div>

Benjamin Hawkes-Lewis

More information about the Help mailing list