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

Consider allowing <polymer-element> to accept a prototype chain #211

Closed
sorvell opened this issue Jul 16, 2013 · 5 comments
Closed

Consider allowing <polymer-element> to accept a prototype chain #211

sorvell opened this issue Jul 16, 2013 · 5 comments

Comments

@sorvell
Copy link
Contributor

sorvell commented Jul 16, 2013

A user tried this construction inside a

Polymer('x-foo', (function () {
  var knob = function() {
    this.foo = 'foo';
  }
  knob.prototype.zonk = 'zonk'
  return new knob();
})());

The user was confused that the resulting element had a 'foo' property but not a 'zonk' property.

@sorvell
Copy link
Contributor Author

sorvell commented Sep 3, 2013

The complexity seems unwarranted at this point. Instead, we should issue a warning if the object passed itself has a non-trivial prototype.

@ghost ghost assigned sorvell Sep 25, 2013
@sorvell sorvell removed this from the beta milestone Aug 14, 2014
@sorvell
Copy link
Contributor Author

sorvell commented Aug 14, 2014

Dup of #647.

@sorvell sorvell closed this as completed Aug 14, 2014
@sjmiles
Copy link
Contributor

sjmiles commented Aug 18, 2014

#647 is a dupe of this issue (#211), not vice-versa.

@florianv
Copy link
Contributor

I was experimenting with Platform.mixin and I found a workaround trick to have the prototype chain taken into account when registering a new element.

function Entity() {
    this.message = 'Hello!';
}
Entity.prototype.created = function () {
    console.log(this.message);
};

function Person() {}
Person.prototype = new Entity();

// The resulting object will be an instance of the first argument
// The prototype chain of the second argument will be taken into account
Polymer('some-element', Platform.mixin(new Person(), new Person()));

@tjsavage tjsavage added the 0.5 label May 21, 2015
@tjsavage
Copy link
Contributor

Closing this issue due to age and the release of version 1 release of Polymer - please feel free to re-open if this is incorrect.

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

4 participants