W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2013

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

From: Daniel Buchner <danieljb2@gmail.com>
Date: Mon, 11 Mar 2013 23:33:56 -0700
Message-ID: <CAHZ6zJFSmgEkgyrjTJoGb96N5JsAgWY4Gxks_DWYwNAqKDoRqA@mail.gmail.com>
To: public-webapps@w3.org
*"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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:58 GMT