Bing 地图与 MooTools 不兼容
Bing Maps incompatibility with MooTools
我有一个使用 MooTools 的现有项目,我想向其添加 Bing 地图。但是,我发现 MooTools 会破坏 Bing 地图。我有点不知道如何解决这个问题。 Here 是一个显示问题的 jsfiddle。如果您在单击 运行 按钮时查看控制台,您会看到 Bing 抛出异常
Uncaught TypeError: n.open is not a function
如果您随后禁用 MooTools,并再次点击 运行,您将看到地图出现在结果窗格中。
我该如何克服这个问题?这是错误吗?--在 Bing 或 MooTools 中?
我现有的项目使用的是 MooTools 1.3.2,但即使在 1.6.0 中也会出现此问题。
原来 MooTools breaks Bing Maps API loading since it extends Element
object with send
method:
Element.implement({
send: function(url){
var sender = this.get('send');
sender.send({data: this, url: url || sender.options.url});
return this;
}
});
Bing 地图库在内部依赖于用于加载补充库文件的相同方法。 `
解决方法 将删除 MooTools
特定方法:
delete Element.prototype.send;
演示:plunker
我有一个使用 MooTools 的现有项目,我想向其添加 Bing 地图。但是,我发现 MooTools 会破坏 Bing 地图。我有点不知道如何解决这个问题。 Here 是一个显示问题的 jsfiddle。如果您在单击 运行 按钮时查看控制台,您会看到 Bing 抛出异常
Uncaught TypeError: n.open is not a function
如果您随后禁用 MooTools,并再次点击 运行,您将看到地图出现在结果窗格中。
我该如何克服这个问题?这是错误吗?--在 Bing 或 MooTools 中?
我现有的项目使用的是 MooTools 1.3.2,但即使在 1.6.0 中也会出现此问题。
原来 MooTools breaks Bing Maps API loading since it extends Element
object with send
method:
Element.implement({
send: function(url){
var sender = this.get('send');
sender.send({data: this, url: url || sender.options.url});
return this;
}
});
Bing 地图库在内部依赖于用于加载补充库文件的相同方法。 `
解决方法 将删除 MooTools
特定方法:
delete Element.prototype.send;
演示:plunker