Adding a paint event to HTMLElement to support Web Components / Shadow DOM

Imagine you want to make a Web Component that draws a graph
Imagine that you'd like the graph to show more data if it's larger and less
if it's smaller. In other words, you don't want it to scale the data.
Imagine you set that component's size to width: 100%; height: 100% to scale
to its container

Question: How does the Web Component know when to repaint its content?

AFAICT the resize event only fires on window. If the point of Web
Components is to allow people to make self contained components it seems
like there might be the need for some way of letting the component know it
needs to repaint.

Resize is just one example.

Imagine a relatively heavy to repaint WebComponent like one that draws an
representation of an audio wave. If that component is hidden behind some
other component it would be nice if it didn't re-draw itself. When it
becomes visible thought needs  to know it should redraw itself.

Does a 'paint' event make sense?

Received on Wednesday, 9 May 2012 00:31:20 UTC