Re: Custom Elements: 'data-' attributes

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