Closed
Bug 140189
Opened 22 years ago
Closed 22 years ago
cloneNode is not copying the style attribute
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
VERIFIED
DUPLICATE
of bug 137428
People
(Reporter: pieter, Assigned: jst)
Details
Attachments
(1 file)
537 bytes,
text/html
|
Details |
From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0rc1) Gecko/20020417 BuildID: 2002041711 The test case below (available as attachment further down) illustrates the problem. Expected result: There should be two 100x100 pixel boxes displayed side by side, a green one to the right of a red one. The popup message should say “copy position/width: absolute, 100px”. Actual result: The green box created by cloneNode is not displayed. The popup message shows that the cloned node does not have two style attributes, displaying “copy position/width: ,” Cause of the wrong result is illustrated by the alert popup - the node created using cloneNode does not have the style attribute values from the source node. This test works ok in Netscape 6.2, and I believe worked in Mozilla 0.9.5, build 5.0.0.9.5.2001101120. Note that it makes no difference if the cloneNode call is “deep” or not (parameter true vs. false), the problem occurs either way. Sample page to illustrate problem: <HTML> <HEAD></HEAD> <BODY> <DIV id="container"> <DIV id="copyit" style="position:absolute; background-color:red; top:20px; left:20px; width:100px; height:100px;"> </DIV> </DIV> <SCRIPT language="JavaScript"> var copy = document.getElementById("copyit").cloneNode(true); copy.style.left = "120px"; copy.style.backgroundColor = "green"; document.getElementById("container").appendChild(copy); alert("copy position/width: " + copy.style.position + ", " + copy.style.width); </SCRIPT> </BODY> </HTML>
Reporter | ||
Comment 1•22 years ago
|
||
Comment 2•22 years ago
|
||
Yeah... this was a recent regression; it's now fixed on both branch and trunk. Thanks for the bug report, Pieter! *** This bug has been marked as a duplicate of 137428 ***
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
Reporter | ||
Comment 3•22 years ago
|
||
Wow, that was quick! And great that it is fixed already. My apologies for not seeing the duplicate (I missed it in my search on cloneNode, I guess I did not search correctly.) Thank you!
Comment 4•22 years ago
|
||
No, you did search correctly. The summary didn't have cloneNode in it until a couple minutes before Boris duped the bug. I asked him to add cloneNode to the summary of the original and then dupe this one (which I could not find either). Verifying duplicate.
Status: RESOLVED → VERIFIED
Comment 5•22 years ago
|
||
Yep. What Christopher said. I was an idiot and didn't add cloneNode to the other bug's summary at the right time (like when I figured out it was caused by cloneNode.... :) )
Component: DOM: Core → DOM: Core & HTML
QA Contact: stummala → general
You need to log in
before you can comment on or make changes to this bug.
Description
•