[webcomponents] attributeChangedCallback may be expensive for some attributes (#350)

Implementer feedback: In Blink, the "style" attribute is serialized lazily so that a code block like:

     elem.style.color = 'red';
     elem.style.textDecoration = 'underline';
     elem.style.fontWeight = 'bold';

only generates one serialization of the properties. This is because realizing the string could be expensive. With Custom Elements, you would reasonably expect this to generate three attributeChangedCallback invocations with three serializations of the string.

There are a lot of design alternatives that would avoid this, with various trade-offs. For example, the UA could be permitted to dispatch those callbacks later and coalesce them; the API could let authors specify specific attributes to watch; the attributeChangedCallback could be supplied with only the attribute name and make the author responsible to poll the attribute; etc. (Some of these options have been discussed in the past in other contexts.)

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/350

Received on Tuesday, 17 November 2015 04:11:06 UTC