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
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70

content / test / data / accessibility / mac / selection / set-selection-contenteditable.html [blame]

<!--
@SCRIPT:
  // Select the 1st word via text marker associated with container AXTextArea.
  text_range:= ce1.AXTextMarkerRangeForUIElement(ce1)
  marker_0:= text_range.anchor
  marker_1:= ce1.AXNextWordEndTextMarkerForTextMarker(marker_0)
  target_selected_marker_range:= ce1.AXTextMarkerRangeForUnorderedTextMarkers([marker_0, marker_1])
  ce1.AXSelectedTextMarkerRange = target_selected_marker_range
  wait for AXSelectedTextChanged on AXTextArea
  ce1.AXSelectedText

@SCRIPT:
  // Select the 2nd word via the marker associated with AXStaticText.
  text:= ce1.AXChildren[0].AXChildren[0]
  text.AXValue
  text_range:= text.AXTextMarkerRangeForUIElement(text)
  marker_0:= text_range.anchor
  marker_1:= text.AXNextWordEndTextMarkerForTextMarker(marker_0)
  marker_2:= text.AXNextWordEndTextMarkerForTextMarker(marker_1)
  marker_3:= text.AXPreviousWordStartTextMarkerForTextMarker(marker_2)
  target_selected_marker_range:= text.AXTextMarkerRangeForUnorderedTextMarkers([marker_2, marker_3])
  ce1.AXSelectedTextMarkerRange = target_selected_marker_range
  wait for AXSelectedTextChanged on AXTextArea
  ce1.AXSelectedText

@SCRIPT:
  // Select text inside a span.
  text:= ce1.AXChildren[0].AXChildren[3]
  text.AXValue
  text_range:= text.AXTextMarkerRangeForUIElement(text)
  marker_0:= text_range.anchor
  marker_1:= text_range.focus
  marker_2:= text.AXPreviousTextMarkerForTextMarker(marker_1)
  target_selected_marker_range:= text.AXTextMarkerRangeForUnorderedTextMarkers([marker_0, marker_2])
  ce1.AXSelectedTextMarkerRange = target_selected_marker_range
  wait for AXSelectedTextChanged on AXTextArea
  ce1.AXSelectedText

@SCRIPT:
  // Select the text inside the block with incorrect grammar.
  text:= ce1.AXChildren[0].AXChildren[1].AXChildren[0]
  text.AXValue
  text_range:= text.AXTextMarkerRangeForUIElement(text)
  ce1.AXSelectedTextMarkerRange = text_range
  wait for AXSelectedTextChanged on AXTextArea
  ce1.AXSelectedText

@SCRIPT:
  // Select the text after a forced break.
  text:= ce2.AXChildren[0].AXChildren[2]
  text.AXValue
  text_range:= text.AXTextMarkerRangeForUIElement(text)
  marker_0:= text_range.anchor
  marker_1:= text.AXNextWordEndTextMarkerForTextMarker(marker_0)
  target_selected_marker_range:= text.AXTextMarkerRangeForUnorderedTextMarkers([marker_0, marker_1])
  ce2.AXSelectedTextMarkerRange = target_selected_marker_range
  wait for AXSelectedTextChanged on AXTextArea
  ce2.AXSelectedText
-->
<!DOCTYPE html>
<html>
<body>
  <div id="ce1" contenteditable="true">
    <p>The quick brown foxes <span aria-invalid="grammar">jumps</span> over the <em>lazy</em> dog</p>
  </div>
  <div id="ce2" contenteditable="true">
    <p><span>Pack my box</span><br><span>with five dozen liquor jugs.</span></p>
  </div>
</body>
</html>