[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 #19 from Scott Miles <sjmiles@chromium.org> 2012-08-29 21:34:34 UTC ---
(In reply to comment #18)
> (In reply to comment #17)
> > I meant to echo my original example where the user has done this:
> > 
> > x = document.querySelector("x-awesome");
> > x.addEventListener("onclick", awesomeClick);
> 
> 
> Well, in that case the default listener would be fine.
> And btw, it is click, not onclick ;)
> 
> There is the upgrade event, which dev could use to add necessary listeners.
> In fact, I'd say listener shouldn't added to the element before it is the
> right kind of element (document.register is called).

I understand, but again I'm concerned about average developer.

He starts with

<x-awesome onclick="awesomeClick()"></x-awesome>

Then somebody tells him it's a security issue, so he changes it to do

x = document.querySelector("x-awesome");
x.addEventListener("click", awesomeClick);

Then his page doesn't work, and now he has to go look up about custom elements
and do things differently because 'custom elements are weird'.

In general, I want consumers of custom-elements to need to require as little
arcana as possible.

-- 
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 21:34:35 UTC