function destroyElement(wrapper) {
  if (!(wrapper instanceof FocusableWrapper)) {
    return;
  }

  if (refCounter > 0) {
    refCounter -= 1;
  }

  deactivateElement(wrapper);

  if (refCounter <= 0) {
    refCounter = 0; // Detach secondary element from the DOM.

    var secondaryElement = secondaryElements.get(wrapper.rootDocument);

    if (secondaryElement && secondaryElement.parentNode) {
      secondaryElement.parentNode.removeChild(secondaryElement);
      secondaryElements.delete(wrapper.rootDocument);
    }

    wrapper.mainElement = null;
  }
}
Destroy the FocusableWrapper instance.

@param {FocusableWrapper} wrapper