Closed Bug 396342 Opened 17 years ago Closed 14 years ago

Switching Node missing after the event

Categories

(Firefox :: General, defect)

2.0 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: willko, Unassigned)

Details

(Whiteboard: [CLOSEME 2010-07-30])

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6

My english is poor. So sorry.
Please look at this code.

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>un</title>
</head>

<body>
<div id="box"></div>
<script>
d1 = document.createElement("div");
d1.innerHTML = "Hello";
addEvent(d1, "click", function(){alert('Hello');});
d1.id = "d1";
d2 = document.createElement("div");
d2.innerHTML = "world";
d2.id = "d2";
addEvent(d2, "click", function(){alert('world');});


$("box").appendChild(d1);
$("box").appendChild(d2);


function $(id) {
return document.getElementById(id);
}
function swapEle(ele1, ele2) {
var p = ele1.parentNode;
var c1 = ele1.cloneNode(true);
var c2 = ele2.cloneNode(true);
insertEle(ele2, c1, p);
insertEle(ele1, c2, p);
p.removeChild(ele1);
p.removeChild(ele2);
}
function insertEle(currEle, newEle, parent) {
if (typeof currEle.insertAdjacentElement == "function") {
currEle.insertAdjacentElement("beforeBegin", newEle);
} else {
parent.insertBefore(newEle, currEle);
}
}

function addEvent(obj, event, func, stop) {
if (obj.addEventListener) {
obj.addEventListener(event, func, stop || false);
} else if (obj.attachEvent){
obj.attachEvent("on" + event, func);
}
}


</script>
<a onclick = "swapEle($('d1'),$('d2'));">exchange</a>
</body>
</html>

	
IE under normal operation, under invalid FF.
Click "exchange", "hello" and "world" events Failure.Help me please.
Thank you very much.

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
This bug was reported on Firefox 2.x or older, which is no longer supported and will not be receiving any more updates. I strongly suggest that you update to Firefox 3.6.3 or later, update your plugins (flash, adobe, etc.), and retest in a new profile. If you still see the issue with the updated Firefox, please post here. Otherwise, please close as RESOLVED > WORKSFORME
http://www.mozilla.com
http://support.mozilla.com/kb/Managing+profiles
http://support.mozilla.com/kb/Safe+mode
Whiteboard: [CLOSEME 2010-07-30]
Version: unspecified → 2.0 Branch
No reply, INCOMPLETE. Please retest with Firefox 3.6.8 or later and a new profile (http://support.mozilla.com/kb/Managing+profiles). If you continue to see this issue with the newest firefox and a new profile, then please comment on this bug.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.