Skip to content

add "has" function (parent selector) #8

Description

@gajus
  • CSS does not have a parent selector.
  • cheerio has has() selector.

Since we want Surgeon to work across different environment (i.e. browser), we'd need to implement this on the Surgeon level.

Use case

Sometimes it is required to know whether an element has a descending element to know if it is the right element, e.g. http://www.mk2.com/salles/mk2-gambetta.

To select all table rows that contain movie information, we can check if a table row includes information about the movie name.

#seances .l-mk2-tables .l-session-table .fiche-film-info::has(.fiche-film-title)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions