【问题标题】:textArea SVG element not appearing in FireFoxtextArea SVG 元素未出现在 FireFox 中
【发布时间】:2019-03-19 05:50:14
【问题描述】:

我正在尝试自动换行,因为我不会提前知道文本是什么。

我尝试使用this 问题中接受的答案,但没有任何显示。到目前为止,这是我的示例代码:

  <svg id="viz" style="margin:auto; position:fixed; height:100%; width:100%;" xmlns="http://www.w3.org/2000/svg">
      <switch>
          <g requiredFeatures="http://www.w3.org/Graphics/SVG/feature/1.2/#TextFlow">
              <textArea width="200" height="300">whatever</textArea>
          </g>
          <foreignObject width="200" height="300">
              <textArea xmlns="http://www.w3.org/1999/xhtml" style="width: 200px;height: 300px">otherwise</textArea>
          </foreignObject>
      </switch>
  </svg>

我在 FireFox 中渲染这个 SVG(因为它是网页的一部分)。

【问题讨论】:

    标签: svg


    【解决方案1】:

    Firefox 实现了 SVG 2 的某些部分,dropping support for requiredFeatures 是它已经实现的 SVG 2 的一部分。

    以前的 SVG 版本包括第三个条件处理属性 requiredFeatures。这旨在允许作者为仅实现部分 SVG 规范的用户代理提供回退行为。不幸的是,该属性的规范和实现不佳使其无法作为功能支持的测试。

    这意味着当我写下另一个问题的答案时,开关的第一部分现在适用,但它没有。答案是移除开关和第一个元素,因为没有人再实现 SVG 1.2 textArea。

    <svg id="viz" style="margin:auto; position:fixed; height:100%; width:100%;" xmlns="http://www.w3.org/2000/svg">
              <foreignObject width="200" height="300">
                  <textArea xmlns="http://www.w3.org/1999/xhtml" style="width: 200px;height: 300px">otherwise</textArea>
              </foreignObject>
      </svg>

    【讨论】:

    • 啊,原来那不是我想要的textArea。不过谢谢。
    猜你喜欢
    • 2015-02-17
    • 1970-01-01
    • 2019-11-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-02
    • 1970-01-01
    相关资源
    最近更新 更多