'use strict';

/**
 * 彻底移除DOM元素防止内存泄漏
 * @param element {Node}
 */
function removeDomElement(element) {
  var dustbin = document.getElementById('bili-svg-icon-dustbin');

  if (!dustbin) {
    dustbin = document.createElement('DIV');
    dustbin.id = 'bili-svg-icon-dustbin';
    dustbin.style.display = 'none';
    document.body.appendChild(dustbin);
  }

  dustbin.appendChild(element);
  dustbin.innerHTML = '';
}

module.exports = removeDomElement;
