SVG 言語における要素に直接対応する SVG DOM インタフェースのすべては、SVGElement
インタフェースから派生しています。
<div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="https://developer.mozilla.org/ja/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="https://developer.mozilla.org/ja/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Node</text></a><polyline points="226,25 236,20 236,30 226,25" stroke="#D4DDE4" fill="none"/><line x1="236" y1="25" x2="266" y2="25" stroke="#D4DDE4"/><a xlink:href="https://developer.mozilla.org/ja/docs/Web/API/Element" target="_top"><rect x="266" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="303.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Element</text></a><polyline points="341,25 351,20 351,30 341,25" stroke="#D4DDE4" fill="none"/><line x1="351" y1="25" x2="381" y2="25" stroke="#D4DDE4"/><a xlink:href="https://developer.mozilla.org/ja/docs/Web/API/SVGElement" target="_top"><rect x="381" y="1" width="100" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="431" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">SVGElement</text></a></svg></div>
a:hover text { fill: #0095DD; pointer-events: all;}
属性
SVGElement.dataset
読取専用- 要素に付与されたカスタム・データ属性に対応する名前つきデータ属性の、キーと値の対のリストを与える、
DOMStringMap
オブジェクトです。data-*
の形の属性を使って、これらの対を SVG で定義することもでき、ここで*
は、その対のキーの名前です。これは、HTML のHTMLElement.dataset
属性および HTML のdata-*
グローバル属性とちょうど同様に、うまく機能します。 SVGElement.id
読取専用- 与えられた要素の
id
属性の値を表すDOMString
です。または、id
が存在しない場合は、空文字列です。 SVGElement.xmlbase
読取専用- 与えられた要素の
xml:base
属性に対応するDOMString
です。 SVGElement.ownerSVGElement
読取専用- 直近の先祖の
<svg>
要素を参照するSVGSVGElement
です。もし、与えられた要素が最も外側の<svg>
要素であれば、null
です。 SVGElement.viewportElement
読取専用- 現在のビューポートを確立した
SVGElement
です。多くの場合は、直近の先祖の<svg>
要素です。もし、与えられた要素が最も外側の<svg>
要素であれば、null
です。
メソッド
SVGElement
インタフェースは、追加のメソッドを何も提供しませんが、親から、すなわち Element
から、メソッドを継承しています。
仕様
Specification | Status | Comment |
---|---|---|
Scalable Vector Graphics (SVG) 2 SVGElement の定義 |
勧告候補 | Adds the dataset property. |
Scalable Vector Graphics (SVG) 1.1 (Second Edition) SVGElement の定義 |
勧告 | Initial definition |
ブラウザ互換性
We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!
Feature | Chrome | Edge | Firefox (Gecko) | Microsoft Edge | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|---|
Basic support | (有)[1] | (有) | (有) | (有) | 9.0 | (有) | (有) |
dataset attribute |
54 | ? | 51 (51) | ? | ? | 41 | 10.0 |
Feature | Android | Android Webview | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|
Basic support | 未サポート | (有)[1] | (有) | (有) | ? | (有) | (有) | (有) [1] |
dataset attribute |
未サポート | 54 | ? | 51.0 (51) | ? | 41 | 10.0 | 54 |
[1] The properties offsetParent
, offsetTop
, offsetLeft
, offsetWidth
, and offsetHeight
are deprecated in Chrome 48.
参照
- HTML
data-*
attribute - SVG
data-*
attribute - Using custom data attributes in HTML