我们的志愿者还没有将这篇文章翻译为 中文 (简体)加入我们帮助完成翻译!
您也可以阅读此文章的English (US)版。

All of the SVG DOM interfaces that correspond directly to elements in the SVG language derive from the SVGElement interface.

Properties

datasetRead only
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 form data-*, where * is the key name for the pair. This works just like HTML's HTMLElement.dataset property and HTML's data-* global attribute.
idRead only
A DOMString representing the value of the id attribute on the given element, or the empty string if id is not present.
xmlbaseRead only
A DOMString corresponding to the xml:base attribute on the given element.
ownerSVGElementRead only
An SVGSVGElement referring to the nearest ancestor <svg> element. null if the given element is the outermost <svg> element.
viewportElementRead only
The SVGElement, which established the current viewport. Often, the nearest ancestor <svg> element. null if the given element is the outermost <svg> element.

Methods

The SVGElement interface doesn't provide any additional methods, but inherits methods from its parent, Element.

Specifications

Specification Status Comment
Scalable Vector Graphics (SVG) 2
The definition of 'SVGElement' in that specification.
Candidate Recommendation Adds the dataset property.
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'SVGElement' in that specification.
Recommendation Initial definition

Browser compatibility

Feature Chrome Firefox (Gecko) Microsoft Edge Internet Explorer Opera Safari (WebKit)
Basic support (Yes)[1] (Yes) (Yes) 9.0 (Yes) (Yes)
dataset attribute 54 51 (51) ? ? 41 10.0
Feature Android Android Webview Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support No support (Yes)[1] (Yes) ? (Yes) (Yes) (Yes) [1]
dataset attribute No support 54 51.0 (51) ? 41 10.0 54

[1] The properties offsetParent, offsetTop, offsetLeft, offsetWidth, and offsetHeight are deprecated in Chrome 48.

See also

文档标签和贡献者

 此页面的贡献者: Sebastianz, Sheppy, tifosi, jpmedley, fscholz, kscarfone, Jeremie
 最后编辑者: Sebastianz,