Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Custom]: inflexible extends as fixed element type (bugzilla: 28158) #143

Closed
hayatoito opened this issue Jul 6, 2015 · 2 comments
Closed

Comments

@hayatoito
Copy link
Contributor

Title: [Custom]: inflexible extends as fixed element type (bugzilla: 28158)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28158


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28158#c0
Dimitri Glazkov wrote on 2015-03-07 00:10:02 +0000.

From: #33

rjharmon commented on Jan 25

I'd like to be able to specify any type (or perhaps certain types) of tags, with is= to augment functionality of any element. The initialization sequence I'm imagining is passed the native element instance, and then the component would be able to add its own capabilities to that instance's prototype chain (could also choose to prepare the prototype chain so that element.prototype is already distinguished from that element's native prototype, as a helpful refinement to developers).

A similar technique could be used to add multiple mixins to a tag, assuming they'd been designed them to be complementary/concerned with orthogonal aspects of the markup/content. I think of that as with= rather than is=.

@annevk
Copy link
Collaborator

annevk commented Mar 11, 2016

It's not entirely clear to me what this means.

@domenic
Copy link
Collaborator

domenic commented Mar 11, 2016

I think this is solved by using a factory that returns custom element classes/registering them. You could easily write the function

function makeSuperElement(BaseClass, baseTagName) {
  class SuperElement extends BaseClass { ... };
  document.registerElement(SuperElement, { extends: baseTagName });
  return SuperElement;
});

and then call it many times.

@domenic domenic closed this as completed Mar 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants