Closed Bug 414029 Opened 17 years ago Closed 17 years ago

javascript - changing content by innerHTML causes embedded swf to refresh/restart

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
minor

Tracking

()

RESOLVED DUPLICATE of bug 90268

People

(Reporter: mattura, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11

Where an embedded swf exists within div tags, and javascript is called which uses innerHTML to change the contents of a span to include div or table tags, the embedded swf reloads.
This does not occur if div/table tags are not present in the replacement.

Reproducible: Always

Steps to Reproduce:
1. You will need a swf, in which it is easy to tell if it has been restarted
2. The following HTML reproduces the problem (see http://www.matt.elementfx.com/bug.html):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-GB" xml:lang="en-GB">
 <head>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  <title>Bug</title>
  <script>

  function foo() {
     document.getElementById('thing').innerHTML="<div>Div replacement</div>";
  }
  
  function bar() {
     document.getElementById('thing').innerHTML="<span>Span replacement</span>";
  }

  </script>
 </head>
<body>

<span id="thing">Some text</span><br/><br/>

<a href="#" onclick="javascript:foo();">Click to replace above with innerHTML containing DIV tags</a>

<br/><br/>

<a href="#" onclick="javascript:bar();">Click to replace above text with innerHTML containing SPAN tags</a>

<br/><br/>
A flash presentation: click start before clicking the above to verify:<br/>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="550" height="400" id="loader" salign="tl">
<param name="salign" value="tl"><param name=movie value="sinksub.swf"><param name=quality value=high><param name=bgcolor value=#000000>
<embed src="sinksub.swf" quality=high bgcolor=#000000  width="550" height="400" name="loader" salign="tl" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
</embed>
</object>

</body>
</html>
Actual Results:  
Replacing the text with something containing DIV tags refreshes the swf.

Expected Results:  
The swf should not refresh/reload/restart.

Internet Explorer and Safari do not cause the swf to refresh with any tags I tried
The reload only occurs after a page load, replacing the text a second time does not cause the swf to refresh.
I found a workaround:
enclose the item to be replaced with DIV tags

Severity: normal → minor
This is probably a result of bug 90268, but I'm not sure it's an exact dup.  Is it expected that introducing an {ib} (block-inside-inline) situation at the top of the document would reframe the plugin at the bottom?
Yes, I believe fixing 90268 would fix this.
I shall follow this with interest...
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.