Closed Bug 655382 Opened 13 years ago Closed 13 years ago

Inner javascript into dynamically DOM inserted html parts does not always execute

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows XP
defect
Not set
critical

Tracking

()

RESOLVED DUPLICATE of bug 645115

People

(Reporter: blatte, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)
Build Identifier: 

Inner javascript into dynamically inserted html parts (for example a simple DOM insertion from ajax call containing inner javascript) is not executed all the time (the same block are always executed, and the same other are not).
I've seen already reported bug like this, but In my case, I've noticed that some inner javascript block are executed but other not (always the same, even simple)!
All these code works on on mozilla 2.x, mozilla 3.x but I met this random since mozilla 4.
For IE6,7,8, chrome, safari, an others, javascript execution is programmatically called without any ambiguity.

Reproducible: Sometimes

Steps to Reproduce:
1.Hard due to random situation.
2.Need to insert random HTML with inner javascript.
3.Will try to provide an example (hard) because our unworking site need to register.

Actual Results:  
Some parts <script  type="text/javascript">XXX</script> are not executed. But not all. No error on console.

Expected Results:  
All should be executed.
Assignee: general → nobody
Component: JavaScript Engine → DOM
QA Contact: general → general
A minimal testcase would be *very* useful.
Heck, _any_ testcase would be useful.

Please reopen the bug when you have something that shows the problem, even if only intermittently....
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → INCOMPLETE
OK, I've isolated a test:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Test window for Mozilla 4</title>
<script type="text/javascript">
	function openAjaxWindow() {
		var zeinnerHTML="This is the html content. It contains two &lt;script&gt; blocks (with \"alert\" in each one):<br></br>"+
	"<div style='border: 1px solid gray;'>"+
		"<code>"+
			"&lt;script&gt;<br>"+
				"&nbsp;&nbsp;&nbsp;&nbsp;alert(\"Nice! This first alert is raised (but second alert will not be displayed on Mozilla Firefox EU 4.0.1 - euballot - 1.1)\");<br>"+
			"&lt;/script&gt;<br>"+
			"&lt;script&gt;<br>"+
				"&nbsp;&nbsp;&nbsp;&nbsp;alert(\"If you see this second alert, your not using FF4. If yes, I hang myself ....\");<br>"+
			"&lt;/script&gt;<br>"+
		"</code>"+
	"</div>"+
	"The first alert is raised, but the second one is ignored.<br>"+
	"In fact, I've discovered that the last one is never executed. Our code has been patched by adding an empty &lt;script&gt; block. (sic)."+
	"<br>"+
	"With other Browser, we have to call &lt;script&gt; execution (via eval), so it works. This may have worked with previous version of FF."+
"<script>"+
	"alert(\"Nice! This first alert is raised (but second alert will not be displayed on Mozilla Firefox EU 4.0.1 - euballot - 1.1)\");"+
	"<\/script>"+
	"<script>"+
		"alert(\"If you see this second alert, your not using FF4. If yes, I hang myself ....\");"+
	"<\/script>";

		var zediv=document.createElement("DIV");
		zediv.innerHTML=zeinnerHTML;
		var zeelt=document.getElementById("zedivid");
		zeelt.appendChild(zediv);

		}
</script>
</head>
Status: RESOLVED → VERIFIED
Hum, full code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Test window for Mozilla 4</title>
<script type="text/javascript">
	function openAjaxWindow() {
		var zeinnerHTML="This is the html content. It contains two &lt;script&gt; blocks (with \"alert\" in each one):<br></br>"+
	"<div style='border: 1px solid gray;'>"+
		"<code>"+
			"&lt;script&gt;<br>"+
				"&nbsp;&nbsp;&nbsp;&nbsp;alert(\"Nice! This first alert is raised (but second alert will not be displayed on Mozilla Firefox EU 4.0.1 - euballot - 1.1)\");<br>"+
			"&lt;/script&gt;<br>"+
			"&lt;script&gt;<br>"+
				"&nbsp;&nbsp;&nbsp;&nbsp;alert(\"If you see this second alert, your not using FF4. If yes, I hang myself ....\");<br>"+
			"&lt;/script&gt;<br>"+
		"</code>"+
	"</div>"+
	"The first alert is raised, but the second one is ignored.<br>"+
	"In fact, I've discovered that the last one is never executed. Our code has been patched by adding an empty &lt;script&gt; block. (sic)."+
	"<br>"+
	"With other Browser, we have to call &lt;script&gt; execution (via eval), so it works. This may have worked with previous version of FF."+
"<script>"+
	"alert(\"Nice! This first alert is raised (but second alert will not be displayed on Mozilla Firefox EU 4.0.1 - euballot - 1.1)\");"+
	"<\/script>"+
	"<script>"+
		"alert(\"If you see this second alert, your not using FF4. If yes, I hang myself ....\");"+
	"<\/script>";

		var zediv=document.createElement("DIV");
		zediv.innerHTML=zeinnerHTML;
		var zeelt=document.getElementById("zedivid");
		zeelt.appendChild(zediv);

		}
</script>
</head>

<body style="color:black;">
	This page is a test for bug N°655382.<br></br>
	Click on the following red link to fill Html content and have the description of what's wrong. Rgds.
	<a style="cursor: pointer; color:red;" onclick="javascript:openAjaxWindow()">Click Here</a>
	<hr>
	<div>The area below will be filled with blue html content</div>
	<div id="zedivid" style="color:blue;"></div>
</body>
</html>
Attached file Bug test case. (deleted) —
Juste run the html file and check the text on the screen for bug explaination. Rgds.
Thanks. This is a know bug that has already been fixed for Firefox 5.
Status: VERIFIED → RESOLVED
Closed: 13 years ago13 years ago
Resolution: INCOMPLETE → DUPLICATE
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: