diff options
Diffstat (limited to 'src/main/java/org/zwobble/mammoth/html')
| -rw-r--r-- | src/main/java/org/zwobble/mammoth/html/Html.java | 10 | ||||
| -rw-r--r-- | src/main/java/org/zwobble/mammoth/html/HtmlElement.java | 4 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/main/java/org/zwobble/mammoth/html/Html.java b/src/main/java/org/zwobble/mammoth/html/Html.java index ca9597a..0a32e58 100644 --- a/src/main/java/org/zwobble/mammoth/html/Html.java +++ b/src/main/java/org/zwobble/mammoth/html/Html.java @@ -32,7 +32,15 @@ public class Html { } public static HtmlNode element(String tagName, Map<String, String> attributes, List<HtmlNode> children) { - return new HtmlElement(tagName, attributes, children); + return new HtmlElement(tagName, attributes, children, false); + } + + public static HtmlNode collapsibleElement(String tagName, List<HtmlNode> children) { + return collapsibleElement(tagName, map(), children); + } + + public static HtmlNode collapsibleElement(String tagName, Map<String, String> attributes, List<HtmlNode> children) { + return new HtmlElement(tagName, attributes, children, true); } public static HtmlNode selfClosingElement(String tagName) { diff --git a/src/main/java/org/zwobble/mammoth/html/HtmlElement.java b/src/main/java/org/zwobble/mammoth/html/HtmlElement.java index 637b009..59683ba 100644 --- a/src/main/java/org/zwobble/mammoth/html/HtmlElement.java +++ b/src/main/java/org/zwobble/mammoth/html/HtmlElement.java @@ -7,11 +7,13 @@ public class HtmlElement implements HtmlNode { private final String tagName; private final Map<String, String> attributes; private final List<HtmlNode> children; + private final boolean collapsible; - public HtmlElement(String tagName, Map<String, String> attributes, List<HtmlNode> children) { + public HtmlElement(String tagName, Map<String, String> attributes, List<HtmlNode> children, boolean collapsible) { this.tagName = tagName; this.attributes = attributes; this.children = children; + this.collapsible = collapsible; } public String getTagName() { |
