2

w3cvalidator で自分のサイトをチェックしながら

このエラーAttribute data-ls not allowed on svg element at this pointEnd tag svg did not match the name of the current open element (use) を示しています。

ここに私が使用したサンプルコードがあります。

<svg class="ls-l" style="top:320px;left:30%;white-space: nowrap;" 
    data-ls="offsetxin:-15; offsetyin:10; delayin:6854; offsetxout:-15; offsetyout:10; durationout:500; showuntil:1000; easingout:easeInOutQuart; scalexin:0; scaleyin:0; scalexout:0; scaleyout:0;" 
    width="50" height="50" viewBox="0 0 64 64" >
    <use xlink:href="#location-pin">
</svg>

ありがとう....

4

1 に答える 1

2

data- 属性は、getAttribute および setAttribute を使用して取得および設定できる svg に対して厳密には有効ではありませんが、htmlデータ属性 APIは使用できないため、警告が表示されます。

xmlns:ls="<something appropriate for you>"通常の XML の方法は、カスタム名前空間を宣言し、その名前空間に属性を持たせることですls:<something>="offsetxin..."getAttributeNS

問題は、タグ<use>を閉じないことです。または<use>のように書く必要があります<use/><use></use>

于 2014-09-25T09:16:34.003 に答える