Confirmed users
1,396
edits
| Line 561: | Line 561: | ||
AccessiblePos? move(DOMNode container, long offset); | AccessiblePos? move(DOMNode container, long offset); | ||
AccessiblePos? move(DOMPoint); | AccessiblePos? move(DOMPoint); | ||
AccessiblePos? search(Where where, | AccessiblePos? move(Where where, Criteria); | ||
AccessiblePos? search(Where where, Criteria); | |||
readonly attribute AccessibleElement root; | readonly attribute AccessibleElement root; | ||
| Line 709: | Line 709: | ||
Construction from a DOM node and offset relative it. See [[#Caret_and_selection|selection]] for examples. | Construction from a DOM node and offset relative it. See [[#Caret_and_selection|selection]] section for examples. | ||
<code> | <code> | ||
| Line 924: | Line 924: | ||
var pos1 = new A11ePos(p, "begin", p), pos2 = null; | var pos1 = new A11ePos(p, "begin", p), pos2 = null; | ||
while (pos2 = pos1.search("forward", "word")) { | while (pos2 = pos1.search("forward", "word")) { | ||
console.log(pos2. | console.log(pos2.text(pos1)); | ||
pos1 = pos2; | pos1 = pos2; | ||
} | } | ||
| Line 934: | Line 934: | ||
</pre> | </pre> | ||
the log | The script above generates the log "Mozilla ", "is ", "a ", "free-", "software ", "community", "which ", "produces ", "the ", "Firefox ", "web ", "browser." | ||
<pre> | <pre> | ||
| Line 944: | Line 941: | ||
The log is "Mozilla". | The log is "Mozilla". | ||
| Line 970: | Line 949: | ||
<code> | <code> | ||
CriteriaFunc | CriteriaFunc | ||
::A criteria function used to define an algorithm of | ::A criteria function used to define an algorithm of the match. | ||
::Returns | ::Returns | ||
:::a | :::a criteria term or offset(s) | ||
</code> | </code> | ||
If "next" is returned then criteria function is reentered with next traversed accessible. If offset is given then traversing is stopped, the accessible position is moved to the traversed accessible element and | If "next" is returned then criteria function is reentered with next traversed accessible. If offset is given then traversing is stopped, the accessible position is moved to the traversed accessible element and given offset. If criteria literal is returned then the accessible position is moved to the position complying the criteria. If it cannot be moved withing current accessible then it reenters with next accessible. | ||
| Line 989: | Line 968: | ||
return "at"; | return "at"; | ||
// Reenters with next accessible if it cannot move to the next | // Reenters with next accessible if it cannot move to the next line within this accessible. | ||
if (role.is("textcontainer")) | if (role.is("textcontainer")) | ||
return "line"; | return "line"; | ||
return "next"; | return "next"; | ||
} | } | ||
pos.move("next", | pos.move("next", criteria); | ||
</pre> | </pre> | ||
====Other methods==== | ====Other methods==== | ||