Re: Custom Elements: 'data-' attributes

On Mon, May 12, 2014 at 9:39 PM, Ryosuke Niwa <rniwa@apple.com> wrote:
> But expandos are usually added to HTMLElement and other builtin elements, right?

Depends, might be on instances too.


> What we're talking about here is adding properties and methods on a custom element, which is a subclass of HTMLElement so I don't think it'll cause the same issue.

If a site has if (ele.prop) you'd have that issue since that suddenly
starts returning true for e.g. the <body> element or some such.
Similar reason is why getElementById() is not available an elements.


Sole had the idea of providing hooks for attributes so a component can
say it handles them rather than the user agent. That makes a lot of
sense to me. That way you can grab any name, even existing ones.


-- 
http://annevankesteren.nl/

Received on Tuesday, 13 May 2014 09:37:53 UTC