[Bug 18732] [Custom]: element upgrade algorithm does not preserve attributes, event listeners, references

https://www.w3.org/Bugs/Public/show_bug.cgi?id=18732

--- Comment #7 from Scott Miles <sjmiles@chromium.org> 2012-08-29 19:52:19 UTC ---
(In reply to comment #6)
> (In reply to comment #5)
> > Why don't we want to transplant event listeners? It seems like there is some
> > concern about the upgrade event, but as Scott mentioned, I don't see why we
> > can't just fire it on the new element.
> 
> We could, but they may not do what the user intended. For example:
> 
> this.addEventListener('click', method.bind(this));
> 
> when transplanted, will still be acting on the old element. Is this a Real
> Concern (tm)?

If user didn't bind it, the method would be called on 'this' anyway, so
presumably the user is doing this specifically to force the callback to fire on
the current 'this' in the face of event-listener transplantation. I figure he
gets what he wants in this case.

I suppose if a user does that binding without thinking about it, it could be a
foot-gun.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Wednesday, 29 August 2012 19:52:22 UTC