Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to find navigable's container #811

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2960,6 +2960,7 @@ To <dfn>await a navigation</dfn> given |navigable|, |request|, |wait condition|,
browsingContext.Locator = (
browsingContext.AccessibilityLocator /
browsingContext.CssLocator /
browsingContext.ContainerLocator /
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why we cannot have the container as part of the return value of the browsingContext.getTree command? It would be somewhat similar to the clientWindow field.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that API currently does not include any shared references from script and would not allow expressing the ownership of the returned DOM element.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify: we could probably plumb it via the getTree along with the other options we might need to define how to return the element but to me it looks like locateNodes is a better place compared to the getTree.

browsingContext.InnerTextLocator /
browsingContext.XPathLocator
)
Expand All @@ -2977,6 +2978,10 @@ browsingContext.CssLocator = {
value: text
}

browsingContext.ContainerLocator = {
type: "container",
}

browsingContext.InnerTextLocator = {
type: "innerText",
value: text,
Expand Down Expand Up @@ -3776,6 +3781,18 @@ To <dfn>locate nodes using CSS</dfn> with given |navigable|, |context nodes|,

</div>

<div algorithm="locate the container element">
To <dfn>locate the container element</dfn> with given |navigable|:

1. Let |returned nodes| be an empty [=/list=].

1. If |navigable|'s [=navigable/container=] is not null,
append |navigable|'s [=navigable/container=] to |returned nodes|.

1. Return |returned nodes|.

</div>

<div algorithm="locate nodes using XPath">

To <dfn>locate nodes using XPath</dfn> with given |navigable|, |context nodes|,
Expand Down Expand Up @@ -4043,6 +4060,13 @@ The [=remote end steps=] with |session| and |command parameters| are:
1. Let |result nodes| be [=locate nodes using accessibility attributes=]
given |context nodes|, |selector|, and |maximum returned node count|.

<dt>|type| is the string "<code>container</code>"
<dd>

1. Issue: throw errors if extra unused optional params are set?

1. Let |result nodes| be [=locate the container element=] given |navigable|.

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