From 69419ab96fdb137edd7758dd252d6acba0abfdfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E4=BB=81?= Date: Tue, 11 Aug 2026 12:33:42 +0800 Subject: [PATCH 1/2] chore: target es2022, drop deprecated jquery shorthands, fix npm audit Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CHANGELOG.md | 5 ++++ README.md | 6 ++-- build.mjs | 14 +++++---- dist/custom-elements.min.js | 4 +-- dist/custom-elements.min.js.map | 4 +-- dist/dialog-polyfill.min.js | 2 +- dist/dialog-polyfill.min.js.map | 4 +-- dist/dialogify.cjs | 2 +- dist/dialogify.cjs.map | 6 ++-- dist/dialogify.min.js | 2 +- dist/dialogify.min.js.map | 6 ++-- dist/dialogify.mjs | 2 +- dist/dialogify.mjs.map | 6 ++-- docs/index.html | 22 +++++++------- docs/js/custom-elements.min.js | 4 +-- docs/js/dialog-polyfill.min.js | 2 +- docs/js/dialogify.min.js | 2 +- package-lock.json | 52 ++++++++++++++++----------------- src/js/core.js | 8 ++--- test/features.test.js | 2 +- 20 files changed, 83 insertions(+), 72 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09d46ad..5576a6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## Unreleased + chore: build target raised from es2018 to es2022, matching the browsers that ship a native + chore: replaced the deprecated jQuery `.click()` shorthand with `.on('click')`/`.trigger('click')`, so the library is clean under jQuery 4 + chore: npm audit fix for brace-expansion, nanoid, postcss and undici (transitive dev dependencies) + ## 2.2.0 fix: the dialog no longer blinks out and back in before its exit animation; the closing state is now set before the native close, which fires its event asynchronously feat: optional custom-elements bundle so Safari/WebKit can use diff --git a/README.md b/README.md index d3ffea2..eb515f7 100644 --- a/README.md +++ b/README.md @@ -453,11 +453,13 @@ exposes `window.dialogPolyfill`, which dialogify detects at runtime: ## Dependencies -- [jQuery](https://jquery.com/) (peer dependency, `>=3.0.0`) +- [jQuery](https://jquery.com/) (peer dependency, `>=3.0.0`, jQuery 4 included) ## Browser compatibility -All modern browser +Every browser with a native `` element (Chrome 94+, Firefox 98+, +Safari 15.4+); the bundles are built for `es2022`. Older browsers can load the +optional `dialog-polyfill` bundle. ## Designed by diff --git a/build.mjs b/build.mjs index fce2a51..9b1e8c8 100644 --- a/build.mjs +++ b/build.mjs @@ -9,6 +9,10 @@ import { replace } from 'esbuild-plugin-replace'; const jqueryGlobalShim = path.resolve('src/js/jquery-global.js'); +// Matches the browsers that ship a native element (Chrome 94+, +// Firefox 98+, Safari 15.4+), so nothing is downlevelled needlessly. +const TARGET = ['es2022']; + // Build the CSS once, reuse for the standalone file and the embedded builds. async function buildCss() { const result = await esbuild.build({ @@ -51,7 +55,7 @@ async function buildJs(cssLiteral) { sourcemap: true, format: 'iife', outfile: 'dist/dialogify.min.js', - target: ['es2018'], + target: TARGET, alias: { jquery: jqueryGlobalShim }, plugins: [cssReplace] }); @@ -64,7 +68,7 @@ async function buildJs(cssLiteral) { sourcemap: true, format: 'esm', outfile: 'dist/dialogify.mjs', - target: ['es2018'], + target: TARGET, external: ['jquery'], plugins: [cssReplace] }); @@ -79,7 +83,7 @@ async function buildJs(cssLiteral) { sourcemap: true, format: 'cjs', outfile: 'dist/dialogify.cjs', - target: ['es2018'], + target: TARGET, external: ['jquery'], footer: { js: 'if(module.exports&&module.exports.default){module.exports=module.exports.default}' @@ -97,7 +101,7 @@ async function buildPolyfill() { sourcemap: true, format: 'iife', outfile: 'dist/dialog-polyfill.min.js', - target: ['es2018'] + target: TARGET }); // Customized built-in elements polyfill for Safari/WebKit, needed only for @@ -109,7 +113,7 @@ async function buildPolyfill() { sourcemap: true, format: 'iife', outfile: 'dist/custom-elements.min.js', - target: ['es2018'] + target: TARGET }); } diff --git a/dist/custom-elements.min.js b/dist/custom-elements.min.js index f8460d1..653d7e1 100644 --- a/dist/custom-elements.min.js +++ b/dist/custom-elements.min.js @@ -1,5 +1,5 @@ -(()=>{(function(){"use strict";var z=(function(r,t){var e=function(i){for(var o=0,f=i.length;or.length)&&(t=r.length);for(var e=0,n=new Array(t);e=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(c){throw c},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,f;return{s:function(){e=e.call(r)},n:function(){var c=e.next();return i=c.done,c},e:function(c){o=!0,f=c},f:function(){try{!i&&e.return!=null&&e.return()}finally{if(o)throw f}}}}var T=!0,D=!1,K="querySelectorAll",Et=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:document,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:MutationObserver,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:["*"],i=function c(w,S,h,u,l,v){var p=J(w),O;try{for(p.s();!(O=p.n()).done;){var s=O.value;(v||K in s)&&(l?h.has(s)||(h.add(s),u.delete(s),t(s,l)):u.has(s)||(u.add(s),h.delete(s),t(s,l)),v||c(s[K](S),S,h,u,l,T))}}catch(B){p.e(B)}finally{p.f()}},o=new n(function(c){if(a.length){var w=a.join(","),S=new Set,h=new Set,u=J(c),l;try{for(u.s();!(l=u.n()).done;){var v=l.value,p=v.addedNodes,O=v.removedNodes;i(O,w,S,h,D,D),i(p,w,S,h,T,D)}}catch(s){u.e(s)}finally{u.f()}}}),f=o.observe;return(o.observe=function(c){return f.call(o,c,{subtree:T,childList:T})})(e),o},X="querySelectorAll",E=self,Mt=E.document,Y=E.Element,mt=E.MutationObserver,At=E.Set,Tt=E.WeakMap,Z=function(t){return X in t},_=[].filter,j=(function(r){var t=new Tt,e=function(u){for(var l=0,v=u.length;l1&&arguments[1]!==void 0?arguments[1]:!0,v=0,p=u.length;v{(function(){"use strict";var z=(function(r,t){var e=function(i){for(var o=0,f=i.length;or.length)&&(t=r.length);for(var e=0,n=new Array(t);e=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(c){throw c},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,f;return{s:function(){e=e.call(r)},n:function(){var c=e.next();return i=c.done,c},e:function(c){o=!0,f=c},f:function(){try{!i&&e.return!=null&&e.return()}finally{if(o)throw f}}}}var T=!0,D=!1,K="querySelectorAll",Et=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:document,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:MutationObserver,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:["*"],i=function c(w,S,h,u,l,v){var p=J(w),O;try{for(p.s();!(O=p.n()).done;){var s=O.value;(v||K in s)&&(l?h.has(s)||(h.add(s),u.delete(s),t(s,l)):u.has(s)||(u.add(s),h.delete(s),t(s,l)),v||c(s[K](S),S,h,u,l,T))}}catch(B){p.e(B)}finally{p.f()}},o=new n(function(c){if(a.length){var w=a.join(","),S=new Set,h=new Set,u=J(c),l;try{for(u.s();!(l=u.n()).done;){var v=l.value,p=v.addedNodes,O=v.removedNodes;i(O,w,S,h,D,D),i(p,w,S,h,T,D)}}catch(s){u.e(s)}finally{u.f()}}}),f=o.observe;return(o.observe=function(c){return f.call(o,c,{subtree:T,childList:T})})(e),o},X="querySelectorAll",E=self,Mt=E.document,Y=E.Element,mt=E.MutationObserver,At=E.Set,Tt=E.WeakMap,Z=function(t){return X in t},_=[].filter,j=(function(r){var t=new Tt,e=function(u){for(var l=0,v=u.length;l1&&arguments[1]!==void 0?arguments[1]:!0,v=0,p=u.length;v arr.length) len = arr.length;\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n return arr2;\n }\n function _createForOfIteratorHelper(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (!it) {\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n var F = function () {};\n return {\n s: F,\n n: function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n },\n e: function (e) {\n throw e;\n },\n f: F\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n var normalCompletion = true,\n didErr = false,\n err;\n return {\n s: function () {\n it = it.call(o);\n },\n n: function () {\n var step = it.next();\n normalCompletion = step.done;\n return step;\n },\n e: function (e) {\n didErr = true;\n err = e;\n },\n f: function () {\n try {\n if (!normalCompletion && it.return != null) it.return();\n } finally {\n if (didErr) throw err;\n }\n }\n };\n }\n\n /*! (c) Andrea Giammarchi - ISC */\n var TRUE = true,\n FALSE = false,\n QSA$1 = 'querySelectorAll';\n\n /**\n * Start observing a generic document or root element.\n * @param {(node:Element, connected:boolean) => void} callback triggered per each dis/connected element\n * @param {Document|Element} [root=document] by default, the global document to observe\n * @param {Function} [MO=MutationObserver] by default, the global MutationObserver\n * @param {string[]} [query=['*']] the selectors to use within nodes\n * @returns {MutationObserver}\n */\n var notify = function notify(callback) {\n var root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;\n var MO = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : MutationObserver;\n var query = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ['*'];\n var loop = function loop(nodes, selectors, added, removed, connected, pass) {\n var _iterator = _createForOfIteratorHelper(nodes),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var node = _step.value;\n if (pass || QSA$1 in node) {\n if (connected) {\n if (!added.has(node)) {\n added.add(node);\n removed[\"delete\"](node);\n callback(node, connected);\n }\n } else if (!removed.has(node)) {\n removed.add(node);\n added[\"delete\"](node);\n callback(node, connected);\n }\n if (!pass) loop(node[QSA$1](selectors), selectors, added, removed, connected, TRUE);\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n };\n var mo = new MO(function (records) {\n if (query.length) {\n var selectors = query.join(',');\n var added = new Set(),\n removed = new Set();\n var _iterator2 = _createForOfIteratorHelper(records),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var _step2$value = _step2.value,\n addedNodes = _step2$value.addedNodes,\n removedNodes = _step2$value.removedNodes;\n loop(removedNodes, selectors, added, removed, FALSE, FALSE);\n loop(addedNodes, selectors, added, removed, TRUE, FALSE);\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n }\n });\n var observe = mo.observe;\n (mo.observe = function (node) {\n return observe.call(mo, node, {\n subtree: TRUE,\n childList: TRUE\n });\n })(root);\n return mo;\n };\n\n var QSA = 'querySelectorAll';\n var _self$1 = self,\n document$2 = _self$1.document,\n Element$1 = _self$1.Element,\n MutationObserver$2 = _self$1.MutationObserver,\n Set$2 = _self$1.Set,\n WeakMap$1 = _self$1.WeakMap;\n var elements = function elements(element) {\n return QSA in element;\n };\n var filter = [].filter;\n var qsaObserver = (function (options) {\n var live = new WeakMap$1();\n var drop = function drop(elements) {\n for (var i = 0, length = elements.length; i < length; i++) live[\"delete\"](elements[i]);\n };\n var flush = function flush() {\n var records = observer.takeRecords();\n for (var i = 0, length = records.length; i < length; i++) {\n parse(filter.call(records[i].removedNodes, elements), false);\n parse(filter.call(records[i].addedNodes, elements), true);\n }\n };\n var matches = function matches(element) {\n return element.matches || element.webkitMatchesSelector || element.msMatchesSelector;\n };\n var notifier = function notifier(element, connected) {\n var selectors;\n if (connected) {\n for (var q, m = matches(element), i = 0, length = query.length; i < length; i++) {\n if (m.call(element, q = query[i])) {\n if (!live.has(element)) live.set(element, new Set$2());\n selectors = live.get(element);\n if (!selectors.has(q)) {\n selectors.add(q);\n options.handle(element, connected, q);\n }\n }\n }\n } else if (live.has(element)) {\n selectors = live.get(element);\n live[\"delete\"](element);\n selectors.forEach(function (q) {\n options.handle(element, connected, q);\n });\n }\n };\n var parse = function parse(elements) {\n var connected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n for (var i = 0, length = elements.length; i < length; i++) notifier(elements[i], connected);\n };\n var query = options.query;\n var root = options.root || document$2;\n var observer = notify(notifier, root, MutationObserver$2, query);\n var attachShadow = Element$1.prototype.attachShadow;\n if (attachShadow) Element$1.prototype.attachShadow = function (init) {\n var shadowRoot = attachShadow.call(this, init);\n observer.observe(shadowRoot);\n return shadowRoot;\n };\n if (query.length) parse(root[QSA](query));\n return {\n drop: drop,\n flush: flush,\n observer: observer,\n parse: parse\n };\n });\n\n var _self = self,\n document$1 = _self.document,\n Map = _self.Map,\n MutationObserver$1 = _self.MutationObserver,\n Object$1 = _self.Object,\n Set$1 = _self.Set,\n WeakMap = _self.WeakMap,\n Element = _self.Element,\n HTMLElement = _self.HTMLElement,\n Node = _self.Node,\n Error = _self.Error,\n TypeError$1 = _self.TypeError,\n Reflect = _self.Reflect;\n var defineProperty = Object$1.defineProperty,\n keys = Object$1.keys,\n getOwnPropertyNames = Object$1.getOwnPropertyNames,\n setPrototypeOf = Object$1.setPrototypeOf;\n var legacy = !self.customElements;\n var expando = function expando(element) {\n var key = keys(element);\n var value = [];\n var ignore = new Set$1();\n var length = key.length;\n for (var i = 0; i < length; i++) {\n value[i] = element[key[i]];\n try {\n delete element[key[i]];\n } catch (SafariTP) {\n ignore.add(i);\n }\n }\n return function () {\n for (var _i = 0; _i < length; _i++) ignore.has(_i) || (element[key[_i]] = value[_i]);\n };\n };\n if (legacy) {\n var HTMLBuiltIn = function HTMLBuiltIn() {\n var constructor = this.constructor;\n if (!classes.has(constructor)) throw new TypeError$1('Illegal constructor');\n var is = classes.get(constructor);\n if (override) return augment(override, is);\n var element = createElement.call(document$1, is);\n return augment(setPrototypeOf(element, constructor.prototype), is);\n };\n var createElement = document$1.createElement;\n var classes = new Map();\n var defined = new Map();\n var prototypes = new Map();\n var registry = new Map();\n var query = [];\n var handle = function handle(element, connected, selector) {\n var proto = prototypes.get(selector);\n if (connected && !proto.isPrototypeOf(element)) {\n var redefine = expando(element);\n override = setPrototypeOf(element, proto);\n try {\n new proto.constructor();\n } finally {\n override = null;\n redefine();\n }\n }\n var method = \"\".concat(connected ? '' : 'dis', \"connectedCallback\");\n if (method in proto) element[method]();\n };\n var _qsaObserver = qsaObserver({\n query: query,\n handle: handle\n }),\n parse = _qsaObserver.parse;\n var override = null;\n var whenDefined = function whenDefined(name) {\n if (!defined.has(name)) {\n var _,\n $ = new Promise(function ($) {\n _ = $;\n });\n defined.set(name, {\n $: $,\n _: _\n });\n }\n return defined.get(name).$;\n };\n var augment = attributesObserver(whenDefined, MutationObserver$1);\n self.customElements = {\n define: function define(is, Class) {\n if (registry.has(is)) throw new Error(\"the name \\\"\".concat(is, \"\\\" has already been used with this registry\"));\n classes.set(Class, is);\n prototypes.set(is, Class.prototype);\n registry.set(is, Class);\n query.push(is);\n whenDefined(is).then(function () {\n parse(document$1.querySelectorAll(is));\n });\n defined.get(is)._(Class);\n },\n get: function get(is) {\n return registry.get(is);\n },\n whenDefined: whenDefined\n };\n defineProperty(HTMLBuiltIn.prototype = HTMLElement.prototype, 'constructor', {\n value: HTMLBuiltIn\n });\n self.HTMLElement = HTMLBuiltIn;\n document$1.createElement = function (name, options) {\n var is = options && options.is;\n var Class = is ? registry.get(is) : registry.get(name);\n return Class ? new Class() : createElement.call(document$1, name);\n };\n // in case ShadowDOM is used through a polyfill, to avoid issues\n // with builtin extends within shadow roots\n if (!('isConnected' in Node.prototype)) defineProperty(Node.prototype, 'isConnected', {\n configurable: true,\n get: function get() {\n return !(this.ownerDocument.compareDocumentPosition(this) & this.DOCUMENT_POSITION_DISCONNECTED);\n }\n });\n } else {\n legacy = !self.customElements.get('extends-br');\n if (legacy) {\n try {\n var BR = function BR() {\n return self.Reflect.construct(HTMLBRElement, [], BR);\n };\n BR.prototype = HTMLLIElement.prototype;\n var is = 'extends-br';\n self.customElements.define('extends-br', BR, {\n 'extends': 'br'\n });\n legacy = document$1.createElement('br', {\n is: is\n }).outerHTML.indexOf(is) < 0;\n var _self$customElements = self.customElements,\n get = _self$customElements.get,\n _whenDefined = _self$customElements.whenDefined;\n self.customElements.whenDefined = function (is) {\n var _this = this;\n return _whenDefined.call(this, is).then(function (Class) {\n return Class || get.call(_this, is);\n });\n };\n } catch (o_O) {}\n }\n }\n if (legacy) {\n var _parseShadow = function _parseShadow(element) {\n var root = shadowRoots.get(element);\n _parse(root.querySelectorAll(this), element.isConnected);\n };\n var customElements = self.customElements;\n var _createElement = document$1.createElement;\n var define = customElements.define,\n _get = customElements.get,\n upgrade = customElements.upgrade;\n var _ref = Reflect || {\n construct: function construct(HTMLElement) {\n return HTMLElement.call(this);\n }\n },\n construct = _ref.construct;\n var shadowRoots = new WeakMap();\n var shadows = new Set$1();\n var _classes = new Map();\n var _defined = new Map();\n var _prototypes = new Map();\n var _registry = new Map();\n var shadowed = [];\n var _query = [];\n var getCE = function getCE(is) {\n return _registry.get(is) || _get.call(customElements, is);\n };\n var _handle = function _handle(element, connected, selector) {\n var proto = _prototypes.get(selector);\n if (connected && !proto.isPrototypeOf(element)) {\n var redefine = expando(element);\n _override = setPrototypeOf(element, proto);\n try {\n new proto.constructor();\n } finally {\n _override = null;\n redefine();\n }\n }\n var method = \"\".concat(connected ? '' : 'dis', \"connectedCallback\");\n if (method in proto) element[method]();\n };\n var _qsaObserver2 = qsaObserver({\n query: _query,\n handle: _handle\n }),\n _parse = _qsaObserver2.parse;\n var _qsaObserver3 = qsaObserver({\n query: shadowed,\n handle: function handle(element, connected) {\n if (shadowRoots.has(element)) {\n if (connected) shadows.add(element);else shadows[\"delete\"](element);\n if (_query.length) _parseShadow.call(_query, element);\n }\n }\n }),\n parseShadowed = _qsaObserver3.parse;\n // qsaObserver also patches attachShadow\n // be sure this runs *after* that\n var attachShadow = Element.prototype.attachShadow;\n if (attachShadow) Element.prototype.attachShadow = function (init) {\n var root = attachShadow.call(this, init);\n shadowRoots.set(this, root);\n return root;\n };\n var _whenDefined2 = function _whenDefined2(name) {\n if (!_defined.has(name)) {\n var _,\n $ = new Promise(function ($) {\n _ = $;\n });\n _defined.set(name, {\n $: $,\n _: _\n });\n }\n return _defined.get(name).$;\n };\n var _augment = attributesObserver(_whenDefined2, MutationObserver$1);\n var _override = null;\n getOwnPropertyNames(self).filter(function (k) {\n return /^HTML.*Element$/.test(k);\n }).forEach(function (k) {\n var HTMLElement = self[k];\n function HTMLBuiltIn() {\n var constructor = this.constructor;\n if (!_classes.has(constructor)) throw new TypeError$1('Illegal constructor');\n var _classes$get = _classes.get(constructor),\n is = _classes$get.is,\n tag = _classes$get.tag;\n if (is) {\n if (_override) return _augment(_override, is);\n var element = _createElement.call(document$1, tag);\n element.setAttribute('is', is);\n return _augment(setPrototypeOf(element, constructor.prototype), is);\n } else return construct.call(this, HTMLElement, [], constructor);\n }\n\n defineProperty(HTMLBuiltIn.prototype = HTMLElement.prototype, 'constructor', {\n value: HTMLBuiltIn\n });\n defineProperty(self, k, {\n value: HTMLBuiltIn\n });\n });\n document$1.createElement = function (name, options) {\n var is = options && options.is;\n if (is) {\n var Class = _registry.get(is);\n if (Class && _classes.get(Class).tag === name) return new Class();\n }\n var element = _createElement.call(document$1, name);\n if (is) element.setAttribute('is', is);\n return element;\n };\n customElements.get = getCE;\n customElements.whenDefined = _whenDefined2;\n customElements.upgrade = function (element) {\n var is = element.getAttribute('is');\n if (is) {\n var _constructor = _registry.get(is);\n if (_constructor) {\n _augment(setPrototypeOf(element, _constructor.prototype), is);\n // apparently unnecessary because this is handled by qsa observer\n // if (element.isConnected && element.connectedCallback)\n // element.connectedCallback();\n return;\n }\n }\n upgrade.call(customElements, element);\n };\n customElements.define = function (is, Class, options) {\n if (getCE(is)) throw new Error(\"'\".concat(is, \"' has already been defined as a custom element\"));\n var selector;\n var tag = options && options[\"extends\"];\n _classes.set(Class, tag ? {\n is: is,\n tag: tag\n } : {\n is: '',\n tag: is\n });\n if (tag) {\n selector = \"\".concat(tag, \"[is=\\\"\").concat(is, \"\\\"]\");\n _prototypes.set(selector, Class.prototype);\n _registry.set(is, Class);\n _query.push(selector);\n } else {\n define.apply(customElements, arguments);\n shadowed.push(selector = is);\n }\n _whenDefined2(is).then(function () {\n if (tag) {\n _parse(document$1.querySelectorAll(selector));\n shadows.forEach(_parseShadow, [selector]);\n } else parseShadowed(document$1.querySelectorAll(selector));\n });\n _defined.get(is)._(Class);\n };\n }\n\n})();\n"], - "mappings": "OACC,UAAY,CACX,aAEA,IAAIA,GAAsB,SAAUC,EAAaC,EAAkB,CACjE,IAAIC,EAAmB,SAA0BC,EAAS,CACxD,QAASC,EAAI,EAAGC,EAASF,EAAQ,OAAQC,EAAIC,EAAQD,IAAKE,EAASH,EAAQC,CAAC,CAAC,CAC/E,EACIE,EAAW,SAAkBC,EAAM,CACrC,IAAIC,EAASD,EAAK,OAChBE,EAAgBF,EAAK,cACrBG,EAAWH,EAAK,SAClBC,EAAO,yBAAyBC,EAAeC,EAAUF,EAAO,aAAaC,CAAa,CAAC,CAC7F,EACA,OAAO,SAAUD,EAAQG,EAAI,CAC3B,IAAIC,EAAkBJ,EAAO,YAAY,mBACzC,OAAII,GACFZ,EAAYW,CAAE,EAAE,KAAK,UAAY,CAC/B,IAAIV,EAAiBC,CAAgB,EAAE,QAAQM,EAAQ,CACrD,WAAY,GACZ,kBAAmB,GACnB,gBAAiBI,CACnB,CAAC,EACD,QAASR,EAAI,EAAGC,EAASO,EAAgB,OAAQR,EAAIC,EAAQD,IACvDI,EAAO,aAAaI,EAAgBR,CAAC,CAAC,GAAGE,EAAS,CACpD,OAAQE,EACR,cAAeI,EAAgBR,CAAC,EAChC,SAAU,IACZ,CAAC,CAEL,CAAC,EAEII,CACT,CACF,GAEA,SAASK,GAA4BC,EAAGC,EAAQ,CAC9C,GAAKD,EACL,IAAI,OAAOA,GAAM,SAAU,OAAOE,EAAkBF,EAAGC,CAAM,EAC7D,IAAIE,EAAI,OAAO,UAAU,SAAS,KAAKH,CAAC,EAAE,MAAM,EAAG,EAAE,EAErD,GADIG,IAAM,UAAYH,EAAE,cAAaG,EAAIH,EA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AAI,OAAO9E,EAAI,gDAAgD,CAAC,EAC/F,IAAIsG,EACAyC,EAAMxF,GAAWA,EAAQ,QAC7BwE,EAAS,IAAIjB,EAAOiC,EAAM,CACxB,GAAI/I,EACJ,IAAK+I,CACP,EAAI,CACF,GAAI,GACJ,IAAK/I,CACP,CAAC,EACG+I,GACFzC,EAAW,GAAG,OAAOyC,EAAK,OAAQ,EAAE,OAAO/I,EAAI,IAAK,EACpDiI,GAAY,IAAI3B,EAAUQ,EAAM,SAAS,EACzCoB,EAAU,IAAIlI,EAAI8G,CAAK,EACvBsB,EAAO,KAAK9B,CAAQ,IAEpBoB,GAAO,MAAMF,EAAgB,SAAS,EACtCW,GAAS,KAAK7B,EAAWtG,CAAE,GAE7B2I,EAAc3I,CAAE,EAAE,KAAK,UAAY,CAC7B+I,GACFxB,GAAOlD,EAAW,iBAAiBiC,CAAQ,CAAC,EAC5CwB,EAAQ,QAAQT,GAAc,CAACf,CAAQ,CAAC,GACnCoC,GAAcrE,EAAW,iBAAiBiC,CAAQ,CAAC,CAC5D,CAAC,EACD0B,EAAS,IAAIhI,CAAE,EAAE,EAAE8G,CAAK,CAC1B,CACF,CAEF,GAAG", - "names": ["attributesObserver", "whenDefined", "MutationObserver", "attributeChanged", "records", "i", "length", "dispatch", "_ref", "target", "attributeName", "oldValue", "is", "attributeFilter", "_unsupportedIterableToArray", "o", "minLen", "_arrayLikeToArray", "n", "arr", "len", "arr2", "_createForOfIteratorHelper", "allowArrayLike", "it", "F", "e", "normalCompletion", "didErr", "err", "step", "TRUE", "FALSE", "QSA$1", "notify", "callback", "root", "MO", "query", "loop", "nodes", "selectors", "added", "removed", "connected", "pass", "_iterator", "_step", "node", "mo", "_iterator2", "_step2", "_step2$value", "addedNodes", "removedNodes", "observe", "QSA", "_self$1", "document$2", "Element$1", "MutationObserver$2", "Set$2", "WeakMap$1", "elements", "element", "filter", "qsaObserver", "options", "live", "drop", "flush", "observer", "parse", "matches", "notifier", "q", "m", "attachShadow", "init", "shadowRoot", "_self", "document$1", "Map", "MutationObserver$1", "Object$1", "Set$1", "WeakMap", "Element", "HTMLElement", "Node", "Error", "TypeError$1", "Reflect", "defineProperty", "keys", "getOwnPropertyNames", "setPrototypeOf", "legacy", "expando", "key", "value", "ignore", "SafariTP", "_i", "HTMLBuiltIn", "constructor", "classes", "override", "augment", "createElement", "defined", "prototypes", "registry", "handle", "selector", "proto", "redefine", "method", "_qsaObserver", "name", "_", "$", "Class", "BR", "_self$customElements", "get", "_whenDefined", "_this", "o_O", "_parseShadow", "shadowRoots", "_parse", "customElements", "_createElement", "define", "_get", "upgrade", "construct", "shadows", "_classes", "_defined", "_prototypes", "_registry", "shadowed", "_query", "getCE", "_handle", "_override", "_qsaObserver2", "_qsaObserver3", "parseShadowed", "_whenDefined2", "_augment", "k", "_classes$get", "tag", "_constructor"] + "mappings": "OACC,UAAY,CACX,aAEA,IAAIA,GAAsB,SAAUC,EAAaC,EAAkB,CACjE,IAAIC,EAAmB,SAA0BC,EAAS,CACxD,QAASC,EAAI,EAAGC,EAASF,EAAQ,OAAQC,EAAIC,EAAQD,IAAKE,EAASH,EAAQC,CAAC,CAAC,CAC/E,EACIE,EAAW,SAAkBC,EAAM,CACrC,IAAIC,EAASD,EAAK,OAChBE,EAAgBF,EAAK,cACrBG,EAAWH,EAAK,SAClBC,EAAO,yBAAyBC,EAAeC,EAAUF,EAAO,aAAaC,CAAa,CAAC,CAC7F,EACA,OAAO,SAAUD,EAAQG,EAAI,CAC3B,IAAIC,EAAkBJ,EAAO,YAAY,mBACzC,OAAII,GACFZ,EAAYW,CAAE,EAAE,KAAK,UAAY,CAC/B,IAAIV,EAAiBC,CAAgB,EAAE,QAAQM,EAAQ,CACrD,WAAY,GACZ,kBAAmB,GACnB,gBAAiBI,CACnB,CAAC,EACD,QAASR,EAAI,EAAGC,EAASO,EAAgB,OAAQR,EAAIC,EAAQD,IACvDI,EAAO,aAAaI,EAAgBR,CAAC,CAAC,GAAGE,EAAS,CACpD,OAAQE,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N,IAAI8I,EAAed,EAAU,IAAIhI,CAAE,EACnC,GAAI8I,EAAc,CAChBJ,EAAStD,EAAehC,EAAS0F,EAAa,SAAS,EAAG9I,CAAE,EAI5D,MACF,CACF,CACA0H,GAAQ,KAAKJ,EAAgBlE,CAAO,CACtC,EACAkE,EAAe,OAAS,SAAUtH,EAAI6G,EAAOtD,EAAS,CACpD,GAAI4E,GAAMnI,CAAE,EAAG,MAAM,IAAI8E,GAAM,IAAI,OAAO9E,EAAI,gDAAgD,CAAC,EAC/F,IAAIqG,EACAwC,EAAMtF,GAAWA,EAAQ,QAC7BsE,EAAS,IAAIhB,EAAOgC,EAAM,CACxB,GAAI7I,EACJ,IAAK6I,CACP,EAAI,CACF,GAAI,GACJ,IAAK7I,CACP,CAAC,EACG6I,GACFxC,EAAW,GAAG,OAAOwC,EAAK,OAAQ,EAAE,OAAO7I,EAAI,IAAK,EACpD+H,GAAY,IAAI1B,EAAUQ,EAAM,SAAS,EACzCmB,EAAU,IAAIhI,EAAI6G,CAAK,EACvBqB,EAAO,KAAK7B,CAAQ,IAEpBmB,GAAO,MAAMF,EAAgB,SAAS,EACtCW,GAAS,KAAK5B,EAAWrG,CAAE,GAE7ByI,EAAczI,CAAE,EAAE,KAAK,UAAY,CAC7B6I,GACFxB,GAAOhD,EAAW,iBAAiBgC,CAAQ,CAAC,EAC5CuB,EAAQ,QAAQT,GAAc,CAACd,CAAQ,CAAC,GACnCmC,GAAcnE,EAAW,iBAAiBgC,CAAQ,CAAC,CAC5D,CAAC,EACDyB,EAAS,IAAI9H,CAAE,EAAE,EAAE6G,CAAK,CAC1B,CACF,CAEF,GAAG", + "names": ["attributesObserver", "whenDefined", "MutationObserver", "attributeChanged", "records", "i", "length", "dispatch", "_ref", "target", "attributeName", "oldValue", "is", "attributeFilter", "_unsupportedIterableToArray", "o", "minLen", "_arrayLikeToArray", "n", "arr", "len", "arr2", "_createForOfIteratorHelper", "allowArrayLike", "it", "F", "e", "normalCompletion", "didErr", "err", "step", "TRUE", "FALSE", "QSA$1", "notify", "callback", "root", "MO", "query", "loop", "nodes", "selectors", "added", "removed", "connected", "pass", "_iterator", "_step", "node", "mo", "_iterator2", "_step2", "_step2$value", "addedNodes", "removedNodes", "observe", "QSA", "_self$1", "document$2", "Element$1", "MutationObserver$2", "Set$2", "WeakMap$1", "elements", "element", "filter", "qsaObserver", "options", "live", "drop", "flush", "observer", "parse", "matches", "notifier", "q", "m", "attachShadow", "init", "shadowRoot", "_self", "document$1", "Map", "MutationObserver$1", "Object$1", "Set$1", "WeakMap", "Element", "HTMLElement", "Node", "Error", "TypeError$1", "Reflect", "defineProperty", "keys", "getOwnPropertyNames", "setPrototypeOf", "legacy", "expando", "key", "value", "ignore", "_i", "HTMLBuiltIn", "constructor", "classes", "override", "augment", "createElement", "defined", "prototypes", "registry", "handle", "selector", "proto", "redefine", "method", "_qsaObserver", "name", "_", "$", "Class", "BR", "_self$customElements", "get", "_whenDefined", "_this", "_parseShadow", "shadowRoots", "_parse", "customElements", "_createElement", "define", "_get", "upgrade", "construct", "shadows", "_classes", "_defined", "_prototypes", "_registry", "shadowed", "_query", "getCE", "_handle", "_override", "_qsaObserver2", "_qsaObserver3", "parseShadowed", "_whenDefined2", "_augment", "k", "_classes$get", "tag", "_constructor"] } diff --git a/dist/dialog-polyfill.min.js b/dist/dialog-polyfill.min.js index 1e491bb..9fd42fe 100644 --- a/dist/dialog-polyfill.min.js +++ b/dist/dialog-polyfill.min.js @@ -1,2 +1,2 @@ -(()=>{var d=window.CustomEvent;(!d||typeof d=="object")&&(d=function(t,o){o=o||{};var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,!!o.bubbles,!!o.cancelable,o.detail||null),i},d.prototype=window.Event.prototype);function _(e,t){var o="on"+t.type.toLowerCase();return typeof e[o]=="function"&&e[o](t),e.dispatchEvent(t)}function T(e){for(;e&&e!==document.body;){var t=window.getComputedStyle(e),o=function(i,a){return!(t[i]===void 0||t[i]===a)};if(t.opacity<1||o("zIndex","auto")||o("transform","none")||o("mixBlendMode","normal")||o("filter","none")||o("perspective","none")||t.isolation==="isolate"||t.position==="fixed"||t.webkitOverflowScrolling==="touch")return!0;e=e.parentElement}return!1}function c(e){for(;e;){if(e.localName==="dialog")return e;e.parentElement?e=e.parentElement:e.parentNode?e=e.parentNode.host:e=null}return null}function E(e){for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;e&&e.blur&&e!==document.body&&e.blur()}function x(e,t){for(var o=0;o=0&&(e=this.dialog_),e||(e=M(this.dialog_)),E(document.activeElement),e&&e.focus()},updateZIndex:function(e,t){if(e, the polyfill may not work correctly",e),e.localName!=="dialog")throw new Error("Failed to register dialog: The element is not a dialog.");new k(e)};n.registerDialog=function(e){e.showModal||n.forceRegisterDialog(e)};n.DialogManager=function(){this.pendingDialogStack=[];var e=this.checkDOM_.bind(this);this.overlay=document.createElement("div"),this.overlay.className="_dialog_overlay",this.overlay.addEventListener("click",function(t){this.forwardTab_=void 0,t.stopPropagation(),e([])}.bind(this)),this.handleKey_=this.handleKey_.bind(this),this.handleFocus_=this.handleFocus_.bind(this),this.zIndexLow_=1e5,this.zIndexHigh_=100150,this.forwardTab_=void 0,"MutationObserver"in window&&(this.mo_=new MutationObserver(function(t){var o=[];t.forEach(function(i){for(var a=0,r;r=i.removedNodes[a];++a){if(r instanceof Element)r.localName==="dialog"&&o.push(r);else continue;o=o.concat(r.querySelectorAll("dialog"))}}),o.length&&e(o)}))};n.DialogManager.prototype.blockDocument=function(){document.documentElement.addEventListener("focus",this.handleFocus_,!0),document.addEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.observe(document,{childList:!0,subtree:!0})};n.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener("focus",this.handleFocus_,!0),document.removeEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.disconnect()};n.DialogManager.prototype.updateStacking=function(){for(var e=this.zIndexHigh_,t=0,o;o=this.pendingDialogStack[t];++t)o.updateZIndex(--e,--e),t===0&&(this.overlay.style.zIndex=--e);var i=this.pendingDialogStack[0];if(i){var a=i.dialog.parentNode||document.body;a.appendChild(this.overlay)}else this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)};n.DialogManager.prototype.containedByTopDialog_=function(e){for(;e=c(e);){for(var t=0,o;o=this.pendingDialogStack[t];++t)if(o.dialog===e)return t===0;e=e.parentElement}return!1};n.DialogManager.prototype.handleFocus_=function(e){var t=e.composedPath?e.composedPath()[0]:e.target;if(!this.containedByTopDialog_(t)&&document.activeElement!==document.documentElement&&(e.preventDefault(),e.stopPropagation(),E(t),this.forwardTab_!==void 0)){var o=this.pendingDialogStack[0],i=o.dialog,a=i.compareDocumentPosition(t);return a&Node.DOCUMENT_POSITION_PRECEDING&&(this.forwardTab_?o.focus_():t!==document.documentElement&&document.documentElement.focus()),!1}};n.DialogManager.prototype.handleKey_=function(e){if(this.forwardTab_=void 0,e.keyCode===27){e.preventDefault(),e.stopPropagation();var t=new d("cancel",{bubbles:!1,cancelable:!0}),o=this.pendingDialogStack[0];o&&_(o.dialog,t)&&o.dialog.close()}else e.keyCode===9&&(this.forwardTab_=!e.shiftKey)};n.DialogManager.prototype.checkDOM_=function(e){var t=this.pendingDialogStack.slice();t.forEach(function(o){e.indexOf(o.dialog)!==-1?o.downgradeModal():o.maybeHideModal()})};n.DialogManager.prototype.pushDialog=function(e){var t=(this.zIndexHigh_-this.zIndexLow_)/2-1;return this.pendingDialogStack.length>=t?!1:(this.pendingDialogStack.unshift(e)===1&&this.blockDocument(),this.updateStacking(),!0)};n.DialogManager.prototype.removeDialog=function(e){var t=this.pendingDialogStack.indexOf(e);t!==-1&&(this.pendingDialogStack.splice(t,1),this.pendingDialogStack.length===0&&this.unblockDocument(),this.updateStacking())};n.dm=new n.DialogManager;n.formSubmitter=null;n.imagemapUseValue=null;window.HTMLDialogElement===void 0&&(h=document.createElement("form"),h.setAttribute("method","dialog"),h.method!=="dialog"&&(l=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"method"),l&&(b=l.get,l.get=function(){return f(this)?"dialog":b.call(this)},v=l.set,l.set=function(e){return typeof e=="string"&&e.toLowerCase()==="dialog"?this.setAttribute("method",e):v.call(this,e)},Object.defineProperty(HTMLFormElement.prototype,"method",l))),document.addEventListener("click",function(e){if(n.formSubmitter=null,n.imagemapUseValue=null,!e.defaultPrevented){var t=e.target;if("composedPath"in e){var o=e.composedPath();t=o.shift()||t}if(!(!t||!f(t.form))){var i=t.type==="submit"&&["button","input"].indexOf(t.localName)>-1;if(!i){if(!(t.localName==="input"&&t.type==="image"))return;n.imagemapUseValue=e.offsetX+","+e.offsetY}var a=c(t);a&&(n.formSubmitter=t)}}},!1),document.addEventListener("submit",function(e){var t=e.target,o=c(t);if(!o){var i=D(e),a=i&&i.getAttribute("formmethod")||t.getAttribute("method");a==="dialog"&&e.preventDefault()}}),y=HTMLFormElement.prototype.submit,w=function(){if(!f(this))return y.call(this);var e=c(this);e&&e.close()},HTMLFormElement.prototype.submit=w);var h,l,b,v,y,w,g=n;typeof window!="undefined"&&(window.dialogPolyfill=g);var C=g;})(); +(()=>{var d=window.CustomEvent;(!d||typeof d=="object")&&(d=function(t,o){o=o||{};var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,!!o.bubbles,!!o.cancelable,o.detail||null),i},d.prototype=window.Event.prototype);function _(e,t){var o="on"+t.type.toLowerCase();return typeof e[o]=="function"&&e[o](t),e.dispatchEvent(t)}function T(e){for(;e&&e!==document.body;){var t=window.getComputedStyle(e),o=function(i,a){return!(t[i]===void 0||t[i]===a)};if(t.opacity<1||o("zIndex","auto")||o("transform","none")||o("mixBlendMode","normal")||o("filter","none")||o("perspective","none")||t.isolation==="isolate"||t.position==="fixed"||t.webkitOverflowScrolling==="touch")return!0;e=e.parentElement}return!1}function c(e){for(;e;){if(e.localName==="dialog")return e;e.parentElement?e=e.parentElement:e.parentNode?e=e.parentNode.host:e=null}return null}function E(e){for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;e&&e.blur&&e!==document.body&&e.blur()}function x(e,t){for(var o=0;o=0&&(e=this.dialog_),e||(e=M(this.dialog_)),E(document.activeElement),e&&e.focus()},updateZIndex:function(e,t){if(e, the polyfill may not work correctly",e),e.localName!=="dialog")throw new Error("Failed to register dialog: The element is not a dialog.");new k(e)};n.registerDialog=function(e){e.showModal||n.forceRegisterDialog(e)};n.DialogManager=function(){this.pendingDialogStack=[];var e=this.checkDOM_.bind(this);this.overlay=document.createElement("div"),this.overlay.className="_dialog_overlay",this.overlay.addEventListener("click",function(t){this.forwardTab_=void 0,t.stopPropagation(),e([])}.bind(this)),this.handleKey_=this.handleKey_.bind(this),this.handleFocus_=this.handleFocus_.bind(this),this.zIndexLow_=1e5,this.zIndexHigh_=100150,this.forwardTab_=void 0,"MutationObserver"in window&&(this.mo_=new MutationObserver(function(t){var o=[];t.forEach(function(i){for(var a=0,r;r=i.removedNodes[a];++a){if(r instanceof Element)r.localName==="dialog"&&o.push(r);else continue;o=o.concat(r.querySelectorAll("dialog"))}}),o.length&&e(o)}))};n.DialogManager.prototype.blockDocument=function(){document.documentElement.addEventListener("focus",this.handleFocus_,!0),document.addEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.observe(document,{childList:!0,subtree:!0})};n.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener("focus",this.handleFocus_,!0),document.removeEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.disconnect()};n.DialogManager.prototype.updateStacking=function(){for(var e=this.zIndexHigh_,t=0,o;o=this.pendingDialogStack[t];++t)o.updateZIndex(--e,--e),t===0&&(this.overlay.style.zIndex=--e);var i=this.pendingDialogStack[0];if(i){var a=i.dialog.parentNode||document.body;a.appendChild(this.overlay)}else this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)};n.DialogManager.prototype.containedByTopDialog_=function(e){for(;e=c(e);){for(var t=0,o;o=this.pendingDialogStack[t];++t)if(o.dialog===e)return t===0;e=e.parentElement}return!1};n.DialogManager.prototype.handleFocus_=function(e){var t=e.composedPath?e.composedPath()[0]:e.target;if(!this.containedByTopDialog_(t)&&document.activeElement!==document.documentElement&&(e.preventDefault(),e.stopPropagation(),E(t),this.forwardTab_!==void 0)){var o=this.pendingDialogStack[0],i=o.dialog,a=i.compareDocumentPosition(t);return a&Node.DOCUMENT_POSITION_PRECEDING&&(this.forwardTab_?o.focus_():t!==document.documentElement&&document.documentElement.focus()),!1}};n.DialogManager.prototype.handleKey_=function(e){if(this.forwardTab_=void 0,e.keyCode===27){e.preventDefault(),e.stopPropagation();var t=new d("cancel",{bubbles:!1,cancelable:!0}),o=this.pendingDialogStack[0];o&&_(o.dialog,t)&&o.dialog.close()}else e.keyCode===9&&(this.forwardTab_=!e.shiftKey)};n.DialogManager.prototype.checkDOM_=function(e){var t=this.pendingDialogStack.slice();t.forEach(function(o){e.indexOf(o.dialog)!==-1?o.downgradeModal():o.maybeHideModal()})};n.DialogManager.prototype.pushDialog=function(e){var t=(this.zIndexHigh_-this.zIndexLow_)/2-1;return this.pendingDialogStack.length>=t?!1:(this.pendingDialogStack.unshift(e)===1&&this.blockDocument(),this.updateStacking(),!0)};n.DialogManager.prototype.removeDialog=function(e){var t=this.pendingDialogStack.indexOf(e);t!==-1&&(this.pendingDialogStack.splice(t,1),this.pendingDialogStack.length===0&&this.unblockDocument(),this.updateStacking())};n.dm=new n.DialogManager;n.formSubmitter=null;n.imagemapUseValue=null;window.HTMLDialogElement===void 0&&(h=document.createElement("form"),h.setAttribute("method","dialog"),h.method!=="dialog"&&(l=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"method"),l&&(b=l.get,l.get=function(){return f(this)?"dialog":b.call(this)},v=l.set,l.set=function(e){return typeof e=="string"&&e.toLowerCase()==="dialog"?this.setAttribute("method",e):v.call(this,e)},Object.defineProperty(HTMLFormElement.prototype,"method",l))),document.addEventListener("click",function(e){if(n.formSubmitter=null,n.imagemapUseValue=null,!e.defaultPrevented){var t=e.target;if("composedPath"in e){var o=e.composedPath();t=o.shift()||t}if(!(!t||!f(t.form))){var i=t.type==="submit"&&["button","input"].indexOf(t.localName)>-1;if(!i){if(!(t.localName==="input"&&t.type==="image"))return;n.imagemapUseValue=e.offsetX+","+e.offsetY}var a=c(t);a&&(n.formSubmitter=t)}}},!1),document.addEventListener("submit",function(e){var t=e.target,o=c(t);if(!o){var i=D(e),a=i&&i.getAttribute("formmethod")||t.getAttribute("method");a==="dialog"&&e.preventDefault()}}),y=HTMLFormElement.prototype.submit,w=function(){if(!f(this))return y.call(this);var e=c(this);e&&e.close()},HTMLFormElement.prototype.submit=w);var h,l,b,v,y,w,g=n;typeof window<"u"&&(window.dialogPolyfill=g);var C=g;})(); //# sourceMappingURL=dialog-polyfill.min.js.map diff --git a/dist/dialog-polyfill.min.js.map b/dist/dialog-polyfill.min.js.map index 71820ab..97dfc63 100644 --- a/dist/dialog-polyfill.min.js.map +++ b/dist/dialog-polyfill.min.js.map @@ -2,6 +2,6 @@ "version": 3, "sources": ["../src/js/dialog-polyfill.esm.js", "../src/js/dialog-polyfill.browser.js"], "sourcesContent": ["// nb. This is for IE10 and lower _only_.\nvar supportCustomEvent = window.CustomEvent;\nif (!supportCustomEvent || typeof supportCustomEvent === 'object') {\n supportCustomEvent = function CustomEvent(event, x) {\n x = x || {};\n var ev = document.createEvent('CustomEvent');\n ev.initCustomEvent(event, !!x.bubbles, !!x.cancelable, x.detail || null);\n return ev;\n };\n supportCustomEvent.prototype = window.Event.prototype;\n}\n\n/**\n * Dispatches the passed event to both an \"on\" handler as well as via the\n * normal dispatch operation. Does not bubble.\n *\n * @param {!EventTarget} target\n * @param {!Event} event\n * @return {boolean}\n */\nfunction safeDispatchEvent(target, event) {\n var check = 'on' + event.type.toLowerCase();\n if (typeof target[check] === 'function') {\n target[check](event);\n }\n return target.dispatchEvent(event);\n}\n\n/**\n * @param {Element} el to check for stacking context\n * @return {boolean} whether this el or its parents creates a stacking context\n */\nfunction createsStackingContext(el) {\n while (el && el !== document.body) {\n var s = window.getComputedStyle(el);\n var invalid = function(k, ok) {\n return !(s[k] === undefined || s[k] === ok);\n };\n\n if (s.opacity < 1 ||\n invalid('zIndex', 'auto') ||\n invalid('transform', 'none') ||\n invalid('mixBlendMode', 'normal') ||\n invalid('filter', 'none') ||\n invalid('perspective', 'none') ||\n s['isolation'] === 'isolate' ||\n s.position === 'fixed' ||\n s.webkitOverflowScrolling === 'touch') {\n return true;\n }\n el = el.parentElement;\n }\n return false;\n}\n\n/**\n * Finds the nearest from the passed element.\n *\n * @param {Element} el to search from\n * @return {HTMLDialogElement} dialog found\n */\nfunction findNearestDialog(el) {\n while (el) {\n if (el.localName === 'dialog') {\n return /** @type {HTMLDialogElement} */ (el);\n }\n if (el.parentElement) {\n el = el.parentElement;\n } else if (el.parentNode) {\n el = el.parentNode.host;\n } else {\n el = null;\n }\n }\n return null;\n}\n\n/**\n * Blur the specified element, as long as it's not the HTML body element.\n * This works around an IE9/10 bug - blurring the body causes Windows to\n * blur the whole application.\n *\n * @param {Element} el to blur\n */\nfunction safeBlur(el) {\n // Find the actual focused element when the active element is inside a shadow root\n while (el && el.shadowRoot && el.shadowRoot.activeElement) {\n el = el.shadowRoot.activeElement;\n }\n\n if (el && el.blur && el !== document.body) {\n el.blur();\n }\n}\n\n/**\n * @param {!NodeList} nodeList to search\n * @param {Node} node to find\n * @return {boolean} whether node is inside nodeList\n */\nfunction inNodeList(nodeList, node) {\n for (var i = 0; i < nodeList.length; ++i) {\n if (nodeList[i] === node) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * @param {HTMLFormElement} el to check\n * @return {boolean} whether this form has method=\"dialog\"\n */\nfunction isFormMethodDialog(el) {\n if (!el || !el.hasAttribute('method')) {\n return false;\n }\n return el.getAttribute('method').toLowerCase() === 'dialog';\n}\n\n/**\n * @param {!DocumentFragment|!Element} hostElement\n * @return {?Element}\n */\nfunction findFocusableElementWithin(hostElement) {\n // Note that this is 'any focusable area'. This list is probably not exhaustive, but the\n // alternative involves stepping through and trying to focus everything.\n var opts = ['button', 'input', 'keygen', 'select', 'textarea'];\n var query = opts.map(function(el) {\n return el + ':not([disabled])';\n });\n // TODO(samthor): tabindex values that are not numeric are not focusable.\n query.push('[tabindex]:not([disabled]):not([tabindex=\"\"])'); // tabindex != \"\", not disabled\n var target = hostElement.querySelector(query.join(', '));\n\n if (!target && 'attachShadow' in Element.prototype) {\n // If we haven't found a focusable target, see if the host element contains an element\n // which has a shadowRoot.\n // Recursively search for the first focusable item in shadow roots.\n var elems = hostElement.querySelectorAll('*');\n for (var i = 0; i < elems.length; i++) {\n if (elems[i].tagName && elems[i].shadowRoot) {\n target = findFocusableElementWithin(elems[i].shadowRoot);\n if (target) {\n break;\n }\n }\n }\n }\n return target;\n}\n\n/**\n * Determines if an element is attached to the DOM.\n * @param {Element} element to check\n * @return {boolean} whether the element is in DOM\n */\nfunction isConnected(element) {\n return element.isConnected || document.body.contains(element);\n}\n\n/**\n * @param {!Event} event\n * @return {?Element}\n */\nfunction findFormSubmitter(event) {\n if (event.submitter) {\n return event.submitter;\n }\n\n var form = event.target;\n if (!(form instanceof HTMLFormElement)) {\n return null;\n }\n\n var submitter = dialogPolyfill.formSubmitter;\n if (!submitter) {\n var target = event.target;\n var root = ('getRootNode' in target && target.getRootNode() || document);\n submitter = root.activeElement;\n }\n\n if (!submitter || submitter.form !== form) {\n return null;\n }\n return submitter;\n}\n\n/**\n * @param {!Event} event\n */\nfunction maybeHandleSubmit(event) {\n if (event.defaultPrevented) {\n return;\n }\n var form = /** @type {!HTMLFormElement} */ (event.target);\n\n // We'd have a value if we clicked on an imagemap.\n var value = dialogPolyfill.imagemapUseValue;\n var submitter = findFormSubmitter(event);\n if (value === null && submitter) {\n value = submitter.value;\n }\n\n // There should always be a dialog as this handler is added specifically on them, but check just\n // in case.\n var dialog = findNearestDialog(form);\n if (!dialog) {\n return;\n }\n\n // Prefer formmethod on the button.\n var formmethod = submitter && submitter.getAttribute('formmethod') || form.getAttribute('method');\n if (formmethod !== 'dialog') {\n return;\n }\n event.preventDefault();\n\n if (value != null) {\n // nb. we explicitly check against null/undefined\n dialog.close(value);\n } else {\n dialog.close();\n }\n}\n\n/**\n * @param {!HTMLDialogElement} dialog to upgrade\n * @constructor\n */\nfunction dialogPolyfillInfo(dialog) {\n this.dialog_ = dialog;\n this.replacedStyleTop_ = false;\n this.openAsModal_ = false;\n\n // Set a11y role. Browsers that support dialog implicitly know this already.\n if (!dialog.hasAttribute('role')) {\n dialog.setAttribute('role', 'dialog');\n }\n\n dialog.show = this.show.bind(this);\n dialog.showModal = this.showModal.bind(this);\n dialog.close = this.close.bind(this);\n\n dialog.addEventListener('submit', maybeHandleSubmit, false);\n\n if (!('returnValue' in dialog)) {\n dialog.returnValue = '';\n }\n\n if ('MutationObserver' in window) {\n var mo = new MutationObserver(this.maybeHideModal.bind(this));\n mo.observe(dialog, {attributes: true, attributeFilter: ['open']});\n } else {\n // IE10 and below support. Note that DOMNodeRemoved etc fire _before_ removal. They also\n // seem to fire even if the element was removed as part of a parent removal. Use the removed\n // events to force downgrade (useful if removed/immediately added).\n var removed = false;\n var cb = function() {\n removed ? this.downgradeModal() : this.maybeHideModal();\n removed = false;\n }.bind(this);\n var timeout;\n var delayModel = function(ev) {\n if (ev.target !== dialog) { return; } // not for a child element\n var cand = 'DOMNodeRemoved';\n removed |= (ev.type.substr(0, cand.length) === cand);\n window.clearTimeout(timeout);\n timeout = window.setTimeout(cb, 0);\n };\n ['DOMAttrModified', 'DOMNodeRemoved', 'DOMNodeRemovedFromDocument'].forEach(function(name) {\n dialog.addEventListener(name, delayModel);\n });\n }\n // Note that the DOM is observed inside DialogManager while any dialog\n // is being displayed as a modal, to catch modal removal from the DOM.\n\n Object.defineProperty(dialog, 'open', {\n set: this.setOpen.bind(this),\n get: dialog.hasAttribute.bind(dialog, 'open')\n });\n\n this.backdrop_ = document.createElement('div');\n this.backdrop_.className = 'backdrop';\n this.backdrop_.addEventListener('mouseup' , this.backdropMouseEvent_.bind(this));\n this.backdrop_.addEventListener('mousedown', this.backdropMouseEvent_.bind(this));\n this.backdrop_.addEventListener('click' , this.backdropMouseEvent_.bind(this));\n}\n\ndialogPolyfillInfo.prototype = /** @type {HTMLDialogElement.prototype} */ ({\n\n get dialog() {\n return this.dialog_;\n },\n\n /**\n * Maybe remove this dialog from the modal top layer. This is called when\n * a modal dialog may no longer be tenable, e.g., when the dialog is no\n * longer open or is no longer part of the DOM.\n */\n maybeHideModal: function() {\n if (this.dialog_.hasAttribute('open') && isConnected(this.dialog_)) { return; }\n this.downgradeModal();\n },\n\n /**\n * Remove this dialog from the modal top layer, leaving it as a non-modal.\n */\n downgradeModal: function() {\n if (!this.openAsModal_) { return; }\n this.openAsModal_ = false;\n this.dialog_.style.zIndex = '';\n\n // This won't match the native exactly because if the user set top on a centered\n // polyfill dialog, that top gets thrown away when the dialog is closed. Not sure it's\n // possible to polyfill this perfectly.\n if (this.replacedStyleTop_) {\n this.dialog_.style.top = '';\n this.replacedStyleTop_ = false;\n }\n\n // Clear the backdrop and remove from the manager.\n this.backdrop_.parentNode && this.backdrop_.parentNode.removeChild(this.backdrop_);\n dialogPolyfill.dm.removeDialog(this);\n },\n\n /**\n * @param {boolean} value whether to open or close this dialog\n */\n setOpen: function(value) {\n if (value) {\n this.dialog_.hasAttribute('open') || this.dialog_.setAttribute('open', '');\n } else {\n this.dialog_.removeAttribute('open');\n this.maybeHideModal(); // nb. redundant with MutationObserver\n }\n },\n\n /**\n * Handles mouse events ('mouseup', 'mousedown', 'click') on the fake .backdrop element, redirecting them as if\n * they were on the dialog itself.\n *\n * @param {!Event} e to redirect\n */\n backdropMouseEvent_: function(e) {\n if (!this.dialog_.hasAttribute('tabindex')) {\n // Clicking on the backdrop should move the implicit cursor, even if dialog cannot be\n // focused. Create a fake thing to focus on. If the backdrop was _before_ the dialog, this\n // would not be needed - clicks would move the implicit cursor there.\n var fake = document.createElement('div');\n this.dialog_.insertBefore(fake, this.dialog_.firstChild);\n fake.tabIndex = -1;\n fake.focus();\n this.dialog_.removeChild(fake);\n } else {\n this.dialog_.focus();\n }\n\n var redirectedEvent = document.createEvent('MouseEvents');\n redirectedEvent.initMouseEvent(e.type, e.bubbles, e.cancelable, window,\n e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey,\n e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget);\n this.dialog_.dispatchEvent(redirectedEvent);\n e.stopPropagation();\n },\n\n /**\n * Focuses on the first focusable element within the dialog. This will always blur the current\n * focus, even if nothing within the dialog is found.\n */\n focus_: function() {\n // Find element with `autofocus` attribute, or fall back to the first form/tabindex control.\n var target = this.dialog_.querySelector('[autofocus]:not([disabled])');\n if (!target && this.dialog_.tabIndex >= 0) {\n target = this.dialog_;\n }\n if (!target) {\n target = findFocusableElementWithin(this.dialog_);\n }\n safeBlur(document.activeElement);\n target && target.focus();\n },\n\n /**\n * Sets the zIndex for the backdrop and dialog.\n *\n * @param {number} dialogZ\n * @param {number} backdropZ\n */\n updateZIndex: function(dialogZ, backdropZ) {\n if (dialogZ < backdropZ) {\n throw new Error('dialogZ should never be < backdropZ');\n }\n this.dialog_.style.zIndex = dialogZ;\n this.backdrop_.style.zIndex = backdropZ;\n },\n\n /**\n * Shows the dialog. If the dialog is already open, this does nothing.\n */\n show: function() {\n if (!this.dialog_.open) {\n this.setOpen(true);\n this.focus_();\n }\n },\n\n /**\n * Show this dialog modally.\n */\n showModal: function() {\n if (this.dialog_.hasAttribute('open')) {\n throw new Error('Failed to execute \\'showModal\\' on dialog: The element is already open, and therefore cannot be opened modally.');\n }\n if (!isConnected(this.dialog_)) {\n throw new Error('Failed to execute \\'showModal\\' on dialog: The element is not in a Document.');\n }\n if (!dialogPolyfill.dm.pushDialog(this)) {\n throw new Error('Failed to execute \\'showModal\\' on dialog: There are too many open modal dialogs.');\n }\n\n if (createsStackingContext(this.dialog_.parentElement)) {\n console.warn('A dialog is being shown inside a stacking context. ' +\n 'This may cause it to be unusable. For more information, see this link: ' +\n 'https://github.com/GoogleChrome/dialog-polyfill/#stacking-context');\n }\n\n this.setOpen(true);\n this.openAsModal_ = true;\n\n // Optionally center vertically, relative to the current viewport.\n if (dialogPolyfill.needsCentering(this.dialog_)) {\n dialogPolyfill.reposition(this.dialog_);\n this.replacedStyleTop_ = true;\n } else {\n this.replacedStyleTop_ = false;\n }\n\n // Insert backdrop.\n this.dialog_.parentNode.insertBefore(this.backdrop_, this.dialog_.nextSibling);\n\n // Focus on whatever inside the dialog.\n this.focus_();\n },\n\n /**\n * Closes this HTMLDialogElement. This is optional vs clearing the open\n * attribute, however this fires a 'close' event.\n *\n * @param {string=} opt_returnValue to use as the returnValue\n */\n close: function(opt_returnValue) {\n if (!this.dialog_.hasAttribute('open')) {\n throw new Error('Failed to execute \\'close\\' on dialog: The element does not have an \\'open\\' attribute, and therefore cannot be closed.');\n }\n this.setOpen(false);\n\n // Leave returnValue untouched in case it was set directly on the element\n if (opt_returnValue !== undefined) {\n this.dialog_.returnValue = opt_returnValue;\n }\n\n // Triggering \"close\" event for any attached listeners on the .\n var closeEvent = new supportCustomEvent('close', {\n bubbles: false,\n cancelable: false\n });\n safeDispatchEvent(this.dialog_, closeEvent);\n }\n\n});\n\nvar dialogPolyfill = {};\n\ndialogPolyfill.reposition = function(element) {\n var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;\n var topValue = scrollTop + (window.innerHeight - element.offsetHeight) / 2;\n element.style.top = Math.max(scrollTop, topValue) + 'px';\n};\n\ndialogPolyfill.isInlinePositionSetByStylesheet = function(element) {\n for (var i = 0; i < document.styleSheets.length; ++i) {\n var styleSheet = document.styleSheets[i];\n var cssRules = null;\n // Some browsers throw on cssRules.\n try {\n cssRules = styleSheet.cssRules;\n } catch (e) {}\n if (!cssRules) { continue; }\n for (var j = 0; j < cssRules.length; ++j) {\n var rule = cssRules[j];\n var selectedNodes = null;\n // Ignore errors on invalid selector texts.\n try {\n selectedNodes = document.querySelectorAll(rule.selectorText);\n } catch(e) {}\n if (!selectedNodes || !inNodeList(selectedNodes, element)) {\n continue;\n }\n var cssTop = rule.style.getPropertyValue('top');\n var cssBottom = rule.style.getPropertyValue('bottom');\n if ((cssTop && cssTop !== 'auto') || (cssBottom && cssBottom !== 'auto')) {\n return true;\n }\n }\n }\n return false;\n};\n\ndialogPolyfill.needsCentering = function(dialog) {\n var computedStyle = window.getComputedStyle(dialog);\n if (computedStyle.position !== 'absolute') {\n return false;\n }\n\n // We must determine whether the top/bottom specified value is non-auto. In\n // WebKit/Blink, checking computedStyle.top == 'auto' is sufficient, but\n // Firefox returns the used value. So we do this crazy thing instead: check\n // the inline style and then go through CSS rules.\n if ((dialog.style.top !== 'auto' && dialog.style.top !== '') ||\n (dialog.style.bottom !== 'auto' && dialog.style.bottom !== '')) {\n return false;\n }\n return !dialogPolyfill.isInlinePositionSetByStylesheet(dialog);\n};\n\n/**\n * @param {!Element} element to force upgrade\n */\ndialogPolyfill.forceRegisterDialog = function(element) {\n if (window.HTMLDialogElement || element.showModal) {\n console.warn('This browser already supports , the polyfill ' +\n 'may not work correctly', element);\n }\n if (element.localName !== 'dialog') {\n throw new Error('Failed to register dialog: The element is not a dialog.');\n }\n new dialogPolyfillInfo(/** @type {!HTMLDialogElement} */ (element));\n};\n\n/**\n * @param {!Element} element to upgrade, if necessary\n */\ndialogPolyfill.registerDialog = function(element) {\n if (!element.showModal) {\n dialogPolyfill.forceRegisterDialog(element);\n }\n};\n\n/**\n * @constructor\n */\ndialogPolyfill.DialogManager = function() {\n /** @type {!Array} */\n this.pendingDialogStack = [];\n\n var checkDOM = this.checkDOM_.bind(this);\n\n // The overlay is used to simulate how a modal dialog blocks the document.\n // The blocking dialog is positioned on top of the overlay, and the rest of\n // the dialogs on the pending dialog stack are positioned below it. In the\n // actual implementation, the modal dialog stacking is controlled by the\n // top layer, where z-index has no effect.\n this.overlay = document.createElement('div');\n this.overlay.className = '_dialog_overlay';\n this.overlay.addEventListener('click', function(e) {\n this.forwardTab_ = undefined;\n e.stopPropagation();\n checkDOM([]); // sanity-check DOM\n }.bind(this));\n\n this.handleKey_ = this.handleKey_.bind(this);\n this.handleFocus_ = this.handleFocus_.bind(this);\n\n this.zIndexLow_ = 100000;\n this.zIndexHigh_ = 100000 + 150;\n\n this.forwardTab_ = undefined;\n\n if ('MutationObserver' in window) {\n this.mo_ = new MutationObserver(function(records) {\n var removed = [];\n records.forEach(function(rec) {\n for (var i = 0, c; c = rec.removedNodes[i]; ++i) {\n if (!(c instanceof Element)) {\n continue;\n } else if (c.localName === 'dialog') {\n removed.push(c);\n }\n removed = removed.concat(c.querySelectorAll('dialog'));\n }\n });\n removed.length && checkDOM(removed);\n });\n }\n};\n\n/**\n * Called on the first modal dialog being shown. Adds the overlay and related\n * handlers.\n */\ndialogPolyfill.DialogManager.prototype.blockDocument = function() {\n document.documentElement.addEventListener('focus', this.handleFocus_, true);\n document.addEventListener('keydown', this.handleKey_);\n this.mo_ && this.mo_.observe(document, {childList: true, subtree: true});\n};\n\n/**\n * Called on the first modal dialog being removed, i.e., when no more modal\n * dialogs are visible.\n */\ndialogPolyfill.DialogManager.prototype.unblockDocument = function() {\n document.documentElement.removeEventListener('focus', this.handleFocus_, true);\n document.removeEventListener('keydown', this.handleKey_);\n this.mo_ && this.mo_.disconnect();\n};\n\n/**\n * Updates the stacking of all known dialogs.\n */\ndialogPolyfill.DialogManager.prototype.updateStacking = function() {\n var zIndex = this.zIndexHigh_;\n\n for (var i = 0, dpi; dpi = this.pendingDialogStack[i]; ++i) {\n dpi.updateZIndex(--zIndex, --zIndex);\n if (i === 0) {\n this.overlay.style.zIndex = --zIndex;\n }\n }\n\n // Make the overlay a sibling of the dialog itself.\n var last = this.pendingDialogStack[0];\n if (last) {\n var p = last.dialog.parentNode || document.body;\n p.appendChild(this.overlay);\n } else if (this.overlay.parentNode) {\n this.overlay.parentNode.removeChild(this.overlay);\n }\n};\n\n/**\n * @param {Element} candidate to check if contained or is the top-most modal dialog\n * @return {boolean} whether candidate is contained in top dialog\n */\ndialogPolyfill.DialogManager.prototype.containedByTopDialog_ = function(candidate) {\n while (candidate = findNearestDialog(candidate)) {\n for (var i = 0, dpi; dpi = this.pendingDialogStack[i]; ++i) {\n if (dpi.dialog === candidate) {\n return i === 0; // only valid if top-most\n }\n }\n candidate = candidate.parentElement;\n }\n return false;\n};\n\ndialogPolyfill.DialogManager.prototype.handleFocus_ = function(event) {\n var target = event.composedPath ? event.composedPath()[0] : event.target;\n\n if (this.containedByTopDialog_(target)) { return; }\n\n if (document.activeElement === document.documentElement) { return; }\n\n event.preventDefault();\n event.stopPropagation();\n safeBlur(/** @type {Element} */ (target));\n\n if (this.forwardTab_ === undefined) { return; } // move focus only from a tab key\n\n var dpi = this.pendingDialogStack[0];\n var dialog = dpi.dialog;\n var position = dialog.compareDocumentPosition(target);\n if (position & Node.DOCUMENT_POSITION_PRECEDING) {\n if (this.forwardTab_) {\n // forward\n dpi.focus_();\n } else if (target !== document.documentElement) {\n // backwards if we're not already focused on \n document.documentElement.focus();\n }\n }\n\n return false;\n};\n\ndialogPolyfill.DialogManager.prototype.handleKey_ = function(event) {\n this.forwardTab_ = undefined;\n if (event.keyCode === 27) {\n event.preventDefault();\n event.stopPropagation();\n var cancelEvent = new supportCustomEvent('cancel', {\n bubbles: false,\n cancelable: true\n });\n var dpi = this.pendingDialogStack[0];\n if (dpi && safeDispatchEvent(dpi.dialog, cancelEvent)) {\n dpi.dialog.close();\n }\n } else if (event.keyCode === 9) {\n this.forwardTab_ = !event.shiftKey;\n }\n};\n\n/**\n * Finds and downgrades any known modal dialogs that are no longer displayed. Dialogs that are\n * removed and immediately readded don't stay modal, they become normal.\n *\n * @param {!Array} removed that have definitely been removed\n */\ndialogPolyfill.DialogManager.prototype.checkDOM_ = function(removed) {\n // This operates on a clone because it may cause it to change. Each change also calls\n // updateStacking, which only actually needs to happen once. But who removes many modal dialogs\n // at a time?!\n var clone = this.pendingDialogStack.slice();\n clone.forEach(function(dpi) {\n if (removed.indexOf(dpi.dialog) !== -1) {\n dpi.downgradeModal();\n } else {\n dpi.maybeHideModal();\n }\n });\n};\n\n/**\n * @param {!dialogPolyfillInfo} dpi\n * @return {boolean} whether the dialog was allowed\n */\ndialogPolyfill.DialogManager.prototype.pushDialog = function(dpi) {\n var allowed = (this.zIndexHigh_ - this.zIndexLow_) / 2 - 1;\n if (this.pendingDialogStack.length >= allowed) {\n return false;\n }\n if (this.pendingDialogStack.unshift(dpi) === 1) {\n this.blockDocument();\n }\n this.updateStacking();\n return true;\n};\n\n/**\n * @param {!dialogPolyfillInfo} dpi\n */\ndialogPolyfill.DialogManager.prototype.removeDialog = function(dpi) {\n var index = this.pendingDialogStack.indexOf(dpi);\n if (index === -1) { return; }\n\n this.pendingDialogStack.splice(index, 1);\n if (this.pendingDialogStack.length === 0) {\n this.unblockDocument();\n }\n this.updateStacking();\n};\n\ndialogPolyfill.dm = new dialogPolyfill.DialogManager();\ndialogPolyfill.formSubmitter = null;\ndialogPolyfill.imagemapUseValue = null;\n\n/**\n * Installs global handlers, such as click listers and native method overrides. These are needed\n * even if a no dialog is registered, as they deal with
.\n */\nif (window.HTMLDialogElement === undefined) {\n\n /**\n * If HTMLFormElement translates method=\"DIALOG\" into 'get', then replace the descriptor with\n * one that returns the correct value.\n */\n var testForm = document.createElement('form');\n testForm.setAttribute('method', 'dialog');\n if (testForm.method !== 'dialog') {\n var methodDescriptor = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, 'method');\n if (methodDescriptor) {\n // nb. Some older iOS and older PhantomJS fail to return the descriptor. Don't do anything\n // and don't bother to update the element.\n var realGet = methodDescriptor.get;\n methodDescriptor.get = function() {\n if (isFormMethodDialog(this)) {\n return 'dialog';\n }\n return realGet.call(this);\n };\n var realSet = methodDescriptor.set;\n /** @this {HTMLElement} */\n methodDescriptor.set = function(v) {\n if (typeof v === 'string' && v.toLowerCase() === 'dialog') {\n return this.setAttribute('method', v);\n }\n return realSet.call(this, v);\n };\n Object.defineProperty(HTMLFormElement.prototype, 'method', methodDescriptor);\n }\n }\n\n /**\n * Global 'click' handler, to capture the or