---
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>

<p>{{Compat("api.DOMStringMap")}}</p>

<h2 id="Смотрите_тажке">Смотрите также</h2>

<ul>
 <li>{{ domxref("HTMLElement.dataset") }}</li>
 <li>{{ htmlattrxref("dataset") }}</li>
</ul>