This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Split off of bug 18732.
I would be against copying event listeners for a few reasons, here's why: - there are a number of things set by user JS after the page is parsed that cloning a node does not copy, to only do a subset would be confusing. - by copying event listeners, which will likely contain calls to the custom element's unique prototype methods, we create a situation where events may be able to be invoked by the interface end-user *before the element it upgraded*. This means that the refs to anything custom about the element would fail. It is better to say to the developer "assign all user-defined JS events not part of the component's operation itself, inside of the upgrade event (as opposed to DOMContentLoaded,Load, etc)" - I cannot be sure of this, but I would bet performance would be impacted negatively if we allowed this (though I am unsure to what extent) Bottom Line: push developers to do all such operations within the upgrade event loop, it is a more cohesive and expected position than hopscotching on what we will copy and what we won't (child elements and originally-specified HTML source attributes withstanding, for obvious reasons)
I'm also against automatic copying. onfoo="" handlers will be copied anyway, and other listeners may easily keep the old element alive if not being careful with js scopes etc.
We took a different approach. There's no more cloning/replacing, just switching out the prototype.