Closed
Bug 293387
Opened 20 years ago
Closed 20 years ago
Wrong replaceChild() behavior on inline element with block inside
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: lorus, Unassigned)
Details
Attachments
(1 file)
|
812 bytes,
text/html
|
Details |
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.7) Gecko/20050420 Firefox/1.0.3
Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.7) Gecko/20050420 Firefox/1.0.3
When replaceChild() is used to replace an inline element (such as <span>) which
contains block element (such as <div>) inside, browser just duplicates contents
of <span> and displays it twice.
At the same time DOM Inspector doesn't show any duplicated nodes.
Reproducible: Always
Steps to Reproduce:
Here is a testcase.
<html>
<head>
<script language="JavaScript" type="text/javascript">
function reproduceBug(name) {
var victim = document.getElementById(name);
var replacement = victim.cloneNode(true);
var parent = victim.parentNode;
parent.replaceChild(replacement, victim);
}
</script>
</head>
<body>
<a href="javascript:void(0);" onclick="reproduceBug('victim');">reproduce bug
(block inside <span>')</a>
<div>
<span id="victim">
<div>
text
</div>
</span>
</div>
<hr/>
<a href="javascript:void(0);" onclick="reproduceBug('solid');">not reproduceable
(block inside block)</a>
<div>
<div id="solid">
<div>
text
</div>
</div>
</div>
</body>
</html>
Actual Results:
Clicking on the first link multiplies the 'text' word. Clicking on the second
link works as expected (nothing happens visually).
Expected Results:
Inline element should be completely replaced with new node by replaceChild(),
not duplicated.
Comment 1•20 years ago
|
||
reporter's testcase
Comment 2•20 years ago
|
||
I see the problem with Firefox 1.0 and 1.0.3 (and suite build 1.7.7), but this worksforme with trunk builds since 1.8a1 resolving WORKSFORME -- gecko 1.7 branch is only getting security fixes reopen if you reproduce the bug with a trunk build.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•