chromeV.48后版本移除方法SVGGraphicsElement.getTransformToElement后的处理

项目中使用ueditor的嵌入公式插件kity formula,今天突然发现chrome运行报错,错误如下:


查找资料发现:使用Chrome(版本v.48)浏览器才具有该异常情况,表现为图形界面报错,不能正常使用,我的浏览器版本为v.49.

原因:

Chrome v.48的版本进行更新,其中一条更新内容如下:

原文如下:SVGGraphicsElement.getTransformToElement has been removed to match the SVG spec.

意思是移除了 SVGGraphicsElement.getTransformToElement,以符合 SVG 规范。

地址:http://blog.chromium.org/2015/12/chrome-48-beta-present-to-cast-devices_91.html


处理办法:

在源码中补充以下代码:

SVGElement.prototype.getTransformToElement = SVGElement.prototype.getTransformToElement || function(toElement) {
    return toElement.getScreenCTM().inverse().multiply(this.getScreenCTM());
};
如下图:



保存后清除缓存,刷新错误消失。



版权声明:本文为jiangtongcn原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。