CaretPosition

  • Revision slug: Web/API/CaretPosition
  • Revision title: CaretPosition
  • Revision id: 399981
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment Moved From DOM/CaretPosition to Web/API/CaretPosition

Revision Content

Summary

The CaretPosition interface represents the caret postion, an indicator for the text insertion point. You can get a CaretPosition using the {{domxref("document.caretPositionFromPoint")}} method.

Attributes

offsetNode
Read only; of type {{domxref("Node")}}. Returns the found node at the caret's position.
offset
Read only; of type long. Returns the character offset in the caret position node.

Specification

Specification Status Comment
{{ SpecName('CSSOM View', '#caret-position', 'CaretPosition') }} {{ Spec2('CSSOM View') }}  

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox Internet Explorer Opera Safari
Basic support {{ CompatNo() }} {{ CompatGeckoDesktop("20.0") }} {{ CompatNo() }} {{ CompatNo() }} {{ CompatNo() }}
Feature Android Firefox Mobile IE Phone Opera Mobile Safari Mobile
Basic support {{ CompatNo() }} {{ CompatGeckoMobile("20.0") }} {{ CompatNo() }} {{ CompatNo() }} {{ CompatNo() }}

See also

  • {{domxref("document.caretPositionFromPoint")}}
  • {{domxref("Range")}}
  • {{domxref("Node")}}

Revision Source

<h2 id="Summary">Summary</h2>
<p>The <code>CaretPosition</code> interface represents the caret postion, an indicator for the text insertion point. You can get a <code>CaretPosition</code> using the {{domxref("document.caretPositionFromPoint")}} method.</p>
<h2 id="Attributes">Attributes</h2>
<dl>
  <dt>
    offsetNode</dt>
  <dd>
    Read only; of type {{domxref("Node")}}. Returns the found node at the caret's position.</dd>
  <dt>
    offset</dt>
  <dd>
    Read only; of type long. Returns the character offset in the caret position node.</dd>
</dl>
<h2 id="Specification" name="Specification">Specification</h2>
<table class="standard-table">
  <thead>
    <tr>
      <th scope="col">Specification</th>
      <th scope="col">Status</th>
      <th scope="col">Comment</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>{{ SpecName('CSSOM View', '#caret-position', '<code>CaretPosition</code>') }}</td>
      <td>{{ Spec2('CSSOM View') }}</td>
      <td>&nbsp;</td>
    </tr>
  </tbody>
</table>
<h2 id="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</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatGeckoDesktop("20.0") }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Android</th>
        <th>Firefox Mobile</th>
        <th>IE Phone</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatGeckoMobile("20.0") }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
      </tr>
    </tbody>
  </table>
</div>
<h2 id="See_also">See also</h2>
<ul>
  <li>{{domxref("document.caretPositionFromPoint")}}</li>
  <li>{{domxref("Range")}}</li>
  <li>{{domxref("Node")}}</li>
</ul>
Revert to this revision