Fix notification issues

This commit is contained in:
varjolintu 2021-12-08 17:05:58 +02:00
parent e27115a894
commit 3663c3cf00
2 changed files with 10 additions and 1 deletions

View file

@ -230,6 +230,10 @@ kpxcUI.createNotification = function(type, message) {
const styleSheet = createStylesheet('css/notification.css');
notificationWrapper = notificationWrapper || document.createElement('div');
this.shadowRoot = notificationWrapper.attachShadow({ mode: 'closed' });
if (!this.shadowRoot) {
return;
}
this.shadowRoot.append(styleSheet);
this.shadowRoot.append(notification);
document.body.append(notificationWrapper);
@ -325,7 +329,11 @@ Element.prototype.getLowerCaseAttribute = function(attr) {
Element.prototype._attachShadow = Element.prototype.attachShadow;
Element.prototype.attachShadow = function () {
return this._attachShadow({ mode: 'closed' });
try {
return this._attachShadow({ mode: 'closed' });
} catch (e) {
console.log('Error: ', e);
}
};
Object.prototype.shadowSelector = function(value) {

View file

@ -127,6 +127,7 @@
"css/button.css",
"css/colors.css",
"css/define.css",
"css/notification.css",
"css/pwgen.css",
"css/username.css",
"css/totp.css"