Incorrect target reported in all MutationRecords of type `childList`
Running this code:
import { parseHTML } from "linkedom";
const { document, MutationObserver } = parseHTML(
"<!doctype html><html><head></head><body>",
);
let mo = new MutationObserver((records) => {
let { nodeName } = records[0].target;
console.assert(nodeName === "BODY", `Expected BODY, got ${nodeName}.`);
});
mo.observe(document, { subtree: true, childList: true });
document.body.appendChild(document.createTextNode(""));
results in this error:
Assertion failed: Expected BODY, got #document.
If I'm reading it correctly, it looks like the target for a mutation is always reported as the node passed to observe (at least for childList) which is incorrect; for the childList MutationRecord type, the target should be the parentNode of the inserted/removed node(s).
it looks to me you're capable of landing MRs on that esm folder by now ... I am really sorry but I am not using this project daily and I am not using this project for my current daily tasks so that if you need speedy changes in here, you better go ahead and file a PR where I can spend the "non-existent-time" I have for non related tasks these days ... if that works for you, I can try helping out with directions around how to proceed with tests too, so that coverage keeps being useful. I did ask for help in here stating I don't have time needed to keep this updated, but one of the main possible candidates to take it over disappeared 🤷\
edit see https://github.com/WebReflection/linkedom/issues/300#issuecomment-2648550569
I totally understand, will take a look to see if I can figure out a reliable way of reflecting the correct target.
mandatory context needed in here too: https://github.com/WebReflection/linkedom/issues/247
relevant up to its latest comment: https://github.com/WebReflection/linkedom/issues/247#issuecomment-1904087838