fix: 修复通过appendChild添加的外部脚本中使用document.body.removeChild移除脚本报错阻塞代码执行的问题 #839
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
npm run test
通过详细描述
一些第三方库内部会使用
这种形式关联自己的脚本资源,但由于wujie劫持了子应用的Node.prototype.appendChild并改变了脚本的实际执行环境,所以在removeChild的时候会报错阻塞脚本执行。
所以添加了对子应用removeChild的劫持,在调用时判断目标Node是否还与Document连接,并尝试使用Node.parentNode.removeChild进行移除。
高德地图在子应用中轨迹回放时报removeChild异常 #524