diff --git a/src/main/java/org/jsoup/select/Elements.java b/src/main/java/org/jsoup/select/Elements.java index 1986c6e457..e05d1fb93d 100644 --- a/src/main/java/org/jsoup/select/Elements.java +++ b/src/main/java/org/jsoup/select/Elements.java @@ -567,10 +567,7 @@ private Elements siblings(@Nullable String query, boolean next, boolean all) { do { Element sib = next ? e.nextElementSibling() : e.previousElementSibling(); if (sib == null) break; - if (eval == null) - els.add(sib); - else if (sib.is(eval)) - els.add(sib); + if (eval == null || sib.is(eval)) els.add(sib); e = sib; } while (all); }