Accessibility/WebAccessibilityAPI: Difference between revisions

Jump to navigation Jump to search
Line 987: Line 987:
</pre>
</pre>


[ 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 attributes===
===Text attributes===
Line 1,030: Line 1,015:
p.textAttributes.get("font-weight") == 700; // true
p.textAttributes.get("font-weight") == 700; // true
</pre>
</pre>


==Caret and selection==
==Caret and selection==
Confirmed users
1,396

edits

Navigation menu