Skip to content

Commit 34104f2

Browse files
Make innerText locator work with non-element nodes (#705)
* Make innerText locator work with non-element nodes * Update index.bs Co-authored-by: Maksim Sadym <[email protected]> * Update index.bs --------- Co-authored-by: Maksim Sadym <[email protected]>
1 parent c29a684 commit 34104f2

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

index.bs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3384,6 +3384,21 @@ To <dfn>locate nodes using inner text</dfn> with given |context nodes|,
33843384

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

3387+
1. If |context node| implements {{Document}} or {{DocumentFragment}}:
3388+
3389+
1. Let |child nodes| be an empty [=/list=].
3390+
3391+
1. For each node |child| in the <a spec=dom>children</a> of |context node|.
3392+
3393+
1. [=list/Append=] |child| to |child nodes|.
3394+
3395+
1. Let |child max depth| be null if |max depth| is null, or |max depth| - 1 otherwise.
3396+
3397+
1. [=Extend=] |returned nodes| with the result of [=trying=] to [=locate nodes using inner text=]
3398+
with |child nodes|, |selector|, |child max depth|, |match type|, |ignore case|, and |maximum returned node count|.
3399+
3400+
1. If |context node| does not implement {{HTMLElement}} then [=continue=].
3401+
33873402
1. Let |node inner text| be the result of calling the [=innerText getter steps=] with
33883403
|context node| as the [=this=] value.
33893404

@@ -3397,7 +3412,7 @@ To <dfn>locate nodes using inner text</dfn> with given |context nodes|,
33973412
1. Let |child nodes| be an empty [=/list=] and, for each node |child| in the
33983413
<a spec=dom>children</a> of |context node|:
33993414

3400-
1. If |child| implements {{Element}}, [=list/append=] |child| to |child nodes|.
3415+
1. [=list/Append=] |child| to |child nodes|.
34013416

34023417
1. If [=list/size=] of |child nodes| is equal to 0 or |max depth| is equal to 0,
34033418
perform the following steps:
@@ -3410,12 +3425,10 @@ To <dfn>locate nodes using inner text</dfn> with given |context nodes|,
34103425

34113426
1. Otherwise, perform the following steps:
34123427

3413-
1. If |max depth| is not null:
3414-
3415-
1. Set |max depth| to |max depth| - 1.
3428+
1. Let |child max depth| be null if |max depth| is null, or |max depth| - 1 otherwise.
34163429

34173430
1. Let |child node matches| be the result of [=locate nodes using inner text=]
3418-
with |child nodes|, |selector|, |max depth|, |match type|,
3431+
with |child nodes|, |selector|, |child max depth| , |match type|,
34193432
|ignore case|, and |maximum returned node count|.
34203433

34213434
1. If [=list/size=] of |child node matches| is equal to 0 and |match type| is

0 commit comments

Comments
 (0)