所有SVG DOM类的父类.
属性
SVGElement.dataset
只读- A
DOMStringMap
object which provides a list of key/value pairs of named data attributes which correspond to custom data attributes attached to the element. These can also be defined in SVG using attributes of the formdata-*
, where*
is the key name for the pair. This works just like HTML'sHTMLElement.dataset
property and HTML'sdata-*
global attribute. SVGElement.id
只读- A
DOMString
representing the value of theid
attribute on the given element, or the empty string ifid
is not present. SVGElement.xmlbase
只读- A
DOMString
corresponding to thexml:base
attribute on the given element. SVGElement.ownerSVGElement
只读- An
SVGSVGElement
referring to the nearest ancestor<svg>
element.null
if the given element is the outermost<svg>
element. SVGElement.viewportElement
只读- The
SVGElement
, which established the current viewport. Often, the nearest ancestor<svg>
element.null
if the given element is the outermost<svg>
element.
方法
SVGElement
类本身没有方法, 但拥有从父类Element
继承的方法.
规范
Specification | Status | Comment |
---|---|---|
Scalable Vector Graphics (SVG) 2 SVGElement |
Candidate Recommendation | Adds the dataset property. |
Scalable Vector Graphics (SVG) 1.1 (Second Edition) SVGElement |
Recommendation | 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 | (Yes)[1] | (Yes) | (Yes) | (Yes) | 9.0 | (Yes) | (Yes) |
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 | 未实现 | (Yes)[1] | (Yes) | (Yes) | ? | (Yes) | (Yes) | (Yes) [1] |
dataset attribute |
未实现 | 54 | ? | 51.0 (51) | ? | 41 | 10.0 | 54 |
[1] 属性 offsetParent
, offsetTop
, offsetLeft
, offsetWidth
, 和 offsetHeight
从Chrome 48开始被废弃.