Skip to content

Commit 95a244a

Browse files
committed
fix and simplify getFormElementsByAttribute()
1 parent b175558 commit 95a244a

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/main/java/org/htmlunit/html/HtmlForm.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -541,18 +541,9 @@ private <E extends HtmlElement> List<E> getFormElementsByAttribute(
541541
final String attributeName,
542542
final String attributeValue) {
543543

544-
final List<E> list = new ArrayList<>();
545-
final String lowerCaseTagName = elementName.toLowerCase(Locale.ROOT);
546-
547-
for (final HtmlElement element : getElements()) {
548-
if (element.getTagName().equals(lowerCaseTagName)) {
549-
final String attValue = element.getAttribute(attributeName);
550-
if (attValue.equals(attributeValue)) {
551-
list.add((E) element);
552-
}
553-
}
554-
}
555-
return list;
544+
return (List<E>) getElements(htmlElement ->
545+
htmlElement.getTagName().equals(elementName)
546+
&& htmlElement.getAttribute(attributeName).equals(attributeValue));
556547
}
557548

558549
/**

0 commit comments

Comments
 (0)