我正在使用 svg#text 功能的项目。
我使用以下代码段检查了它
document.implementation.hasFeature(
"http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1");
它回来了 true
但是当我尝试以下代码段时,
document.implementation.hasFeature(
"http://www.w3.org/TR/SVG11/feature#Text", "1.1");
我得到false
.
我遇到的更多事情是 chrometrue
在每种情况下都会返回,为什么?例如。
document.implementation.hasFeature(
"http://www.w3.org/TR/SVG11/feature#BlaBlaXYZ", "1.1");
现在,这也将返回true
在chrome
。
[编辑]以下示例在旧版 Firefox 浏览器中不起作用
<svg id="main_svg" xmlns="http://www.w3.org/2000/svg" style="position:absolute;left:0;top:0;z-index:1;pointer-events:none;height:512px;width:512px">
<text id="abc" font-family="sans-serif" font-size="10pt">
<tspan id="xyz" x="510" y="243" text-anchor="end" fill="blue">foo</tspan>
<tspan id="xyz_sh" x="509" y="242" text-anchor="end" fill="white">another foo</tspan>
<text>
<svg>
hasFeature 不久前已被弃用。为了减轻人们不使用它的迁移,它仍然存在(一段时间),但无论输入参数如何,它都应该始终返回 true。
Chrome、Firefox 和 Edge 始终返回 true。
hasFeature 从来都不够细化。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句