Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 946299 of Node.innerText

  • Revision slug: Web/API/Node/innerText
  • Revision title: Node.innerText
  • Revision id: 946299
  • Created:
  • Creator: evilpie
  • Is current revision? No
  • Comment

Revision Content

{{APIRef("DOM")}}

{{ Non-standard_header() }}

Summary

Node.innerText is a nonstandard property that represents the text content of a node and its descendants. As a getter, it approximates the text the user would get if they highlighted the contents of the element with the cursor and then copied to the clipboard.

{{domxref("Node.textContent")}} is a somewhat similar standardized alternative, although there are important differences between the two.

Specification

Not part of any specification.

Microsoft has a description on MSDN.

kangax's blog post has a strawman draft of a specification.

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 4 {{ CompatGeckoDesktop(45) }} 6 9.6 (probably earlier) 3
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 2.3 (probably earlier) {{ CompatGeckoMobile(45) }} 10 (probably earlier) 12 4.1 (probably earlier)

See also

  • {{domxref("Node.outerText")}}
  • {{domxref("Element.innerHTML")}}

Revision Source

<div>{{APIRef("DOM")}}</div>

<p>{{ Non-standard_header() }}</p>

<h2 id="Summary">Summary</h2>

<p><code><strong>Node.innerText</strong></code> is a nonstandard property that represents the text content of a node and its descendants. As a getter, it approximates the text the user would get if they highlighted the contents of the element with the cursor and then copied to the clipboard.</p>

<p>{{domxref("Node.textContent")}} is a somewhat similar standardized alternative, although there are important differences between the two.</p>

<h2 id="Specification">Specification</h2>

<p>Not part of any specification.</p>

<p>Microsoft <a href="https://msdn.microsoft.com/library/ms533899(v=vs.85).aspx">has a description on MSDN</a>.</p>

<p><a href="https://perfectionkills.com/the-poor-misunderstood-innerText/">kangax's blog post</a> has a strawman draft of a specification.</p>

<h2 id="Browser_Compatibility" name="Browser_Compatibility">Browser compatibility</h2>

<p>{{ CompatibilityTable() }}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari (WebKit)</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>4</td>
   <td>{{ CompatGeckoDesktop(45) }}</td>
   <td>6</td>
   <td>9.6 (probably earlier)</td>
   <td>3</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>2.3 (probably earlier)</td>
   <td>{{ CompatGeckoMobile(45) }}</td>
   <td>10 (probably earlier)</td>
   <td>12</td>
   <td>4.1 (probably earlier)</td>
  </tr>
 </tbody>
</table>
</div>

<h2 id="See_also">See also</h2>

<ul>
 <li>{{domxref("Node.outerText")}}</li>
 <li>{{domxref("Element.innerHTML")}}</li>
</ul>
Revert to this revision