Accessibility/WebAccessibilityAPI: Difference between revisions

Line 962: Line 962:
* Should it be outlined as moved?
* Should it be outlined as moved?
* Yura: we should have async API for search.
* Yura: we should have async API for search.
[ Promise variant if we had async API].
<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>


==Text==
==Text==
Confirmed users
1,396

edits