Skip to content

Add [contains|matches][own]Whole #1636

@jhy

Description

@jhy

After reviewing #876 and the related #576. I think we can make some improvements, and also maintain backwards compatibility:

  • (done) for :contains(text), normalize the selector text in the same way that the text() and ownText() methods work. That directly fixes this issue. I conceptually like the neatness of using :contains("text") to use a non-normalized search, but that's a bit stringly typed, and maybe backwards in-compat.
  • (done) introduce :containsWholeText and :containsWholeOwnText which uses wholeText() and wholeOwnText() and no normalization to either the input or the query. That way we can find content including newlines, tabs, repeated spaces, etc
  • (done) for Can't select elements with only whitespace #576, introduce :matchesWholeText and :matchesWholeOwnText, to work similarly for regular expressions

Metadata

Metadata

Assignees

Labels

improvementAn improvement / new feature idea

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions