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]: Add the possibility to extend the custom element (bugzilla: 26583) #201

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

Comments

@hayatoito
Copy link
Contributor

Title: [Custom]: Add the possibility to extend the custom element (bugzilla: 26583)

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


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26583#c0
** wrote on 2014-08-14 08:41:54 +0000.

Example:

var Modal = document.registerElement('x-modal', {
prototype: Object.create(HTMLElement, {/* modal generic prototype /})
})
var WebcamModal = document.registerElement('x-webcam', {
extends: 'x-modal',
prototype: Object.create(Modal, {
/
webcam modal specific prototype */
show: {
value: function() {
Modal.prototype.show.call(this)
// run webcam
}
}
})
})


And will be cool if will be possible to have a non-dashed name of extend name (is="webcam" instead is="x-webcam").


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26583#c1
Tab Atkins Jr. wrote on 2014-08-14 14:57:20 +0000.

There is no "non-dashed version" of a name, because there's no common structure to the name that we can safely ignore. The sole requirements it that a dash appears somewhere in the name, so it can occur between or around significant or insignificant parts, and there's no way to tell automatically what parts are insignificant.

@annevk
Copy link
Collaborator

annevk commented Mar 11, 2016

Is the only problem here that is="" is also required to contain a hyphen?

@annevk
Copy link
Collaborator

annevk commented Mar 24, 2016

Closing this. @domenic, please reopen if you disagree.

@annevk annevk closed this as completed Mar 24, 2016
@domenic
Copy link
Collaborator

domenic commented Mar 24, 2016

In general I do think it's a bit weird that type extensions rely on a lot of the same constraints and infrastructure as custom tags, when there's no real reason to do so. E.g. maybe in my ideal world you'd have customElements.define("custom-tag", CustomTag) and customElements.defineExtension("button", "plastic", PlasticButton), instead of lumping them both together with customElements.define("custom-name", CustomTag, { extends: "button" }). But I'm not sure it's worth the churn. Especially since there's a weak argument that the hyphen encourages namespacing, anyway.

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