Accessibility/WebAccessibilityAPI: Difference between revisions

Line 636: Line 636:
::Parameters
::Parameters
:::''element'' of ''AccessibleElement''
:::''element'' of ''AccessibleElement''
::::the anchor
:::''offset'' of ''Offsest'', optional
:::''offset'' of ''Offsest'', optional
::::offset relative the anchor


AccessiblePos .''move''(DOMPoint)
AccessiblePos .''move''(DOMPoint)
Line 642: Line 644:
::Parameters
::Parameters
:::''point'' of ''DOMPoint''
:::''point'' of ''DOMPoint''
::::the point the accessible position should be moved to.




Line 648: Line 651:
::Parameters
::Parameters
:::''where'' of ''Where''
:::''where'' of ''Where''
:::''matcher'' of ''Matcher''.
::::where the search should be performed
:::''matcher'' of ''Matcher''
::::function describing a match
</code>
</code>


Line 656: Line 661:
::Parameters
::Parameters
:::''where'' of ''Where''
:::''where'' of ''Where''
:::''matcher'' of ''Matcher''.
::::where the search should be performed
:::''matcher'' of ''Matcher''
::::function describing a match
</code>
</code>


Line 786: Line 793:
</pre>
</pre>


<pre>
function getText() {
  var p = new A11ePos().move("first", a => a.role == "paragraph");
  var startPos;
  return p.then(function(pos) {
    startPos = pos;
    return pos.search("forward", a => "line"); }).
  then(function(endPos) {
    return startPos.textInBetween(endPos);
  };
}
getText().then(function(text) { /* Say text */ })
</pre>
<pre>
function getText()
{
  var startPos = new A11ePos().move("first", a => a.role == "paragraph");
  var endPos = startPos.search("forward", a => [ "line", "stop" ]);
  return startPos.textInBeetween(startPos, endPos);
}
say(getText());
</pre>


<pre>
<pre>
Confirmed users
1,396

edits