The variable width font of text produced by JavaScript is enlarged with Fire Fox 3 and looks unsightly.

RESOLVED INCOMPLETE

Status

()

RESOLVED INCOMPLETE
11 years ago
8 years ago

People

(Reporter: wayzan, Unassigned)

Tracking

3.0 Branch
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [CLOSEME 2010-11-15])

(Reporter)

Description

11 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1

Please copy and paste the following code and view it in FF3. Under FF2 it looks normal, as with IE 7 and SeaMonkey, but the font is far too big in FF3. I use this code quite extensively. Web Plus X2 also produces the same font size whenever it cannot display a file in an iframe. 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
  <title>Factoriser</title>

  <script type="text/javascript">
/*This script and many more are available free online at
The JavaScript Source! http://javascript.internet.com
Created by: Abraham Joffe : http://www.abrahamjoffe.com.au/.*/
// Begin
function trail(t){
var n=t.value
while (true) if (n.substring(0,1)=="0") n=n.substring(1, n.length); else break;
if (n=="") n=0;
t.value=n;
}
var f;
var d;
var number;
var num;
var a;

function complete(){
  if (f.length==0) return number+" is a prime number.";
  var text="Not prime. "+number+" = ";
  var x=new Array();
  x[0]=f[0]
  var y=new Array();
  y[0]=1;
  for (var i=1; i<f.length; i++) {
    if (f[i]==x[x.length-1]) y[y.length-1]++;
    else {
      x[x.length]=f[i];
      y[y.length]=1;
    }
  }
    if (num==x[x.length-1]) y[y.length-1]++;
    else {
      x[x.length]=num;
      y[y.length]=1;
      }

    if (y[0]==1) text+=x[0];
    else text+=x[0]+"<sup>"+y[0]+"</sup>";

  for (var i=1; i<x.length; i++){
    if (y[i]==1) text+=" x "+x[i];
    else text+=" x "+x[i]+"<sup>"+y[i]+"</sup>";
  }
  return text;
}

function work(){
if (num%d==0) {
  num=num/d;
  f[f.length]=d;
  document.getElementById("output").innerHTML=complete();
  }
else {if (d==2) d++; else d+=2;}
if (d*d>num) {
  document.getElementById("output").innerHTML=complete();
  document.getElementById("v0").innerHTML="100";
  document.getElementById("bar2").style.width=100;
	a=setTimeout("document.getElementById('bar0').style.display='none';document.getElementById('bar3').style.display='inline';", 1000);
	}
else if (((d-1)/2)%501==0) {
  a=setTimeout("work()", 1);
  document.getElementById("v0").innerHTML=Math.round((d*100)/Math.sqrt(num));
  document.getElementById("v1").innerHTML=Math.round((d*100)/Math.sqrt(num));
  document.getElementById("bar2").style.width=(d*100)/Math.sqrt(num)
  document.getElementById("bar0").style.display="block";
  document.getElementById("bar3").style.display="none";
  }
else work();
}

function factorise(n){
  clearTimeout(a);
  f=new Array();
  d=2;
  num=n;
  number=n;
  if (n==1) document.getElementById("output").innerHTML="1 is not a prime number even though it has no factors."
  else if (n==2) document.getElementById("output").innerHTML="2 is the only even prime number.";
  else if (n>2 && parseInt(n)==n) {
    document.getElementById("output").innerHTML="No factors of "+number+" found yet...";
    work();
  }
  else document.getElementById("output").innerHTML="Invalid entry.";
}
// End -->
  </script></head><body>
