diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-02-14 12:43:24 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-02-14 12:43:24 +0000 |
| commit | 22b699c4351a3eadc92b3ffb690b64a7ab903f1f (patch) | |
| tree | fda1945f9b0df68c55d66485effbc57bbe059d39 /src/main/java/org/zwobble/mammoth/html/HtmlElement.java | |
| parent | 0889d26717379eaccc8a3d76df7d12144376e2c2 (diff) | |
Add attributes to self closing element
Diffstat (limited to 'src/main/java/org/zwobble/mammoth/html/HtmlElement.java')
| -rw-r--r-- | src/main/java/org/zwobble/mammoth/html/HtmlElement.java | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/src/main/java/org/zwobble/mammoth/html/HtmlElement.java b/src/main/java/org/zwobble/mammoth/html/HtmlElement.java index 31b1fe2..8111507 100644 --- a/src/main/java/org/zwobble/mammoth/html/HtmlElement.java +++ b/src/main/java/org/zwobble/mammoth/html/HtmlElement.java @@ -1,8 +1,5 @@ package org.zwobble.mammoth.html; -import com.google.common.base.Function; -import com.google.common.collect.Ordering; - import java.util.List; import java.util.Map; @@ -21,17 +18,7 @@ public class HtmlElement implements HtmlNode { public void write(StringBuilder builder) { builder.append("<").append(tagName); - List<Map.Entry<String, String>> sortedAttributes = orderBy(Map.Entry<String, String>::getKey) - .sortedCopy(attributes.entrySet()); - - for (Map.Entry<String, String> attribute : sortedAttributes) { - builder - .append(" ") - .append(attribute.getKey()) - .append("=\"") - .append(HtmlWriter.escapeAttributeValue(attribute.getValue())) - .append("\""); - } + HtmlWriter.generateAttributes(attributes, builder); builder.append(">"); @@ -42,8 +29,4 @@ public class HtmlElement implements HtmlNode { .append(tagName) .append(">"); } - - private static <T, R extends Comparable<R>> Ordering<T> orderBy(Function<T, R> getKey) { - return Ordering.from((first, second) -> getKey.apply(first).compareTo(getKey.apply(second))); - } } |
