Side navigation
#3648 closed bug (invalid)
Opened November 25, 2008 11:30AM UTC
Closed October 14, 2009 12:53AM UTC
clone(true) disabling other links on page.
Reported by: | Chippo | Owned by: | flesler |
---|---|---|---|
Priority: | major | Milestone: | 1.3 |
Component: | unfiled | Version: | 1.2.6 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Hi
I tried cloning an <li> element using the clone(true) to clone the element and its events. All works well but as soon as I run clone(true) the other links on the page (which are nothing to do with my app) stop working, and is as if each link has a return false attached to it. The function I was using is...
moveNode: function(pageid,newparent){
var theli = $('#'+TreeView.containerid+'_'+pageid).parent();
var theul = $(theli).parent();
var newli = $(theli).clone(true);
$(theli).remove();
if($(theul).find('li').length < 1){
var parentli = $(theul).parent();
$(theul).remove();
TreeView.addClasses(parentli);
} else {
$(theul).find('li').each(function(){TreeView.addClasses(this)});
}
if(newparent > 0){
var newparentli = $('#'+TreeView.containerid+'_'+newparent).parent
();
if($(newparentli).find('ul:first').length > 0){
$(newparentli).find('ul:first').each(function(){$(this).append
(newli)});
} else {
var newul = document.createElement('ul');
$(newul).append(newli);
$(newparentli).append(newul);
}
TreeView.addClasses(newparentli);
$(newparentli).find('li').each(function(){TreeView.addClasses
(this)});
} else {
$('#'+TreeView.containerid).append(newli);
$('#'+TreeView.containerid+' li:first ~ li').each(function()
{TreeView.addClasses(this)});
}
TreeView.addClasses(newli);
},
I have fixed this by not using clone and instead setting the events and style afterwards.
Attachments (0)
Change History (1)
Changed October 14, 2009 12:53AM UTC by comment:1
resolution: | → invalid |
---|---|
status: | new → closed |
This would be best debugged on the forums. There are several subtle issues with this code because it is caching jQuery objects after a stacking operation has been performed. This can cause memory leaks in some cases.
http://www.nabble.com/Severe-memory-leak-with-clone()-td25638057s27240.html