Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jhy committed Jul 9, 2021
1 parent cedf83c commit 0a5a7ef
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/jsoup/nodes/Attribute.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ protected final boolean shouldCollapseAttribute(Document.OutputSettings out) {
protected static boolean shouldCollapseAttribute(final String key, @Nullable final String val, final Document.OutputSettings out) {
return (
out.syntax() == Document.OutputSettings.Syntax.html &&
(val == null || ("".equals(val) || val.equalsIgnoreCase(key)) && Attribute.isBooleanAttribute(key)));
(val == null || (val.isEmpty() || val.equalsIgnoreCase(key)) && Attribute.isBooleanAttribute(key)));
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/jsoup/nodes/DataNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ public DataNode clone() {
/**
Create a new DataNode from HTML encoded data.
@param encodedData encoded data
@param baseUri bass URI
@param baseUri base URI
@return new DataNode
@deprecated Unused, and will be removed in 1.15.1.
*/
@Deprecated
public static DataNode createFromEncoded(String encodedData, String baseUri) {
String data = Entities.unescape(encodedData);
return new DataNode(data);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jsoup/nodes/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public boolean hasAttr(String attributeKey) {

if (attributeKey.startsWith("abs:")) {
String key = attributeKey.substring("abs:".length());
if (attributes().hasKeyIgnoreCase(key) && !absUrl(key).equals(""))
if (attributes().hasKeyIgnoreCase(key) && !absUrl(key).isEmpty())
return true;
}
return attributes().hasKeyIgnoreCase(attributeKey);
Expand Down

0 comments on commit 0a5a7ef

Please sign in to comment.