Martin Paul Eve bio photo

Martin Paul Eve

Professor of Literature, Technology and Publishing at Birkbeck, University of London

Email Books Twitter Google+ Github Stackoverflow MLA CORE Institutional Repo Hypothes.is ORCID ID   ORCID iD

Email Updates

One of the biggest problems faced when writing Javascript that modifies the DOM is the fact that the poorly written IE7 crashes because it hasn't finished loading the current element. This only seems to happen when the DOM is modified through a script loaded by an xx:expression binding in a style tag.

The only solution that I managed to find was to set an asynchronous timeout:

setTimeout('function()',500);

and then check if the DOM is loaded inside the function:

var ne = document.body.innerHTML;

if (ne.indexOf('LAST TEXT BEFORE BODY CLOSE TAG') == -1) {
	setTimeout('function()',500);
	return;
}

Obviously a far from ideal solution!