W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2014

Re: Custom Elements: 'data-' attributes

From: Brian Kardell <bkardell@gmail.com>
Date: Thu, 8 May 2014 13:49:43 -0400
Message-ID: <CADC=+jfcELD-7cjzdRLj9DjrPWiQRZXx4pKkbPfm9YkiAvrOKQ@mail.gmail.com>
To: Anne van Kesteren <annevk@annevk.nl>
Cc: Ryosuke Niwa <rniwa@apple.com>, Glenn Maynard <glenn@zewt.org>, Ian Hickson <ian@hixie.ch>, Wilson Page <wilsonpage@me.com>, Dimitri Glazkov <dglazkov@google.com>, "public-webapps@w3c.org" <public-webapps@w3c.org>
On Thu, May 8, 2014 at 5:37 AM, Anne van Kesteren <annevk@annevk.nl> wrote:

> On Thu, May 8, 2014 at 12:53 AM, Ryosuke Niwa <rniwa@apple.com> wrote:
> > The answer to that question, IMO, is no.  It's not safe to use custom
> > attributes without 'data-' if one wanted to write a forward compatible
> > document.
> Note that the question is scoped to custom elements, not elements in
> general.
> It seems kind of sucky that if you have already minted a custom
> element name, you still need to prefix all your attributes too.
> <j-details open="">
> reads a lot better than
> <j-details data-open="">
> The clashes are also likely to happen on the API side. E.g. if I mint
> a custom element and support a property named selectable. If that gets
> traction that might prevent us from introducing selectable as a global
> attribute going forward.
> --
> http://annevankesteren.nl/
What do the parsing rules say about what an attr may begin with? Is it
plausible to just leading underscore or leading dash them as in CSS so that
all that's really necessary is for HTML to avoid using those natively (not
hard, cause, why would you) and then you provide an easy hatch for good
authors and get decent protection without getting too crazy?

Brian Kardell :: @briankardell :: hitchjs.com
Received on Thursday, 8 May 2014 17:50:11 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:14:24 UTC