I'm sorry for the need to keep asking questions in this forum. Is there any
better way to find answers about Mozilla?
The problem I'm having is that I need to get the size of the text inside an
element. The thing is that offsetWidth/Height does not include the part that
is placed outside the size... pretty hard to explain. See the code below
and/or try out the attached file.
erik arvidsson
the overflow should be hidden but it is easier to see the problem with
overflow: visible;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<style type="text/css">
#t {
position: absolute;
XXXoverflow: hidden;
background: blue;
width: 100px;
height: 100px;
}
#t2 {
position: absolute;
background: yellow;
height: 50px;
left: 50px;
top: 25px;
white-space: nowrap;
}
</style>
<script type="text/javascript">
function inspect(obj) {
var str = "";
for (var prop in obj)
str += "obj." + prop + " = " + obj[prop] + "\n"
alert(str);
}
function testIt() {
var t2 = document.getElementById("t2");
inspect(t2);
}
</script>
</head>
<body>
<div id="t">
<div id="t2">
No wrap. No wrap. No wrap. No wrap.
</div>
</div>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<button onclick="testIt()">Test it</button>
</body>
</html>
begin 666 tmp.html
M/"%$3T-465!%($A434P@4%5"3$E#("(M+R]7,T,O+T141"!(5$U,(#0N,#$@
M5')A;G-I=&EO;F%L+R]%3B(-"@DB:'1T<#HO+W=W=RYW,RYO<F<O5%(O:'1M
M;#0O;&]O<V4N9'1D(CX-"@T*/&AT;6P^#0H\:&5A9#X-"@T*/'1I=&QE/CPO
M=&ET;&4^#0H\<W1Y;&4@='EP93TB=&5X="]C<W,B/@T*#0HC="![#0H)<&]S
M:71I;VXZ"6%B<V]L=71E.PT*"5A86&]V97)F;&]W.@EH:61D96X[#0H)8F%C
M:V=R;W5N9#H)8FQU93L-"@EW:61T:#H)"3$P,'!X.PT*"6AE:6=H=#H)"3$P
M,'!X.PT*?0T*#0HC=#(@>PT*"7!O<VET:6]N.@EA8G-O;'5T93L-"@EB86-K
M9W)O=6YD.@EY96QL;W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