intact-react
Advanced tools
Comparing version 3.0.23 to 3.0.24
@@ -116,3 +116,3 @@ 'use strict'; | ||
reactDom.render(react.createElement('template'), container, function () { | ||
dom.removeChild(this); | ||
// dom.removeChild(this); | ||
dom.removeChild(container); | ||
@@ -373,24 +373,45 @@ }); | ||
var removeChild_1 = parentElement.removeChild; | ||
parentElement.removeChild = function (child) { | ||
if (child.parentNode) { | ||
parentElement.removeChild = function (child, directly) { | ||
if (child.nodeType === 8 && child.nodeValue === containerComment) { | ||
removeChild_1.call(parentElement, child._realElement); | ||
removeChild_1.call(parentElement, child); | ||
var realElement = child._realElement; | ||
if (realElement) { | ||
child._realElement = null; | ||
realElement._mountPoint = null; | ||
} | ||
child._realElement = null; | ||
return; | ||
} | ||
else { | ||
/* istanbul ignore next */ | ||
{ | ||
if (!child._mountPoint) { | ||
throw new Error('Cannot remove the node. Maybe it is a bug of intact-react.'); | ||
} | ||
} | ||
if (directly || !child._mountPoint) { | ||
removeChild_1.call(parentElement, child); | ||
return; | ||
} | ||
if (!child.parentNode) { | ||
// if the node has been removed, then remove the mount point | ||
var container = child._mountPoint; | ||
removeChild_1.call(parentElement, container); | ||
removeChild_1.call(parentElement, child._mountPoint); | ||
child._mountPoint = null; | ||
container._realElement = null; | ||
return; | ||
} | ||
if (child._deleted) { | ||
removeChild_1.call(parentElement, child._mountPoint); | ||
removeChild_1.call(parentElement, child); | ||
child._mountPoint = null; | ||
return; | ||
} | ||
child._deleted = true; | ||
// if (child.parentNode) { | ||
// removeChild.call(parentElement, child); | ||
// const realElement = (child as any)._realElement | ||
// if (realElement) { | ||
// (child as any)._realElement = null; | ||
// realElement._mountPoint = null; | ||
// } | ||
// } else { | ||
// if ("development" !== 'production') { | ||
// if (!child._mountPoint) { | ||
// throw new Error('Cannot remove the node. Maybe it is a bug of intact-react.'); | ||
// } | ||
// } | ||
// // if the node has been removed, then remove the mount point | ||
// const container = child._mountPoint!; | ||
// removeChild.call(parentElement, container); | ||
// child._mountPoint = null; | ||
// (container as any)._realElement = null; | ||
// } | ||
}; | ||
@@ -903,3 +924,3 @@ var insertBefore_1 = parentElement.insertBefore; | ||
function handleElementOnMounted(parentElement, placeholder, element) { | ||
parentElement.removeChild(placeholder); | ||
parentElement.removeChild(placeholder, true); | ||
updateElementOnUpdated(element, placeholder); | ||
@@ -906,0 +927,0 @@ } |
@@ -109,3 +109,3 @@ 'use strict'; | ||
reactDom.render(react.createElement('template'), container, function () { | ||
dom.removeChild(this); | ||
// dom.removeChild(this); | ||
dom.removeChild(container); | ||
@@ -366,18 +366,45 @@ }); | ||
var removeChild_1 = parentElement.removeChild; | ||
parentElement.removeChild = function (child) { | ||
if (child.parentNode) { | ||
parentElement.removeChild = function (child, directly) { | ||
if (child.nodeType === 8 && child.nodeValue === containerComment) { | ||
removeChild_1.call(parentElement, child._realElement); | ||
removeChild_1.call(parentElement, child); | ||
var realElement = child._realElement; | ||
if (realElement) { | ||
child._realElement = null; | ||
realElement._mountPoint = null; | ||
} | ||
child._realElement = null; | ||
return; | ||
} | ||
else { | ||
if (directly || !child._mountPoint) { | ||
removeChild_1.call(parentElement, child); | ||
return; | ||
} | ||
if (!child.parentNode) { | ||
// if the node has been removed, then remove the mount point | ||
var container = child._mountPoint; | ||
removeChild_1.call(parentElement, container); | ||
removeChild_1.call(parentElement, child._mountPoint); | ||
child._mountPoint = null; | ||
container._realElement = null; | ||
return; | ||
} | ||
if (child._deleted) { | ||
removeChild_1.call(parentElement, child._mountPoint); | ||
removeChild_1.call(parentElement, child); | ||
child._mountPoint = null; | ||
return; | ||
} | ||
child._deleted = true; | ||
// if (child.parentNode) { | ||
// removeChild.call(parentElement, child); | ||
// const realElement = (child as any)._realElement | ||
// if (realElement) { | ||
// (child as any)._realElement = null; | ||
// realElement._mountPoint = null; | ||
// } | ||
// } else { | ||
// if ("production" !== 'production') { | ||
// if (!child._mountPoint) { | ||
// throw new Error('Cannot remove the node. Maybe it is a bug of intact-react.'); | ||
// } | ||
// } | ||
// // if the node has been removed, then remove the mount point | ||
// const container = child._mountPoint!; | ||
// removeChild.call(parentElement, container); | ||
// child._mountPoint = null; | ||
// (container as any)._realElement = null; | ||
// } | ||
}; | ||
@@ -877,3 +904,3 @@ var insertBefore_1 = parentElement.insertBefore; | ||
function handleElementOnMounted(parentElement, placeholder, element) { | ||
parentElement.removeChild(placeholder); | ||
parentElement.removeChild(placeholder, true); | ||
updateElementOnUpdated(element, placeholder); | ||
@@ -880,0 +907,0 @@ } |
@@ -113,3 +113,3 @@ import { __spreadArray, __assign, __extends } from 'tslib'; | ||
render(createElement('template'), container, function () { | ||
dom.removeChild(this); | ||
// dom.removeChild(this); | ||
dom.removeChild(container); | ||
@@ -370,24 +370,45 @@ }); | ||
var removeChild_1 = parentElement.removeChild; | ||
parentElement.removeChild = function (child) { | ||
if (child.parentNode) { | ||
parentElement.removeChild = function (child, directly) { | ||
if (child.nodeType === 8 && child.nodeValue === containerComment) { | ||
removeChild_1.call(parentElement, child._realElement); | ||
removeChild_1.call(parentElement, child); | ||
var realElement = child._realElement; | ||
if (realElement) { | ||
child._realElement = null; | ||
realElement._mountPoint = null; | ||
} | ||
child._realElement = null; | ||
return; | ||
} | ||
else { | ||
/* istanbul ignore next */ | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (!child._mountPoint) { | ||
throw new Error('Cannot remove the node. Maybe it is a bug of intact-react.'); | ||
} | ||
} | ||
if (directly || !child._mountPoint) { | ||
removeChild_1.call(parentElement, child); | ||
return; | ||
} | ||
if (!child.parentNode) { | ||
// if the node has been removed, then remove the mount point | ||
var container = child._mountPoint; | ||
removeChild_1.call(parentElement, container); | ||
removeChild_1.call(parentElement, child._mountPoint); | ||
child._mountPoint = null; | ||
container._realElement = null; | ||
return; | ||
} | ||
if (child._deleted) { | ||
removeChild_1.call(parentElement, child._mountPoint); | ||
removeChild_1.call(parentElement, child); | ||
child._mountPoint = null; | ||
return; | ||
} | ||
child._deleted = true; | ||
// if (child.parentNode) { | ||
// removeChild.call(parentElement, child); | ||
// const realElement = (child as any)._realElement | ||
// if (realElement) { | ||
// (child as any)._realElement = null; | ||
// realElement._mountPoint = null; | ||
// } | ||
// } else { | ||
// if (process.env.NODE_ENV !== 'production') { | ||
// if (!child._mountPoint) { | ||
// throw new Error('Cannot remove the node. Maybe it is a bug of intact-react.'); | ||
// } | ||
// } | ||
// // if the node has been removed, then remove the mount point | ||
// const container = child._mountPoint!; | ||
// removeChild.call(parentElement, container); | ||
// child._mountPoint = null; | ||
// (container as any)._realElement = null; | ||
// } | ||
}; | ||
@@ -900,3 +921,3 @@ var insertBefore_1 = parentElement.insertBefore; | ||
function handleElementOnMounted(parentElement, placeholder, element) { | ||
parentElement.removeChild(placeholder); | ||
parentElement.removeChild(placeholder, true); | ||
updateElementOnUpdated(element, placeholder); | ||
@@ -903,0 +924,0 @@ } |
{ | ||
"name": "intact-react", | ||
"version": "3.0.23", | ||
"version": "3.0.24", | ||
"description": "A compatibility layer for running intact component in React@17", | ||
@@ -32,6 +32,6 @@ "main": "index.js", | ||
"dependencies": { | ||
"intact": "^3.0.23", | ||
"intact-shared": "^3.0.23", | ||
"intact": "^3.0.24", | ||
"intact-shared": "^3.0.24", | ||
"tslib": "^2.3.1" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1043586
24649
6
Updatedintact@^3.0.24
Updatedintact-shared@^3.0.24