Re: Custom Elements: 'data-' attributes

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