Skip to content

Commit

Permalink
refactor based on comments
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Mar 19, 2024
1 parent 0e3d987 commit e783b97
Showing 1 changed file with 28 additions and 17 deletions.
45 changes: 28 additions & 17 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -3421,53 +3421,65 @@ and |session|:

</div>

<div algorithm="locate nodes using accessibility attributes">
To <dfn>locate nodes using accessibility attributes</dfn> with given |context nodes|, |selector|,
|maximum returned node count|, |session|, and |returned nodes|:

1. If |selector|'s <code>role</code> and |selector|'s <code>name</code> are missing, return [=error=] with [=error code=]
[=invalid selector=].
<div algorithm="collect nodes using accessibility attributes">
To <dfn>collect nodes using accessibility attributes</dfn> with given |context nodes|, |selector|,
|maximum returned node count|, and |returned nodes|:

1. If |returned nodes| is null:

1. Set |returned nodes| to an empty [=/list=].

1. If |maximum returned node count| is not null and [=list/size=] of |returned
nodes| is greater or equal to |maximum returned node count|:

1. Return [=success=] with data null.

1. For each |context node| in |context nodes|:

1. Let |match| be true.

1. If |selector|'s <code>role</code> is present:

1. Let |role| be the result of computing the [=accessible role=] of |context node|.
1. Let |role| be the [=accessible role=] of |context node|.

1. If |selector|'s <code>role</code> [=is|is not=] |role|:

1. Set |match| to false.

1. If |selector|'s <code>name</code> is present:

1. Let |name| be the result of computing the [=accessible name=] of |context node|.
1. Let |name| be the [=accessible name=] of |context node|.

1. If |selector|'s <code>name</code> [=is|is not=] |name|:

1. Set |match| to false.

1. If |match| is true:

1. If |maximum returned node count| is not null and [=list/size=] of |returned
nodes| is greater or equal to |maximum returned node count|:

1. Return [=success=] with data |returned nodes|.

1. [=list/Append=] |context node| to |returned nodes|.

1. Let |child nodes| be an empty [=/list=] and, for each node |child| in the
<a spec=dom>children</a> of |context node|:

1. If |child| implements {{Element}}, [=list/append=] |child| to |child nodes|.

1. Invoke [=locate nodes using accessibility attributes=] with |child nodes|,
|selector|, |maximum returned node count|, |session|, and |returned nodes|.
1. Invoke [=collect nodes using accessibility attributes=] with |child nodes|,
|selector|, |maximum returned node count|, and |returned nodes|.

1. Return [=success=] with data |returned nodes|.

</div>

<div algorithm="locate nodes using accessibility attributes">
To <dfn>locate nodes using accessibility attributes</dfn> with given |context nodes|, |selector|, and
|maximum returned node count|:

1. If |selector|'s <code>role</code> and |selector|'s <code>name</code>
are missing, return [=error=] with [=error code=]
[=invalid selector=].

1. Return the result of [=collect nodes using accessibility attributes=] with |context nodes|,
|selector|, |maximum returned node count|, and null.

</div>

Expand Down Expand Up @@ -3552,8 +3564,7 @@ The [=remote end steps=] with |session| and |command parameters| are:
1. Let |selector| be |locator|["<code>value</code>"].

1. Let |result nodes| be a result of [=trying=] to [=locate nodes using accessibility attributes=]
given |context nodes|, |selector|, |maximum returned node count|,
|session|, and null.
given |context nodes|, |selector|, and |maximum returned node count|.

1. Assert: |maximum returned node count| is null or [=list/size=] of |result nodes| is less
than or equal to |maximum returned node count|.
Expand Down

0 comments on commit e783b97

Please sign in to comment.