N
Nik Coughlin
I really am going mad here. Firefox is going really slowly on something that
should be trivial and is in fact very fast in all of my other browsers.
The strange thing is that for most people, it's not happening. It happens on
my machine here, and I've tried using Firefox with a clean profile, Firefox
Portable etc. with the same result. It does however happen for some people,
which is a concern.
Consider the following:
var targetForManyElements = document.getElementById(
"locationWhereIShallPlaceManyThings" );
function insertManyElements() {
for( i = 0; i < 2000; i++ ) {
var newElement = document.createElement( "span" );
var newElementText = document.createTextNode( "x " );
newElement.appendChild( newElementText );
targetForManyElements.appendChild( newElement );
}
}
If the next line is this then it's a handful of milliseconds:
insertManyElements();
If however the next line is this, upon triggering the event it takes several
seconds before the browser is responsive again:
document.onkeypress = insertManyElements;
Demos:
http://nrkn.com/temp/ffwtf/keypress.html
http://nrkn.com/temp/ffwtf/nokeypress.html
Any ideas?
should be trivial and is in fact very fast in all of my other browsers.
The strange thing is that for most people, it's not happening. It happens on
my machine here, and I've tried using Firefox with a clean profile, Firefox
Portable etc. with the same result. It does however happen for some people,
which is a concern.
Consider the following:
var targetForManyElements = document.getElementById(
"locationWhereIShallPlaceManyThings" );
function insertManyElements() {
for( i = 0; i < 2000; i++ ) {
var newElement = document.createElement( "span" );
var newElementText = document.createTextNode( "x " );
newElement.appendChild( newElementText );
targetForManyElements.appendChild( newElement );
}
}
If the next line is this then it's a handful of milliseconds:
insertManyElements();
If however the next line is this, upon triggering the event it takes several
seconds before the browser is responsive again:
document.onkeypress = insertManyElements;
Demos:
http://nrkn.com/temp/ffwtf/keypress.html
http://nrkn.com/temp/ffwtf/nokeypress.html
Any ideas?