Skip to content

Conversation

@michael-brueggemann
Copy link

No description provided.

@PRGfx
Copy link
Member

PRGfx commented Jul 1, 2024

As far as I can tell, this merely works by coincidence, as you pop the last result, while the previous approach took the first result matching the query-selector.

However, I do think that the previous code was incorrect, as target does not describe options of selectors (as interpreted here by joining the selectors with ,) but rather describes a path in frame-access (or shadow DOM I guess). (Looking at the names of the types UnlabelledFrameSelector = CrossTreeSelector[] etc. and their introduction dequelabs/axe-core@9e1e31b.)

So I think the element would be retrieved by reducing the target something like target.reduce((root, selector) => root ? root.querySelector(selector) : null, document.documentElement) – possibly using some sort of shadow-DOM access. I didn't look into that in too much detail yet though.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants