domenic / html-as-custom-elements

HTML as Custom Elements
https://domenic.github.io/html-as-custom-elements/
Apache License 2.0
260 stars 20 forks source link

Global attributes #5

Open ghost opened 10 years ago

ghost commented 10 years ago

How do the implementation of global attributes fit into the bedrock idea?

http://www.w3.org/TR/html-markup/global-attributes.html

Does every element need to implement them separately? Does this behavior come along with extending the HTMLElement prototype?

The two that stand out as interesting to me are accesskey and title. Access keys could be implemented with keydown events and title dialogs with a css hover menu.

If you wanted to polyfill/prollyfill a new global attribute, where would that behavior go? Theres no equivalent of the createdCallback for every element with a certain attribute.

arv commented 10 years ago

I was also thinking about this. For example, to allow onfoo attributes for event listeners we would need a global mutation obsever. I guess mutation observers could fill the role but I think the might be too late.

someAncestor.setAttribute('onfoo', 'console.log(this, event)');
someDescendant.dispatchEvent(new Event('foo', {bubbles: true});
// The mutation observer has not yet delivered its records.
josh commented 10 years ago

Related is this discussion on attribute namespacing for custom elements.

http://lists.w3.org/Archives/Public/public-webapps/2014AprJun/0324.html

domenic commented 10 years ago

We use open issues to track missing web platform features; no need to close it just because we don't have a good solution :)

annevk commented 10 years ago

What you want is to replace the spec-defined slot for an attribute with your own. The first question would be where would these slots be placed and how much of a performance hit would that be.

And the second question would be what semantics are tied in this way and what semantics are tied through styling and other mechanisms.