From 76ea839bedebf1db695f2e8be0e86626cfec5505 Mon Sep 17 00:00:00 2001 From: Uriel Gomez Date: Fri, 2 Feb 2024 00:35:01 -0600 Subject: [PATCH] * xover.init.Observer - added parentNode prop to event details * Attr.prototype.matches - added parentNode test to prevent errors --- xo.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xo.js b/xo.js index a623d15..847bc8b 100644 --- a/xo.js +++ b/xo.js @@ -621,7 +621,7 @@ xover.init.Observer = function (target_node = window.document) { //observer.disconnect(); for (let [target, mutation] of mutations) { for (let [attr, oldValue] of Object.values((mutation.attributes || {})[""] || {})) { - window.top.dispatchEvent(new xover.listener.Event('change', { target, value: attr.value, old: oldValue }, attr)); + window.top.dispatchEvent(new xover.listener.Event('change', { target, value: attr.value, old: oldValue, parentNode: (attr.parentNode || target) }, attr)); } if (mutation.removedNodes.length && mutation.addedNodes.length) { let replace_event = new xover.listener.Event('replaceChildren', { addedNodes: mutation.addedNodes, removedNodes: mutation.removedNodes }, target); @@ -8958,7 +8958,7 @@ xover.modernize = async function (targetWindow) { let remove; let observer = (this.ownerDocument || this).observer; - if (!this.ownerElement) { + if (!this.ownerElement && this.parentNode) { //this.ownerDocument.disconnect(0); Element.native.setAttributeNode.call(this.parentNode, this); remove = true;