Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

":empty" psuedo-class not working #1976

Closed
cjmalloy opened this issue Jun 22, 2023 · 1 comment
Closed

":empty" psuedo-class not working #1976

cjmalloy opened this issue Jun 22, 2023 · 1 comment
Assignees
Milestone

Comments

@cjmalloy
Copy link

cjmalloy commented Jun 22, 2023

I am trying to use the :empty psuedo-class to remove empty lists. Instead, it does not select empty <li> tags or any other tags I try:

var doc = Jsoup.parse(" <p>test</p>\n" +
	" <ul>\n" +
	"   <li>\n" +
	"   </li>\n" +
	" </ul>\n" +
	" <ul>\n" +
	"   <li>\n" +
	"   </li>\n" +
	" </ul>\n" +
	" <p>test</p>");
var lis = doc.select("li:empty");
lis.remove();
@jhy jhy closed this as completed in 48c3e99 Sep 8, 2023
@jhy jhy self-assigned this Sep 8, 2023
@jhy jhy added this to the 1.16.2 milestone Sep 8, 2023
@jhy jhy added the improvement label Sep 8, 2023
@jhy
Copy link
Owner

jhy commented Sep 8, 2023

These elements weren't matching the :empty selector as they have non-empty textnode children. But that's not very useful, so I updated the Evaluator to match if the textnode children are blank (i.e. just whitespace).

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

No branches or pull requests

2 participants