Re: [custom-elements] Prefix x- for custom elements like data- attributes

On Mon, Apr 25, 2016 at 1:06 PM, Bang Seongbeom <bangseongbeom@hotmail.com>
wrote:

> It would be good to restrict custom element's name to start with like
> 'x-' for the future standards. User-defined custom attributes; data
> attributes are also restricted its name to start with 'data-' so we can
> define easily new standard attribute names ('aria-*' or everything
> except for 'data-*'.)
>

You can't really reasonably further restrict future HTML though.  Relaxing
it is easier than restricting it.  I can't really really understand why
you'd want to in this case as they are dasherized.  HTML doesn't need
dasherized native elements.

In practice attributes aren't really restricted either - there is a
veritable ocean of custom attributes out there that are not data-*
prefixed.  data-* attributes do give you a potentially nicer API for
dealing with attribute-oriented properties.  Things like angular used ng-*
and, realistically, those are probably safe.  It's not likely that html
needs those in the future.   They've also done some interesting things at
looking at what is actually functionally valid - like attribute names that
are surrounded by braces or parens.  In any case, since people are well
aware that they -can- use any old attributes, it kind of doesn't matter
what the spec says when it comes to new standards.  If it would break the
web, it would break the web.

Same with custom tags really, HTML has always permitted them because that's
how it is forward parsable... But they haven't had a way to be useful.
Custom elements, make them useful, but put them in a compelling box that
allow us to add anything that isn't dasherized.  That was a long long long
way in the making, I can't honestly see it being undone in an even stricter
fashion.



-- 
Brian Kardell :: @briankardell

Received on Monday, 25 April 2016 17:51:24 UTC