1

Our site uses Websocket, so it already requires late-model browsers. Given that, how can I be notified when an element resizes? We may have canvas and svg child elements that need to resize in response to the parent DOM element resizing.

Elegant method would be to hook 'onresize' but, alas, it does not get called on elements (at least not in Chrome 18). Would prefer to not be offered an answer to periodically fire a timer to test for a change in element size.

Also, please understand that the reflow may not be caused by the window or body being resized, so please don't go there.

Any brilliant, simple, elegant ideas would be hugely appreciated.

Steger
  • 887
  • 7
  • 16
  • What causes your element to change its size? – Šime Vidas Feb 04 '12 at 20:13
  • The user's interaction with elements on the website triggers reflows. For example, expanding the branch of a tree view (nested list elements) can widen already open list elements. – Steger Feb 04 '12 at 20:37
  • One possibility would be to invoke the resize handler manually whenever a branch is expanded/collapsed... – Šime Vidas Feb 04 '12 at 20:42
  • 1
    That may be the direction that I will take. I was looking for a more general solution, but it appears that there is not one in the current html5/w3.org specification. – Steger Feb 04 '12 at 20:54

0 Answers0