Skip to content

Commit

Permalink
fix: remove dom manipulation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey committed Sep 23, 2024
1 parent 11dd01c commit cfff311
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 37 deletions.
7 changes: 7 additions & 0 deletions .changeset/wise-sloths-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@marko/translator-default": patch
"@marko/compiler": patch
"marko": patch
---

Removes the debug mode dom manipulation warning since chrome dropped the api's that allowed us to get useful stack traces.
Original file line number Diff line number Diff line change
Expand Up @@ -140,33 +140,6 @@ function addComponentRootToKeyedElements(
}
}

// eslint-disable-next-line no-constant-condition
if ("MARKO_DEBUG") {
var warnNodeRemoved = function (event) {
var fragment = event.target.fragment;
if (fragment) {
var baseError = new Error(
"Fragment boundary marker removed. This will cause an error when the fragment is updated."
);
fragment.___markersRemovedError = function (message) {
var error = new Error(message + " Boundary markers missing.");

baseError.stack = baseError.stack.replace(/.*warnNodeRemoved.*\n/, "");


console.warn(baseError);
return error;
};
}
};
exports.___startDOMManipulationWarning = function (host) {
host.addEventListener("DOMNodeRemoved", warnNodeRemoved);
};
exports.___stopDOMManipulationWarning = function (host) {
host.removeEventListener("DOMNodeRemoved", warnNodeRemoved);
};
}

exports.___runtimeId = runtimeId;
exports.___componentLookup = componentLookup;
exports.___getComponentForEl = getComponentForEl;
Expand Down
10 changes: 0 additions & 10 deletions packages/marko/src/runtime/vdom/morphdom/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -708,11 +708,6 @@ function morphdom(fromNode, toNode, host, componentsContext) {
}
} // END: morphEl(...)

// eslint-disable-next-line no-constant-condition
if ("MARKO_DEBUG") {
componentsUtil.___stopDOMManipulationWarning(host);
}

morphChildren(fromNode, toNode, toNode.___component);

detachedNodes.forEach(function (node) {
Expand All @@ -736,11 +731,6 @@ function morphdom(fromNode, toNode, host, componentsContext) {
}
}
});

// eslint-disable-next-line no-constant-condition
if ("MARKO_DEBUG") {
componentsUtil.___startDOMManipulationWarning(host);
}
}

module.exports = morphdom;

0 comments on commit cfff311

Please sign in to comment.