code: function() {
        if (!this.openAsModal_) { return; }
        if (this.dialog_.hasAttribute('open') &&
            document.body.contains(this.dialog_)) { return; }
  
        this.openAsModal_ = false;
        this.dialog_.style.zIndex = '';
  
        // This won't match the native <dialog> exactly because if the user set
        // top on a centered polyfill dialog, that top gets thrown away when the
        // dialog is closed. Not sure it's possible to polyfill this perfectly.
        if (this.replacedStyleTop_) {
          this.dialog_.style.top = '';
          this.replacedStyleTop_ = false;
        }
  
        // Optimistically clear the modal part of this <dialog>.
        this.backdrop_.removeEventListener('click', this.backdropClick_);
        if (this.backdrop_.parentElement) {
          this.backdrop_.parentElement.removeChild(this.backdrop_);
        }
        dialogPolyfill.dm.removeDialog(this);
      }
docs: Maybe remove this dialog from the modal top layer. This is called when
  a modal dialog may no longer be tenable, e.g., when the dialog is no
  longer open or is no longer part of the DOM.