2013-03-19 19 views
0

Mootool的破坏方法似乎不工作,如果元件没有在DOM:Mootools的 - 销毁不是在DOM对象内的节点

var statics = $('statics').clone(true, true); 

statics.destroy('.prototype'); 

statics.inject($('main')); 

在本例中,我试图所有去掉具有来自静态对象的类“原型”的元素。它失败。

有什么建议吗?

编辑:

通过比较,我可以使用类似的方式使用jQuery实现这一目标:

var statics = $('#statics').clone(); 

statics.remove('.prototype'); 

$('#main').html(statics); 

这可能是为什么我想通过MooTools

回答

2

做同样的方式mootools销毁功能没有得到任何参数 - 它只适用于目标元素和他的孩子 - 所以你要找的是这样的:

var statics = $('statics').clone(true, true); 

statics.getElements('.prototype').destroy(); 

statics.inject($('main'));