docs: function init(params) {
    // Clean up the old popup if it exists
    var c = getContainer();
  
    if (c) {
      c.parentNode.removeChild(c);
      removeClass([document.documentElement, document.body], [swalClasses['no-backdrop'], swalClasses['toast-shown'], swalClasses['has-column']]);
    }
    /* istanbul ignore if */
  
  
    if (isNodeEnv()) {
      error('SweetAlert2 requires document to initialize');
      return;
    }
  
    var container = document.createElement('div');
    container.className = swalClasses.container;
    container.innerHTML = sweetHTML;
    var targetElement = typeof params.target === 'string' ? document.querySelector(params.target) : params.target;
    targetElement.appendChild(container);
    var popup = getPopup();
    var content = getContent();
    var input = getChildByClass(content, swalClasses.input);
    var file = getChildByClass(content, swalClasses.file);
    var range = content.querySelector(".".concat(swalClasses.range, " input"));
    var rangeOutput = content.querySelector(".".concat(swalClasses.range, " output"));
    var select = getChildByClass(content, swalClasses.select);
    var checkbox = content.querySelector(".".concat(swalClasses.checkbox, " input"));
    var textarea = getChildByClass(content, swalClasses.textarea); // a11y
  
    popup.setAttribute('role', params.toast ? 'alert' : 'dialog');
    popup.setAttribute('aria-live', params.toast ? 'polite' : 'assertive');
  
    if (!params.toast) {
      popup.setAttribute('aria-modal', 'true');
    } // RTL
  
  
    if (window.getComputedStyle(targetElement).direction === 'rtl') {
      addClass(getContainer(), swalClasses.rtl);
    }
  
    var oldInputVal; // IE11 workaround, see #1109 for details
  
    var resetValidationMessage = function resetValidationMessage(e) {
      if (Swal.isVisible() && oldInputVal !== e.target.value) {
        Swal.resetValidationMessage();
      }
  
      oldInputVal = e.target.value;
    };
  
    input.oninput = resetValidationMessage;
    file.onchange = resetValidationMessage;
    select.onchange = resetValidationMessage;
    checkbox.onchange = resetValidationMessage;
    textarea.oninput = resetValidationMessage;
  
    range.oninput = function (e) {
      resetValidationMessage(e);
      rangeOutput.value = range.value;
    };
  
    range.onchange = function (e) {
      resetValidationMessage(e);
      range.nextSibling.value = range.value;
    };
  
    return popup;
  }