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

Re: Custom Elements: 'data-' attributes

From: David Bruant <bruant.d@gmail.com>
Date: Wed, 07 May 2014 22:16:26 +0200
Message-ID: <536A949A.8050509@gmail.com>
To: Ryosuke Niwa <rniwa@apple.com>, Ian Hickson <ian@hixie.ch>
CC: Anne van Kesteren <annevk@annevk.nl>, Wilson Page <wilsonpage@me.com>, Dimitri Glazkov <dglazkov@google.com>, public-webapps@w3c.org
Le 07/05/2014 21:36, Ryosuke Niwa a écrit :
> On May 7, 2014, at 12:03 PM, Ian Hickson <ian@hixie.ch> wrote:
>
>> On Wed, 7 May 2014, Anne van Kesteren wrote:
>>> On Tue, May 6, 2014 at 7:19 PM, Wilson Page <wilsonpage@me.com> wrote:
>>>> I'm unsure whether or not it is safe to use custom attributes without
>>>> the 'data-', I've heard mixed opinions. How do we know that chosen
>>>> attributes won't someday be global attributes?
>>> Yeah, we should figure something out here. From one perspective you've
>>> already namespaced your element by using a dash. However, given the
>>> existence of an ever growing set of global attributes you probably do
>>> not want to clash with those.
>>>
>>> Maybe we should allow any attribute as long as it contains a dash (and
>>> does not match a set of existing names)? Still seems somewhat
>>> suboptimal.
>> 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 don't think "being careful" is a sound strategy.
>
> How are you going to quantify the risk of adding a new global attribute in the future?
>
> I don't want us to depend on some random search engines to make a guess as to which names are safe to use.
I want to agree with you, but it's impossible to prevent authors from 
using any sort of attributes in their content (willing to bet hard money 
web browers won't stop page rendering because some custom element 
attribute doesn't contain a dash; looking at the XHTML precedent if 
nothing else).
Such search will have to happen anyway.

It'd be nice if the tooling to make such search was available to 
inspection, though.

David
Received on Wednesday, 7 May 2014 20:16:57 UTC

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