gpt4 book ai didi

javascript - 没有 namespaceURI 的文档的 Document.evaluate 崩溃 Microsoft Edge

转载 作者:数据小太阳 更新时间:2023-10-29 01:55:54 24 4
gpt4 key购买 nike

在 Windows 10 版本 10240 的 Microsoft Edge 上测试。已在版本 10586 中修复。

概要

namespaceURI 设置为 null 的文档上运行 XMLDocument.prototype.evaluate 会使 Microsoft Edge 中的当前选项卡进程崩溃,留下该选项卡的开发人员工具无响应,将调试信息发送到 watson.telemetry.microsoft.com,然后强制重新加载页面。

复制

要重现,请在 Microsoft Edge 中打开任何网站,按 F12 打开开发人员工具,选择控制台,然后运行以下 3 行 javascript:

var doc = document.implementation.createDocument(null, null, null);
var node = doc.createElement('A');
doc.evaluate('B', node, doc.createNSResolver(doc), 9, null);

最佳答案

解决方法

在运行 evaluate 之前访问上下文节点的 baseURI 属性。

var doc = document.implementation.createDocument(null, null, null);
var node = doc.createElement('A');

node.baseURI; // Edge workaround http://stackoverflow.com/q/33887400/823663

doc.evaluate('B', node, doc.createNSResolver(doc), 9, null);

关于javascript - 没有 namespaceURI 的文档的 Document.evaluate 崩溃 Microsoft Edge,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33887400/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com