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

content / test / data / accessibility / html / contenteditable-descendants-with-selection.html [blame]

<!--
@WIN-ALLOW:IA2_STATE_EDITABLE
@WIN-ALLOW:IA2_STATE_MULTI_LINE
@WIN-ALLOW:IA2_STATE_SINGLE_LINE
@WIN-ALLOW:LINKED
@WIN-ALLOW:ia2_hypertext=*
@WIN-ALLOW:caret_offset*
@WIN-ALLOW:n_selections*
@WIN-ALLOW:selection_start*
@WIN-ALLOW:selection_end*
@BLINK-ALLOW:nonAtomicTextFieldRoot=true
@BLINK-ALLOW:editable*
@BLINK-ALLOW:richlyEditable*
@BLINK-ALLOW:*textSel*
@AURALINUX-ALLOW:editable
@AURALINUX-ALLOW:multi-line
@AURALINUX-ALLOW:caret_offset*
@AURALINUX-ALLOW:selection_start*
@AURALINUX-ALLOW:selection_end*
-->
<div id="contenteditable" tabindex="0" contenteditable>
  <p>A contenteditable with a
    <a href="#">link</a> and an
    <img alt="Image"> and a
    <input type="button" value="Button">.
  </p>
  <table>
    <td>Always expose editable tables as tables.</td>
  </table>
  <ol>
    <li>Editable list item.</li>
  </ol>
</div>

<script>
  var selection = window.getSelection();
  var selectionRange = document.createRange();
  var contenteditable = document.getElementById('contenteditable');
  contenteditable.focus();
  selectionRange.selectNodeContents(contenteditable);
  selection.removeAllRanges();
  selection.addRange(selectionRange);
</script>