Skip to content

Add syntax sugar for selecting nodes in frames and shadow DOM #3799

@WilcoFiers

Description

@WilcoFiers

Related to #3793

Currently, to include the main element inside an iframe you need to use a nested array syntax like so:

axe.run([['iframe', 'main']])

That the outer array is to allow multiple elements, and the inner one is to target inside frame is difficult to read. This gets worse when we add shadow DOM selectors, which will introduce a third level array:

axe.run([[['#shadow-host', 'main']]])

To make understanding these arrays easier, axe-core should allow labelling what node you're actually trying to grab. Doing this will also make wrapping optional, which further clears up the API. The above examples could then be rewritten like so:

axe.run({ fromFrames: ['iframe', 'main'] })
axe.run({ fromShadowDom: ['#shadow-host', 'main'] })

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreIssues in the core code (lib/core)featNew feature or enhancement

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions