From 969f585f87b4da456a30c99e3e988152fdca96fe Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 20 Feb 2016 14:42:36 +0000 Subject: Simplify construction of HTML paths --- src/main/java/org/zwobble/mammoth/styles/HtmlPath.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/main/java/org/zwobble/mammoth/styles/HtmlPath.java') diff --git a/src/main/java/org/zwobble/mammoth/styles/HtmlPath.java b/src/main/java/org/zwobble/mammoth/styles/HtmlPath.java index b03d0b6..ffad58c 100644 --- a/src/main/java/org/zwobble/mammoth/styles/HtmlPath.java +++ b/src/main/java/org/zwobble/mammoth/styles/HtmlPath.java @@ -6,19 +6,22 @@ import org.zwobble.mammoth.html.HtmlNode; import java.util.List; import java.util.Map; +import static org.zwobble.mammoth.util.MammothLists.list; import static org.zwobble.mammoth.util.MammothMaps.map; public class HtmlPath { - public static HtmlPathElement element(String tagName) { + public static final HtmlPath EMPTY = new HtmlPath(list()); + + public static HtmlPath element(String tagName) { return element(tagName, map()); } - public static HtmlPathElement element(String tagName, Map attributes) { - return new HtmlPathElement(tagName, attributes, false); + public static HtmlPath element(String tagName, Map attributes) { + return new HtmlPath(list(new HtmlPathElement(tagName, attributes, false))); } - public static HtmlPathElement collapsibleElement(String tagName) { - return new HtmlPathElement(tagName, map(), true); + public static HtmlPath collapsibleElement(String tagName) { + return new HtmlPath(list(new HtmlPathElement(tagName, map(), true))); } private final List elements; -- cgit v1.2.3