javascript - Javascript Chrome 被污染的画布可能无法导出,但 firefox 没有错误
问题描述
SVG图像将画布转换为png但chrome浏览器出错:可能无法导出受污染的画布但Firefox没有错误并且图像保存和下载。我的 svg 对象:
我认为错误源可能是foreignobject。因为我删除了这个对象,chrome不是错误。它必须留在svg里面
<svg xmlns="http://www.w3.org/2000/svg" id="drawcontentssvg" width="410" height="230" viewBox="-100 -70 410 230">
<defs><filter x="0" y="0" width="1" height="1" id="dhx_text_background">
<feFlood flood-color="white"></feFlood>
<feComposite in="SourceGraphic"></feComposite>
</filter></defs>
<g id="shapeImg" shape-rendering="crispedges">
<g transform="translate(0,0) rotate(0,105,45)" dhx_id="1">
<rect class="dhx_item_shape" id="1" height="90" width="210" fill="white" rx="1" ry="1" stroke="#FF9800" stroke-width="1"></rect>
<foreignObject overflow="hidden" transform="translate(0 0)" width="210" height="90"><div class="shape_content" style="height: 90px;">
<div style="text-align: center; overflow: hidden; text-overflow: ellipsis; font-weight: 500; color: rgba(0, 0, 0, 0.38); font-size: 14px; line-height: 17px; margin-top: 25px; white-space: nowrap; text-transform: uppercase;">fsfsfsfsf</div>
<div style="text-align: center;"></div></div>
</foreignObject>
<rect height="3.5" width="210" stroke="#FF9800" fill="#FF9800" stroke-width="1"></rect>
</g>
</g>
</svg>
解决方案
推荐阅读
- python - pyparsing 如何使用 infixNotation 来表示 iif(cond, if true, if false)
- python-2.7 - 如何在 Google App Engine 上的 django 模板中获取 PolyModel 类名?
- android - 如何获取存储在列表中的对象的属性
- vue.js - 在 vue.js Web 组件目标中使用 Vuetify 版本的 material-icons
- python - 从多个获取链接
- 同班
- python - 如何调用上下文管理器忽略产生的值(一行)?
- javascript - 无法读取 Javascript 中未定义错误消息的属性“长度”
- python-3.x - 烧瓶名称错误:未定义名称“用户”
- javascript - 在函数javascript中遇到True false statements,有什么意义?
- javascript - 每次遇到异常时如何继续循环并在完成时中断?