This is not my exact code, but the relevant parts:
<div id="myDiv" class="class1 class2" style="">
... other elements ...
</div>
My jQuery code to clone the element, and then eventually replace the original element with the clone:
clonedDiv = $('#myDiv').clone(true);
... some other code ...
$('#myDiv').replaceWith(clonedDiv);
This works correctly - the only problem is that the cloned div somehow gets a style attribute that was not in the original:
<div id="myDiv" class="class1 class2"
style="overflow: hidden; height: 1px; padding-top: 0px; margin-top: 0px; padding-bottom: 0px; margin-bottom: 0px;">
... other elements ...
</div>
Where is this coming from...? Is there any way to prevent it? (I am currently "hacking" and explicitly setting it back to an empty string.)