Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[feature request] - generation of 'alternate' selector #65

@eoghanmurray

Description

@eoghanmurray

So let's say I have generated a lovely selector like

.opened .single-link > span

My problem is that while the opened class is unique on the page at the moment, with my next click, I will open another 'section' of the page, and then there will be two opened classes present, and my original selector is no longer unique.

I guess I could use a MutationObserver to watch for class changes and build up a list of 'volatile' classnames, however this will not work if the HTML has exactly one .opened class at the start.

So I was thinking that it would be nice to have the ability to generate a 'backup' selector, which would be the equivalent of the following

finder(target,{
    className: (e) => e !== 'opened' && e !== 'single-link',
})

Is that something that is worthwhile to elevate to a single config option, which takes into account what would normally be generated, but then operates on alternative basis that whatever is currently unique, may not be in future?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions