Skip to content

Commit

Permalink
TagWriter can write empty attribute
Browse files Browse the repository at this point in the history
See gh-910
  • Loading branch information
djechelon authored and rstoyanchev committed Nov 24, 2021
1 parent 3f7dec0 commit 913cc07
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@ public void writeAttribute(String attributeName, String attributeValue) throws J
this.writer.append(" ").append(attributeName).append("=\"")
.append(attributeValue).append("\"");
}

/**
* Write an empty HTML attribute with the specified name.
* <p>Be sure to write all attributes <strong>before</strong> writing
* any inner text or nested tags.
* @throws IllegalStateException if the opening tag is closed
*/
public void writeAttribute(String attributeName) throws JspException {
if (currentState().isBlockTag()) {
throw new IllegalStateException("Cannot write attributes after opening tag is closed.");
}
this.writer.append(" ").append(attributeName);
}

/**
* Write an HTML attribute if the supplied value is not {@code null}
Expand Down

0 comments on commit 913cc07

Please sign in to comment.