Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<!-- Used in OSGi manifests -->
<javax.validation.version>2.0.1.Final</javax.validation.version>
<jsoup.version>1.11.2</jsoup.version>
<jsoup.version>1.14.2</jsoup.version>
<javax.portlet.version>2.0</javax.portlet.version>
<vaadin.sass.version>0.9.13</vaadin.sass.version>
<!-- Note that this should be kept in sync with the class Constants -->
Expand Down
2 changes: 1 addition & 1 deletion server/src/main/java/com/vaadin/ui/declarative/Design.java
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ private static DesignContext designToComponentTree(Document doc,
private static Document createHtml(DesignContext designContext) {
// Create the html tree skeleton.
Document doc = new Document("");
DocumentType docType = new DocumentType("html", "", "", "");
DocumentType docType = new DocumentType("html", "", "");
doc.appendChild(docType);
Element html = doc.createElement("html");
doc.appendChild(html);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
Expand All @@ -16,7 +17,6 @@

import org.jsoup.Jsoup;
import org.jsoup.nodes.Attribute;
import org.jsoup.nodes.BooleanAttribute;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.Node;
import org.jsoup.nodes.TextNode;
Expand All @@ -29,6 +29,13 @@
import com.vaadin.ui.declarative.ShouldWriteDataDelegate;

public abstract class DeclarativeTestBaseBase<T extends Component> {
private static final String[] booleanAttributes = { "allowfullscreen",
"async", "autofocus", "checked", "compact", "declare", "default",
"defer", "disabled", "formnovalidate", "hidden", "inert", "ismap",
"itemscope", "multiple", "muted", "nohref", "noresize", "noshade",
"novalidate", "nowrap", "open", "readonly", "required", "reversed",
"seamless", "selected", "sortable", "truespeed", "typemustmatch" };

private static final class AlwaysWriteDelegate
implements ShouldWriteDataDelegate {
private static final long serialVersionUID = -6345914431997793599L;
Expand Down Expand Up @@ -249,7 +256,7 @@ private String elementToHtml(Element producedElem, StringBuilder sb) {
List<String> names = new ArrayList<>();
for (Attribute a : producedElem.attributes().asList()) {
names.add(a.getKey());
if (a instanceof BooleanAttribute) {
if (isBooleanAttribute(a.getKey())) {
booleanAttributes.add(a.getKey());
}
}
Expand All @@ -276,6 +283,13 @@ private String elementToHtml(Element producedElem, StringBuilder sb) {
return sb.toString();
}

/**
* Checks if this attribute name is defined as a boolean attribute in HTML5
*/
protected static boolean isBooleanAttribute(final String key) {
return Arrays.binarySearch(booleanAttributes, key) >= 0;
}

protected String stripOptionTags(String design) {
return design.replaceAll("[ \n]*<option(.*)</option>[ \n]*", "");

Expand Down
4 changes: 2 additions & 2 deletions server/src/test/java/com/vaadin/tests/design/LocaleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void testHtmlGeneration() {
private Document componentToDoc(DesignContext dc) {
// Create the html tree skeleton.
Document doc = new Document("");
DocumentType docType = new DocumentType("html", "", "", "");
DocumentType docType = new DocumentType("html", "", "");
doc.appendChild(docType);
Element html = doc.createElement("html");
doc.appendChild(html);
Expand All @@ -124,7 +124,7 @@ private Document componentToDoc(DesignContext dc) {
public void testParsing() {
// create an html document
Document doc = new Document("");
DocumentType docType = new DocumentType("html", "", "", "");
DocumentType docType = new DocumentType("html", "", "");
doc.appendChild(docType);
Element html = doc.createElement("html");
doc.appendChild(html);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void testReadContextWithRootParameter() {

private Document createDesign() {
Document doc = new Document("");
DocumentType docType = new DocumentType("html", "", "", "");
DocumentType docType = new DocumentType("html", "", "");
doc.appendChild(docType);
Element html = doc.createElement("html");
doc.appendChild(html);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class BootstrapListenerCode {
@Override
public void modifyBootstrapPage(BootstrapPageResponse response) {
response.getDocument().body()
.appendChild(new Comment("Powered by Vaadin!", ""));
.appendChild(new Comment("Powered by Vaadin!"));
response.setHeader("X-Powered-By", "Vaadin 7");
}

Expand Down