Comparing version 1.1.1 to 1.1.2
@@ -37,2 +37,3 @@ /*! Copyright (c) 2016 Ayogo Health Inc. | ||
var DIALOG_STYLES = [ | ||
'dialog-sentinel,', | ||
'[hidden] {', | ||
@@ -283,2 +284,3 @@ ' display: none;', | ||
var backdrop = null; | ||
var sentinel = null; | ||
@@ -307,3 +309,4 @@ // Set the aria-role to dialog (even if natively supported) | ||
el.showModal = function(anchor) { | ||
restoreScroll = blockScrolling(); | ||
var offset = getScrollOffset(); | ||
restoreScroll = blockScrolling(offset); | ||
dialogStack.push(el); | ||
@@ -416,3 +419,5 @@ | ||
if (wasOpen && parentNode && parentNode !== el.parentNode) { | ||
parentNode.appendChild(el); | ||
parentNode.insertBefore(el, sentinel); | ||
parentNode.removeChild(sentinel); | ||
sentinel = null; | ||
} | ||
@@ -475,2 +480,7 @@ } | ||
if (!sentinel) { | ||
sentinel = $window.document.createElement('dialog-sentinel'); | ||
parentNode.insertBefore(sentinel, el); | ||
} | ||
if (!backdrop) { | ||
@@ -603,2 +613,10 @@ backdrop = $window.document.createElement('div'); | ||
var mo = new MutationObserver(function(evt) { | ||
if (sentinel && !$window.document.body.contains(sentinel)) { | ||
doClose(); | ||
} | ||
}); | ||
mo.observe($window.document.body, { childList: true, subtree: true }); | ||
// Do some cleanup when the element is removed from the DOM | ||
@@ -615,2 +633,4 @@ $element.on('$destroy', function() { | ||
mo.disconnect(); | ||
el.removeEventListener('close', doClose); | ||
@@ -617,0 +637,0 @@ el.removeEventListener('cancel', handleCancel); |
{ | ||
"name": "ay-dialog", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"copyright": "Copyright 2016 Ayogo Health Inc.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
565
27064
7