Re: [whatwg] Including

On Tue, 13 Nov 2012, Mark Nottingham 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.

(For what it's worth, inclusion in HTML is done using <iframe seamless>.)


> Right now, hinclude uses an XML namespace (hx:) to introduce a new tag. 

In application/xhtml+xml (XML), this is and has always been non-conforming 
HTML (in the same sense that any non-HTML vocabulary is not HTML), and 
will continue to work exactly as it does today indefinitely.

In text/html, this is and has always been non-conforming (in the same 
sense that any bogus syntax or tag name is non-conforming), and will 
continue to work exactly as it does today indefinitely.

Note that in XML and HTML these conformance errors are treated very 
differently (in particular, the element ends up in the HTML namespace in 
text/html, and in its own namespace in XML).


> This was pretty widely tested to be interoperable way back, but AIUI 
> that option is going away (whatever that means) in HTML5.

Nothing is changing in terms of how it is to be interpreted by browsers.

It's definitely not a recommended syntax, though, as it results in such 
divergent DOMs depending on whether it's used in HTML or XML.

(Another dodgy part of this feature, from a conformance perspective, is 
the include files themselves. They seem to be in a proprietary format 
derived from HTML, not HTML, which has all kinds of implications on where 
hinclude can be used and where it can't and what would happen with 
handling any errors in the includes, and so forth. Also, the script 
completely ignores the Content-Type of these files.)


> 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.

What else is it intended to be used by?


> So, what's the appropriate thing to do here? Keep on using hx:include 
> (after all, it works)? use data-include or similar? Or?

Appropriate in what sense?

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

Received on Tuesday, 13 November 2012 19:03:55 UTC