import Event from '../../event/Event.js'; import HTMLElement from '../html-element/HTMLElement.js'; /** * HTML Dialog Element. * * Reference: * https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement. */ export default class HTMLDialogElement extends HTMLElement { constructor() { super(...arguments); this.returnValue = ''; // Events this.oncancel = null; this.onclose = null; } /** * Returns open. * * @returns Open. */ get open() { return this.hasAttributeNS(null, 'open'); } /** * Closes the dialog. * * @param [returnValue] ReturnValue. */ close(returnValue = '') { this.removeAttribute('open'); this.returnValue = returnValue; this.dispatchEvent(new Event('close')); } /** * Shows the modal. */ showModal() { this.setAttribute('open', ''); } /** * Shows the dialog. */ show() { this.setAttribute('open', ''); } } //# sourceMappingURL=HTMLDialogElement.js.map