|
From: Doug M. <do...@cr...> - 2003-04-26 04:21:01
|
<html>=0A=
<head>=0A=
<title>Mozilla cotnentWidth Bug</title>=0A=
<script language=3D"JavaScript" src=3D"./src/dynapi.js"></script>=0A=
<script language=3D"Javascript">=0A=
dynapi.library.setPath('./src/');=0A=
dynapi.library.include('dynapi.api');=0A=
</script>=0A=
<script language=3D"Javascript">=0A=
=0A=
ParentLayer =3D new DynLayer();=0A=
ParentLayer.setBgColor('blue');=0A=
ParentLayer.setSize(100,100);=0A=
ParentLayer.setLocation(50,200);=0A=
=0A=
ChildLayer =3D new DynLayer();=0A=
ChildLayer.setBgColor('white');=0A=
ChildLayer.setSize(100,100);=0A=
ChildLayer.setLocation(10,10);=0A=
=0A=
ChildLayer.setHTML('<table border=3D1 width=3D150 height=3D150><tr><td =
align=3Dcenter valign=3Dmiddle>!</td></tr></table>');=0A=
=0A=
ParentLayer.addChild(ChildLayer)=0A=
=0A=
dynapi.document.addChild(ParentLayer);=0A=
=0A=
function doIt(){=0A=
alert('Child Layer\'s ContentWidth =3D ' + ChildLayer.getContentWidth() =
+ '\nChild Layer\'s ContentHeight =3D ' + ChildLayer.getContentHeight())=0A=
}=0A=
=0A=
ParentLayerB =3D new DynLayer();=0A=
ParentLayerB.setBgColor('blue');=0A=
ParentLayerB.setSize(150,150);=0A=
ParentLayerB.setLocation(250,200);=0A=
=0A=
ChildLayerB =3D new DynLayer();=0A=
ChildLayerB.setBgColor('white');=0A=
ChildLayerB.setSize(100,100);=0A=
ChildLayerB.setLocation(10,10);=0A=
=0A=
ChildLayerB.setHTML('<table border=3D1 width=3D150 height=3D150><tr><td =
align=3Dcenter valign=3Dmiddle>!</td></tr></table>');=0A=
=0A=
ParentLayerB.addChild(ChildLayerB)=0A=
=0A=
dynapi.document.addChild(ParentLayerB);=0A=
=0A=
function doItB(){=0A=
alert('Child Layer B\'s ContentWidth =3D ' + =
ChildLayerB.getContentWidth() + '\nChild LayerB\'s ContentHeight =3D ' + =
ChildLayerB.getContentHeight())=0A=
}=0A=
=0A=
</script>=0A=
</head>=0A=
<body bgcolor=3D"#999999">=0A=
This document demonstartes the mozilla content size bug.<br>=0A=
<a href=3D# onclick=3D"doIt()">click here</a> to get the content size of =
the child layer.<br>=0A=
the expected results are contentWidth =3D 150 and contentHeight =3D =
150<br>=0A=
Note that the bug only occurs with the width<br>=0A=
In case you did not notice. getContenWidth in Mozilla will actually =
return the distance from a child layer's<br>=0A=
left to the parent layer's right where the childlayer's right extends =
beyond the parent layer's right.<br><br>=0A=
If the child layer's area does not extend beyond the parent layer's area =
then the value returned is that of the real content width minus the left =
position of the child layer.=0A=
<a href=3D# onclick=3D"doItB()">click here</a> to get the content size =
of the second child layer.<br>=0A=
=0A=
<script>=0A=
dynapi.document.insertAllChildren();=0A=
</script>=0A=
=0A=
</body>=0A=
</html>=0A=
|