mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Fix createObserver() check (#2873)
This commit is contained in:
parent
b01af22fd1
commit
02a3e441ba
1 changed files with 8 additions and 2 deletions
|
|
@ -13,6 +13,12 @@ const ORANGE_BUTTON = 'kpxc-button kpxc-orange-button';
|
|||
const RED_BUTTON = 'kpxc-button kpxc-red-button';
|
||||
const GRAY_BUTTON_CLASS = 'kpxc-gray-button';
|
||||
|
||||
const ALLOWED_OBSERVER_NODETYPES = [
|
||||
Node.ELEMENT_NODE,
|
||||
Node.DOCUMENT_NODE,
|
||||
Node.DOCUMENT_FRAGMENT_NODE
|
||||
];
|
||||
|
||||
const OBSERVER_OPTIONS = { attributes: true, attributeFilter: [ 'style' ] };
|
||||
|
||||
const DatabaseState = {
|
||||
|
|
@ -263,10 +269,10 @@ kpxcUI.createPageObserver = function() {
|
|||
}
|
||||
});
|
||||
|
||||
if (document?.documentElement) {
|
||||
if (document?.documentElement && ALLOWED_OBSERVER_NODETYPES.includes(document.documentElement.nodeType)) {
|
||||
kpxcUI.pageObserver.observe(document.documentElement, OBSERVER_OPTIONS);
|
||||
}
|
||||
if (document?.body) {
|
||||
if (document?.body && ALLOWED_OBSERVER_NODETYPES.includes(document.body.nodeType)) {
|
||||
kpxcUI.pageObserver.observe(document.body, OBSERVER_OPTIONS);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue