aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/svgelement/index.html
blob: ea08becf6b0bbb93a21e83dae4eed3d04ff19656 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
title: SVGElement
slug: Web/API/SVGElement
translation_of: Web/API/SVGElement
---
<div>{{APIRef("SVG")}}</div>

<div>所有SVG DOM类的父类.</div>

<div> </div>

<p>{{InheritanceDiagram}}</p>

<h2 id="属性">属性</h2>

<dl>
 <dt>{{domxref("SVGElement.dataset")}}{{readonlyInline}}</dt>
 <dd>A {{domxref("DOMStringMap")}} object which provides a list of key/value pairs of named data attributes which correspond to <a href="/en-US/docs/Web/Guide/HTML/Using_data_attributes">custom data attributes</a> attached to the element. These can also be defined in SVG using attributes of the form {{SVGAttr("data-*")}}, where <code>*</code> is the key name for the pair. This works just like HTML's {{domxref("HTMLElement.dataset")}} property and HTML's {{htmlattrxref("data-*")}} global attribute.</dd>
 <dt>{{domxref("SVGElement.id")}}{{readonlyInline}}</dt>
 <dd>A {{domxref("DOMString")}} representing the value of the {{SVGAttr("id")}} attribute on the given element, or the empty string if <code>id</code> is not present.</dd>
 <dt>{{domxref("SVGElement.xmlbase")}}{{readonlyInline}}</dt>
 <dd>A {{domxref("DOMString")}} corresponding to the {{SVGAttr("xml:base")}} attribute on the given element.</dd>
 <dt>{{domxref("SVGElement.ownerSVGElement")}}{{readonlyInline}}</dt>
 <dd>An {{domxref("SVGSVGElement")}} referring to the nearest ancestor {{SVGElement("svg")}} element. <code>null</code> if the given element is the outermost <code>&lt;svg&gt;</code> element.</dd>
 <dt>{{domxref("SVGElement.viewportElement")}}{{readonlyInline}}</dt>
 <dd>The {{domxref("SVGElement")}}, which established the current viewport. Often, the nearest ancestor {{SVGElement("svg")}} element. <code>null</code> if the given element is the outermost <code>&lt;svg&gt;</code> element.</dd>
</dl>

<h2 id="方法">方法</h2>

<p><em><code>SVGElement</code>类本身没有方法, 但拥有从父类{{domxref("Element")}}继承的方法.</em></p>

<h2 id="规范">规范</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName("SVG2", "types.html#InterfaceSVGElement", "SVGElement")}}</td>
   <td>{{Spec2("SVG2")}}</td>
   <td>Adds the {{domxref("SVGElement.dataset", "dataset")}} property.</td>
  </tr>
  <tr>
   <td>{{SpecName("SVG1.1", "types.html#InterfaceSVGElement", "SVGElement")}}</td>
   <td>{{Spec2("SVG1.1")}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="浏览器兼容性">浏览器兼容性</h2>

{{Compat("api.SVGElement")}}

<h2 id="相关链接">相关链接</h2>

<ul>
 <li>HTML {{htmlattrxref("data-*")}} 属性</li>
 <li>SVG {{SVGAttr("data-*")}} 属性</li>
 <li><a href="/zh-CN/docs/Web/Guide/HTML/Using_data_attributes">使用数据属性</a></li>
</ul>