当您更改指针事件时,Svg texpath 在 firefox 中消失

Svg texpath disappears in firefox when you change pointer events

document.getElementById('frame-5416779E-782A-462E-AEC1-2FBCA08DAF42').onmouseover = function(){
        this.style.pointerEvents = 'all';
    };
<div id="frame-5416779E-782A-462E-AEC1-2FBCA08DAF42">
  <svg style="width: 437.953px; height: 45.7323px; overflow:visible;" viewBox="0 0 437.9527559055118 45.73228346456693">
    <text width="100%" height="100%">
        <textPath width="100%" height="100%" href="#00d08f3b-2fa0-485e-acb6-f59b8384bbd4">
            <tspan xmlns="http://ns.adobe.com/textLayout/2008" color="#b49d5b" fontsize="11">TEST</tspan> 
        </textPath>
    </text>
    <path id="00d08f3b-2fa0-485e-acb6-f59b8384bbd4" d="M0 10 L 100 10" stroke="transparent" stroke-width="0px" fill="transparent"></path>
  </svg>
</div>

这在所有浏览器中都有效,如果您将鼠标悬停在“TEST”指针事件上并且没有任何反应。 如果你在 firefox 中做同样的事情,文本就会消失。

现在奇怪的部分...如果您转到元素检查器并切换 svg 的溢出 css .. 它会神奇地重新出现。

这是 firefox 中的错误吗?任何解决方法? 我必须能够 on/off 可编辑 svg 元素的指针事件(这只是整体的一小部分)

这是 Firefox 中的错误。现在已经修复,修复将出现在 Firefox 87 中。

与此同时,这里有一个解决方法。与其将路径设置为透明,不如将其设为 <defs> 元素的子元素。

我也删除了一些其他无意义的属性。

document.getElementById('frame-5416779E-782A-462E-AEC1-2FBCA08DAF42').onmouseover = function(){
        this.style.pointerEvents = 'all';
    };
<div id="frame-5416779E-782A-462E-AEC1-2FBCA08DAF42">
  <svg style="width: 437.953px; height: 45.7323px; overflow:visible;" viewBox="0 0 437.9527559055118 45.73228346456693">
    <text>
        <textPath href="#00d08f3b-2fa0-485e-acb6-f59b8384bbd4">
            <tspan xmlns="http://ns.adobe.com/textLayout/2008" color="#b49d5b" fontsize="11">TEST</tspan> 
        </textPath>
    </text>
    <defs>
        <path id="00d08f3b-2fa0-485e-acb6-f59b8384bbd4" d="M0 10 L 100 10"/>
    </defs>
  </svg>
</div>