# Re: data-* attributes

From: David Carlisle <davidc@nag.co.uk>
Date: Mon, 3 Nov 2014 14:00:00 +0000
Message-ID: <54578A60.20809@nag.co.uk>
To: Peter Krautzberger <peter.krautzberger@mathjax.org>
CC: "www-math@w3.org" <www-math@w3.org>
On 03/11/2014 13:47, Peter Krautzberger wrote:
>
>  > One reason [...]
>> isthat HTML moved away from grammar based syntax
>>(data-* being a good example of something that can't even be
> approximated in any of
>>dtd/RelaxNG or XSD schema).
>
> Right. Still, I'd argue that it is a significant use case. Perhaps there
> could be note suggesting a best practice for providing information in
> XML that would be represented as data-* in HTML.

In a pure XML context, attributes in (any) namespace would be the way:
data- is in some ways an html response to address that without the
complication of namespaces. MathML even back as far as MathML1 has
always allowed any attributes in other namespaces (in the prose and as
far as possible in the grammar) The schemas allow it, DTD has a
parameter entity that makes it easy to extend an initially empty set of
namespaced attributes, which is best you can do in DTD.

Trouble is (as you see already in aria: v aria- attributes) documents
don't always live in purely xml or purely html contexts and "best
practice" for switching between the two isn't always clear yet.

>
>>MathJax could easily ignore  [...]
>
> FWIW, MathJax wasn't the motivation for my question; this came out of
> questions regarding JATS. In practice, data-* works just fine; it's just
> not formally valid.

<mi jats:foo="bar"> is valid to the MathML3 schema (as long as jats:
namespace is declared somewhere) it's just that you don't want to let
attributes with colons in their name anywhere near an HTML parser, the
behaviour is specified but not particularly useful. So by spec the
implied suggestion is to have
<mi jats:foo="bar"> in XML and <mi data-jats-foo="bar"> in HTML
But just allowing the latter in XML would probably make everyone's life
easier.

> Peter.
>
David

Received on Monday, 3 November 2014 14:00:38 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:27:47 UTC