[whatwg] Including

Tab Atkins Jr. jackalmage at gmail.com
Tue Nov 13 09:49:08 PST 2012

On Mon, Nov 12, 2012 at 10:41 PM, Mark Nottingham <mnot at mnot.net> wrote:
> I've maintained a little library for a while that does inclusion:
>   https://github.com/mnot/hinclude
>   http://mnot.github.com/hinclude/
> It's used in a few different places, and is now part of Symfony <http://symfony.com>, apparently.
> Besides the obvious issue of "should HTML5 have an inclusion tag?", something else has come up.
> Right now, hinclude uses an XML namespace (hx:) to introduce a new tag. This was pretty widely tested to be interoperable way back, but AIUI that option is going away (whatever that means) in HTML5.

Namespaces have always been and will always be fine in the XHTML
serialization.  They have never been and will never be fine in the
HTML serialization.  Fake namespace prefixes "work" to some extent in
the HTML serialization, but you're better off using a dash instead of
a colon - you'll get more or less the same DOM, but saner, and it'll
work the same between the two serializations.

> It's been suggested <https://github.com/mnot/hinclude/issues/13> that a data-* attribute on div could be used here, but reading the description there, I'm not so sure:
> "[T]hese attributes are intended for use by the site's own scripts, and are not a generic extension mechanism for publicly-usable metadata."
> <http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#embedding-custom-non-visible-data-with-the-data-*-attributes>
> hinclude is intended to be visible to software beyond the site's own scripts. So, what's the appropriate thing to do here? Keep on using hx:include (after all, it works)? use data-include or similar? Or?

No, if it's included in the page, it's "the site's own scripts".  That
line is meant to exclude data-* attributes from being used to pass
information to crawlers/browsers/extensions/etc, so that the use of
data-* is guaranteed to always be safe for a site author, without any
unintended side effects.

If you intend this to be parsed by server-side software, you move into
grayer territory.  If it's really personal scripts, fine.  If it's
meant to be an Apache extension, not fine, for the same reason as


More information about the whatwg mailing list