You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically a way to find "all" of a certain element.
Feature one: Find the closest common parent. If we take a news website often times an article will involve a title, an image as well as a description. This could be something like
If I want to get a selector for the article, my idea would be to click ex. the title as well as the image it would return the <article> path, as it's the closest parent of the given elements. In practice this would mean, you pass an array of DOM elements into a parentFinder function (or add an optional "mode" parameter to the finder function). who would then first traverse the DOM towards the root and then once a common ancestor is found simply call finder on that one
Feature two: Find multiple similar events. Again let's take the news website from Feature one. Currently finder would only return a path to the exact DOM element. This might look something like #articles > article:nth-child(3) for the 3rd article. I'd want a way for it to find similar elements, so ex. all <article> elements within #articles.
I think one possible implementation would be to use Feature one, to find the wrapping container and once that is found, have an array where you need to supply one DOM element of each item you're looking for in said container, meaning it looks again for a parent path that would match each of the supplied selectors individually. Though I'm sure there has to be a better way, or even a way only requiring you to supply 2-3 examples.
The text was updated successfully, but these errors were encountered:
Basically a way to find "all" of a certain element.
Feature one: Find the closest common parent. If we take a news website often times an article will involve a title, an image as well as a description. This could be something like
If I want to get a selector for the article, my idea would be to click ex. the title as well as the image it would return the
<article>
path, as it's the closest parent of the given elements. In practice this would mean, you pass an array of DOM elements into aparentFinder
function (or add an optional "mode" parameter to the finder function). who would then first traverse the DOM towards the root and then once a common ancestor is found simply callfinder
on that oneFeature two: Find multiple similar events. Again let's take the news website from Feature one. Currently finder would only return a path to the exact DOM element. This might look something like
#articles > article:nth-child(3)
for the 3rd article. I'd want a way for it to find similar elements, so ex. all<article>
elements within#articles
.I think one possible implementation would be to use Feature one, to find the wrapping container and once that is found, have an array where you need to supply one DOM element of each item you're looking for in said container, meaning it looks again for a parent path that would match each of the supplied selectors individually. Though I'm sure there has to be a better way, or even a way only requiring you to supply 2-3 examples.
The text was updated successfully, but these errors were encountered: