-
Notifications
You must be signed in to change notification settings - Fork 758
Open
Labels
Description
Prerequisites
- I checked the documentation and found no answer;
- I checked to make sure that this issue has not already been filed;
- This is not an ad/bug report.
Problem description
I was looking to target a particular element adjacent to another particular element but only if it has no text content OR if its text content is only whitespace, e.g. <p></p> OR <p> </p>
This would be equivalent to the js elementNode.textContent.trim().length === 0. You can accomplish this right now with cssSelector:contains(/^\\s*$/) – but that's reliant on the regex engine and makes the rule line visually confusing.
Proposed solution
Perhaps to get the most use out of this, it could be a boolean:
| css | equivalent to... | js |
|---|---|---|
:visible-text(0) |
→ | .textContent.trim().length === 0 |
:visible-text(1) |
→ | .textContent.trim().length !== 0 |