From a8929c4dd14d0554b43dcdb2846e25c01209b8fb Mon Sep 17 00:00:00 2001 From: Marian Kostadinov Date: Mon, 11 Mar 2013 18:59:42 +0200 Subject: [PATCH] handle parent resizes --- boxsizing.htc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/boxsizing.htc b/boxsizing.htc index a3d8aad..dc2ee9c 100644 --- a/boxsizing.htc +++ b/boxsizing.htc @@ -79,7 +79,7 @@ switch(element.nodeName){ /* * update gets called during resize events, then waits until there are no further resize events, and finally triggers a recalculation */ -function update(){ +function update(){ if(resizetimeout !== null){ window.clearTimeout(resizetimeout); } @@ -96,9 +96,10 @@ function update(){ */ function restore(){ if(apply){ - try{ + try{ element.runtimeStyle.removeAttribute("width"); element.runtimeStyle.removeAttribute("height"); + element.parentNode.detachEvent ('onresize', update); } catch(e){} } @@ -112,6 +113,7 @@ function init(){ if(apply){ updateBorderBoxWidth(); updateBorderBoxHeight(); + element.parentNode.attachEvent ('onresize', update); } }