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

Re: Custom Elements: 'data-' attributes

From: Ian Hickson <ian@hixie.ch>
Date: Thu, 8 May 2014 17:42:04 +0000 (UTC)
To: Bruce Lawson <brucel@opera.com>
cc: Anne van Kesteren <annevk@annevk.nl>, Wilson Page <wilsonpage@me.com>, Dimitri Glazkov <dglazkov@google.com>, public-webapps@w3c.org
Message-ID: <alpine.DEB.2.00.1405081737550.11724@ps20323.dreamhostps.com>
On Thu, 8 May 2014, Bruce Lawson wrote:
> On 7 May 2014 20:03, Ian Hickson <ian@hixie.ch> wrote:
> >
> > Requiring a dash is pretty ugly. I would allow any attribute, and 
> > we'll just have to be careful when introducing new global ones.
> 
> I think the ship HMS Ugly has already sailed, given a dash is compulsory 
> for the names of custom elements. Also, requiring a dash in the names of 
> custom attributes would establish an easily-memorable convention for 
> authors, and safeguard new global attributes.

I disagree. With element names, you really should be putting a uniquish 
prefix on your element names to avoid clashes with other custom vocabs. So 
the dash is just the way we encourage that.

   <google-button>
   <yahoo-button>

...etc.

But the attributes are _already_ scoped, since they're on the element.

   <android-patterngrid width=3 height=3>

...vs

   <android-patterngrid data-width=3 data-height=3>

The "data-" bits don't add anything useful.


Anne's point about the DOM interface also being an issue is very important 
also. Unless we're also going to be forcing everyone to prefix their APIs, 
which would also be really ugly, the namespace wouldn't be protected anyway.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 8 May 2014 17:42:43 UTC

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