Commit a5c81134 authored by Matthieu Fesselier's avatar Matthieu Fesselier

Merge branch 'fix/dialog-polyfill' into 'master'

bugfix: dialog polyfill

Closes #40

See merge request !25
parents 6081040d 280400fe
Pipeline #4064 passed with stage
in 27 seconds
......@@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>SIB test: sib-router</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/GoogleChrome/dialog-polyfill@master/dist/dialog-polyfill.css">
<script type="module" src="../src/index.js"></script>
<style>
sib-router {
......
import dialogPolyfill from 'https://cdn.jsdelivr.net/gh/GoogleChrome/dialog-polyfill@master/index.js'
export default class SIBRoute extends HTMLElement {
constructor() {
super();
......@@ -80,10 +81,8 @@ export default class SIBRoute extends HTMLElement {
}
}
activate(keepURL=false) {
if (
'HTMLDialogElement' in window &&
this.view instanceof window.HTMLDialogElement
) {
if (this.view.tagName === 'DIALOG') {
dialogPolyfill.registerDialog(this.view)
if (!this.view.hasAttribute('open')) {
this.view.showModal();
}
......@@ -95,11 +94,11 @@ export default class SIBRoute extends HTMLElement {
if (!keepURL) this.updateSubRouters();
}
hide() {
if (
'HTMLDialogElement' in window &&
this.view instanceof window.HTMLDialogElement
) {
this.view.close();
if (this.view.tagName === 'DIALOG') {
dialogPolyfill.registerDialog(this.view)
if (this.view.hasAttribute('open')) {
this.view.close();
}
} else {
this.view.setAttribute('hidden', '');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment