artDialog icon indicating copy to clipboard operation
artDialog copied to clipboard

窗口销毁 remove,不能删除iframe

Open doocal opened this issue 8 years ago • 1 comments

这段代码有问题,实际测试。销毁弹窗后(非半闭),dialog 的相关DOM结构删除了,但是内置iframe依然存在。 目前我这边延时(setTimeout)删除就干净了。

api.addEventListener('beforeremove', function () {
      // 重要!需要重置iframe地址,否则下次出现的对话框在IE6、7无法聚焦input
     // IE删除iframe后,iframe仍然会留在内存中出现上述问题,置换src是最容易解决的方法
    $iframe.attr('src', 'about:blank').remove();
}, false);

doocal avatar Jun 05 '17 01:06 doocal

你好,我是通过将上述代码的 beforeremove 改为 remove 来避免这个bug 的(不知道会不会导致其他问题)。 请问你说的 setTimeout 具体是怎么用? 是在 $iframe.attr('src', 'about:blank').remove(); 这句延时吗?例如:

setTimeout( function(){ $iframe.attr('src', 'about:blank').remove(); }, 100 );

这样吗?盼复

nhafeng avatar Apr 05 '21 09:04 nhafeng