aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/zwobble/mammoth/html/HtmlSelfClosingElement.java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-02-14 12:43:24 +0000
committerMichael Williamson <mike@zwobble.org>2016-02-14 12:43:24 +0000
commit22b699c4351a3eadc92b3ffb690b64a7ab903f1f (patch)
treefda1945f9b0df68c55d66485effbc57bbe059d39 /src/main/java/org/zwobble/mammoth/html/HtmlSelfClosingElement.java
parent0889d26717379eaccc8a3d76df7d12144376e2c2 (diff)
Add attributes to self closing element
Diffstat (limited to 'src/main/java/org/zwobble/mammoth/html/HtmlSelfClosingElement.java')
-rw-r--r--src/main/java/org/zwobble/mammoth/html/HtmlSelfClosingElement.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/org/zwobble/mammoth/html/HtmlSelfClosingElement.java b/src/main/java/org/zwobble/mammoth/html/HtmlSelfClosingElement.java
index f3ef3f8..73f4734 100644
--- a/src/main/java/org/zwobble/mammoth/html/HtmlSelfClosingElement.java
+++ b/src/main/java/org/zwobble/mammoth/html/HtmlSelfClosingElement.java
@@ -1,16 +1,20 @@
package org.zwobble.mammoth.html;
+import java.util.Map;
+
public class HtmlSelfClosingElement implements HtmlNode {
private final String tagName;
+ private final Map<String, String> attributes;
- public HtmlSelfClosingElement(String tagName) {
+ public HtmlSelfClosingElement(String tagName, Map<String, String> attributes) {
this.tagName = tagName;
+ this.attributes = attributes;
}
@Override
public void write(StringBuilder builder) {
- builder.append("<")
- .append(tagName)
- .append(" />");
+ builder.append("<").append(tagName);
+ HtmlWriter.generateAttributes(attributes, builder);
+ builder.append(" />");
}
}