Hi,
let me introduce my Custom Element scenario: an interactive map element,
powered by one of the well-known JS APIs (such as Google Maps API or so).
Typically, the markup will be like
<my-map lat="..." lon="..." zoom="..." controls>
However, the underlying JS needs to know when this element's rendered
size changes; the viewport needs to be filled with new map tiles and
other geo data.
Typically, when using a plain JS API (and not a custom declarative
markup), users are used to call a size synchronization routine, shall
the map viewport change. This is no longer the case when a Custom
Element is introduced (and scripting is replaced by declarative HTML).
A user may insert a map element anywhere in the page (see
http://api4.mapy.cz/ for reference), including a variable-width box in a
sidebar or so. This means that the <my-map> element itself cannot
determine when its own (rendered) size changes, as the attributeChanged
callback only applies to own attributes.
Is there some recommended way of dealing with this?
Sincerely,
Ondrej Zara
--
*RNDr. Ondřej Žára*
Programátor UI senior
https://twitter.com/0ndras
[email protected] <mailto:[email protected]>
http://www.seznam.cz/
Seznam.cz, a.s., Radlická 3294/10, 150 00 Praha 5 <http://mapy.cz/s/6rw4>