Re: [webcomponents]: What callbacks do custom elements need?

*"Daniel can confirm but in all of the stuff i have seen and played with so
far it is...you want a changing a component attribute to have some effect.
Internally you would use mutation observers i think."*

-----

We have built quite a few custom elements now, and here's the
role/behaviors of attributes in doing so:


   - Attributes act as initial/dynamic settings parameters for the state or
   mode of a custom element, with the advantage they can be targeted with CSS
   (just like native elements)
   - Some attributes require linkage to mirrored getters and setters that
   trigger common actions when set either way - src, type, href, etc
   - Attributes linked to getters and setters must not set off attribute
   changed events when being set by code internal to the custom element
   definition. For instance, if you have someone change a property like src
   via setter, you don't want it to sync that value to the scr="" attribute
   and cause the linked action to occur twice - get the idea?

It does seem as though it will be quite difficult to come up with a
non-sync API for this that behaves in a sane manner devs can rely on. I'm
all ears for solutions though! :)

- Daniel

Received on Tuesday, 12 March 2013 06:34:53 UTC