title: What is a DOMString really?
body: <p>I came across <code>DOMString</code> while reading the <a href="https://html.spec.whatwg.org/" rel="noreferrer">HTML spec</a>. On some research, found the following data regarding it:</p>
  
  <p>From <a href="https://developer.mozilla.org/en/docs/Web/API/DOMString" rel="noreferrer">MDN</a>: </p>
  
  <blockquote>
    <p>DOMString is a UTF-16 String. As JavaScript already uses such strings,
    DOMString is mapped directly to a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String" rel="noreferrer">String</a>.</p>
  </blockquote>
  
  <p>From <a href="https://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMString" rel="noreferrer">W3C spec</a>:</p>
  
  <blockquote>
    <p>A <a href="https://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMString" rel="noreferrer">DOMString</a> is a sequence of <a href="https://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-16-bit-unit" rel="noreferrer">16-bit units</a>.</p>
  </blockquote>
  
  <p>But I still have the following questions:</p>
  
  <ol>
  <li>What is a <code>DOMString</code> actually and what is it used for?</li>
  <li>Why is it named as <strong>DOM</strong>String and not <strong>UTF16</strong>String? More specifically, how does it relate to DOM?</li>
  <li>If I UTF-16 encode a <code>String</code>, does it become a <code>DOMString</code>?</li>
  </ol>