<center><table style="width: 450px;" border="0" cellpadding="5" cellspacing="0" cols="2">
<tbody><tr>
<td style="width: 100%; background-color: rgb(255, 236, 245); height: 100%;"><form onsubmit="factorise(number.value);return false;"><fieldset><legend><b><font face="Verdana"><font color="#993366"><font size="-1">Prime
Number Tester / Factorizing Machine</font></font></font></b></legend>
<div style="float: left;"><font face="Verdana"><b><font size="-2">Insert Number Here:-</font></b><font color="#ffecec"><font size="-1">-<input value="" name="number" onkeypress="var a=window.event.keyCode;if (a<48 || a>57) return false;" onblur="trail(this)" maxlength="15" style="width: 120px;" type="text"></font></font></font><font color="#ffecec">--<input value="next" onclick="javascript:this.form.number.value++;" type="button"><input value="back" onclick="javascript:this.form.number.value--;" type="button">-----<input name="clear" value="Reset" onclick="javascript:this.form.number.focus();" type="reset">---</font><input value="Factorize" type="submit"></div>

<p><br></p><div id="bar3"><b><font face="Verdana"><font size="-1">Discovering
The Secrets Of Life</font></font></b></div>
<div id="bar0">
<div id="bar2">
<div style="width: 120px;">Thinking... [<span id="v0">0</span>%]</div>
</div>

<div id="bar1">Thinking... [<span id="v1">0</span>%]</div>
</div>

<div style="clear: left;"><span id="output"><font face="Verdana"><font color="#cc0000"><font size="-1">Enter
a natural number above to be factorized.</font></font></font></span>
<br><font face="Verdana"><font size="-2"><i><font color="#cc0000">Note:</font></i>
Expressions like 5<sup>2</sup> change to 52 when pasted into text area.</font></font></div>
</fieldset></form></td>
</tr>
</tbody></table></center>
</body></html>

Reproducible: Always

Steps to Reproduce:
1. Cut and paste above script
2. load .html file into FF3
3. observe the text and play with the Factoriser to see the results.
Actual Results:  
The font for the end result is large and unsightly.

Expected Results:  
The font should be normal size. If this helps I modified the code to make it work as it should.

<tr>
<td><fieldset>
<div style="float: left;"><input name="number" value="" onkeypress="var a=window.event.keyCode;if (a<48 || a>57) return false;" onblur="trail(this)" maxlength="8" style="border: 0pt none ; width: 60px; color: darkblue; background-color: rgb(255, 213, 213);" type="text"><input value="Sel" onclick="javascript:this.form.number.focus();this.form.number.select();" type="button"><font style="color: rgb(255, 204, 204);" color="#ffd5d5">-</font><font face="Verdana"><font size="-2">Original
Java Script by Ben Joffe.</font></font></div>
<br><div id="bar3"><font face="Verdana"><font color="#006600"><font size="-1">Quantifying
the causal energies of life.</font></font></font></div>

<div id="bar0">
<div id="bar2">
<div style="width: 120px;">Thinking... [<span id="v0">0</span>%]</div>
</div>

<div id="bar1">Thinking... [<span id="v1">0</span>%]</div>
</div>

<br><div style="clear: left;"><font face="Verdana"><font color="#cc0000"><font size="-1"><span id="output">The
Power Number is factorised here.</span></font></font></font></div>
<div style="text-align: justify;"><font face="Verdana"><font size="-2"><i><font color="#cc0000">Note:</font></i>
Expressions like 5<sup>2</sup>
change to 52 when copied and pasted into some word processors and
spreadsheets. As an alternative convert to 5^2 (Shift-6 for ^).</font></font>
</div>
</fieldset></td>
</tr>
Version: unspecified → 3.0 Branch
Reporter, are you still seeing this issue with Firefox 3.6.10 or later in safe mode? If not, please close. These links can help you in your testing.
http://support.mozilla.com/kb/Safe+Mode
http://support.mozilla.com/kb/Managing+profiles
Whiteboard: [CLOSEME 2010-11-15]
No reply, INCOMPLETE. Please retest with Firefox 3.6.12 or later and a new profile (http://support.mozilla.com/kb/Managing+profiles). If you continue to see this issue with the newest firefox and a new profile, then please comment on this bug.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.