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

We don't want createdCallback etc. on our prototypes #35

Closed domenic closed 9 years ago

domenic commented 9 years ago

I might not be understanding the custom element spec entirely, but it seems like I am supposed to define createdCallback et al. on my prototype. This will then be user-observable: CustomHRElement.prototype.createdCallback will be present, whereas of course HTMLHRElement.prototype.createdCallback does not exist.

I think it might be possible to work around this by deleteing the createdCallback property after registration, since registering seems to transfer the callbacks to a safe place. This is kind of lame though.

It would be better if I could have passed those callbacks in as part of the options object...

domenic commented 9 years ago

Also, that workaround will not work once the ES6 changes land.

arv commented 9 years ago

Why wouldn't the delete work around work in with ES6?

domenic commented 9 years ago

I ... don't really remember what I was thinking when I wrote that. It does seem that the flow will still look for C.prototype.createdCallback and transfer it to a safe place. Even eliminating @@create doesn't seem to make a difference. So that is probably OK...

domenic commented 9 years ago

Deleting works: https://github.com/domenic/html-as-custom-elements/blob/b61b993ff6e1f87a9032c19e48a8547a198fdf4e/src/register-element.js