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

Extend locateNodes with a locator to get navigable's container element #811

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

OrKoN
Copy link
Contributor

@OrKoN OrKoN commented Nov 11, 2024

This change adds a new locator called context: when called for a parent navigable, given a child navigable as a locator, it locates the container element for the child navigable that is located within the parent navigable. While providing the parent navigable is redundant and it can be computed based on the child navigable, the interface matches existing locators which all select a node within the parent navigable that matches the locator criteria. In this case, the criterion is the child navigable identifier.

Providing start nodes to this locator would currently trigger an invalid argument error but eventually it could be supported if there is a use case.

Closes #794


Preview | Diff

@OrKoN OrKoN force-pushed the orkon/container-locator branch 3 times, most recently from b6e0478 to 0a2b364 Compare November 11, 2024 19:36
@OrKoN OrKoN marked this pull request as ready for review November 11, 2024 19:37
@OrKoN OrKoN added needs-discussion Issues to be discussed by the working group needs-tests labels Nov 11, 2024
@OrKoN OrKoN requested a review from sadym-chromium November 11, 2024 19:37
index.bs Outdated Show resolved Hide resolved
@OrKoN OrKoN force-pushed the orkon/container-locator branch 2 times, most recently from 0748244 to 628c9e0 Compare November 18, 2024 18:32
@OrKoN OrKoN changed the title Add a way to find navigable's container Extend locateNodes with a locator to get navigable's container element Nov 18, 2024
@OrKoN OrKoN removed the needs-discussion Issues to be discussed by the working group label Nov 18, 2024
@whimboo whimboo requested a review from jgraham November 27, 2024 07:54
index.bs Outdated Show resolved Hide resolved
index.bs Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Show resolved Hide resolved
@OrKoN OrKoN force-pushed the orkon/container-locator branch from 628c9e0 to 234a6ad Compare December 4, 2024 15:51
@OrKoN OrKoN requested a review from jgraham December 5, 2024 19:39
index.bs Outdated Show resolved Hide resolved
@OrKoN
Copy link
Contributor Author

OrKoN commented Dec 18, 2024

@jgraham @whimboo do you have any remaining concerns about this PR?

@OrKoN OrKoN requested a review from whimboo December 18, 2024 18:37
@OrKoN OrKoN force-pushed the orkon/container-locator branch from bda9ebe to 0729b55 Compare December 19, 2024 11:27
@@ -2984,6 +2985,13 @@ browsingContext.CssLocator = {
value: text
}

browsingContext.ContextLocator = {
Copy link
Contributor

Choose a reason for hiding this comment

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

I still find it puzzling when naming it ContextLocator but then returning a Node which is the container element of a context. Why was it changed from ContainerLocator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed on request by @jgraham because the locator name reflects the criteria for search and not the return value. I.e., browsingContext.ContextLocator locates by a context selector, browsingContext.CssLocator locates by a CSS selector.

Copy link
Contributor

Choose a reason for hiding this comment

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

I’m still not entirely sold on this API, but if @jgraham is okay with it, we can move forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support finding iframe elements by browsing context id
4 participants