blob: bea01845fee6d1c18c597c7ccffeb24611839b32 (
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
---
title: DOMStringMap
slug: Web/API/DOMStringMap
tags:
- API
translation_of: Web/API/DOMStringMap
---
<p>{{ APIRef("HTML DOM") }}</p>
<p><span class="seoSummary">Used by the {{ htmlattrxref("dataset") }} HTML attribute to represent data for custom attributes added to elements.</span></p>
<h2 id="Доступные_методы">Доступные методы</h2>
<table class="standard-table">
<tbody>
<tr>
<td><code>DOMString <a href="#getDataAttr()">getDataAttr</a>(in DOMString prop);</code></td>
</tr>
<tr>
<td><code>boolean <a href="#hasDataAttr()">hasDataAttr</a>(in DOMString prop);</code></td>
</tr>
<tr>
<td><code>void <a href="#removeDataAttr()">removeDataAttr</a>(in DOMString prop);</code></td>
</tr>
<tr>
<td><code>void <a href="#removeProp()">removeProp</a>(in nsIAtom attr);</code></td>
</tr>
<tr>
<td><code>void <a href="#setDataAttr()">setDataAttr</a>(in DOMString prop, in DOMString value);</code></td>
</tr>
</tbody>
</table>
<h2 id="Методы">Методы</h2>
<h3 id="hasDataAttr()">hasDataAttr()</h3>
<pre class="eval">boolean hasDataAttr(
in DOMString prop
);
</pre>
<h4 id="Аргументы">Аргументы</h4>
<dl>
<dt><code>prop</code></dt>
<dd>The property for which to check for the existence of a value.</dd>
</dl>
<h4 id="Возвращаемое_значение">Возвращаемое значение</h4>
<p><code>true</code> if the property exists; otherwise <code>false</code>.</p>
<h3 id="removeDataAttr()">removeDataAttr()</h3>
<pre class="eval">void removeDataAttr(
in DOMString prop
);
</pre>
<h4 id="Parameters">Parameters</h4>
<dl>
<dt><code>prop</code></dt>
<dd>The property to remove from the data set.</dd>
</dl>
<h3 id="removeProp()">removeProp()</h3>
<p>Removes the property from the dataset object. Used to update the dataset object when data-* attribute has been removed from the element.</p>
<pre class="eval">void removeProp(
in nsIAtom attr
);
</pre>
<h4 id="Parameters_2">Parameters</h4>
<dl>
<dt><code>attr</code></dt>
<dd>The property to remove from the dataset.</dd>
</dl>
<h2 id="Поддержка_браузерами">Поддержка браузерами</h2>
<p> </p>
<div class="hidden">
<p>The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a>and send us a pull request.</p>
</div>
<p>{{Compat("api.DOMStringMap")}}</p>
<h2 id="См._далее">См. далее</h2>
<ul>
<li>{{ domxref("HTMLElement.dataset") }}</li>
<li>{{ htmlattrxref("dataset") }}</li>
</ul>
|