<!-- Used version numbers for dependencies -->
<commons-io.version>2.4</commons-io.version>
<google.appengine.version>1.7.7</google.appengine.version>
- <jsoup.version>1.8.3</jsoup.version>
+ <jsoup.version>1.14.2</jsoup.version>
<liferay.portal.version>6.0.2</liferay.portal.version>
<vaadin.sass.version>0.9.13</vaadin.sass.version>
Document document = response.getDocument();
- DocumentType doctype = new DocumentType("html", "", "",
- document.baseUri());
+ DocumentType doctype = new DocumentType("html", "", "");
+ doctype.setBaseUri(document.baseUri());
document.child(0).before(doctype);
Element head = document.head();
appendMainScriptTagContents(context, builder);
builder.append("//]]>");
- mainScriptTag.appendChild(
- new DataNode(builder.toString(), mainScriptTag.baseUri()));
+ mainScriptTag.appendChild(new DataNode(builder.toString()));
+ mainScriptTag.setBaseUri(mainScriptTag.baseUri());
fragmentNodes.add(mainScriptTag);
}
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);
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
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;
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;
ArrayList<String> names = new ArrayList<String>();
for (Attribute a : producedElem.attributes().asList()) {
names.add(a.getKey());
- if (a instanceof BooleanAttribute) {
+ if (isBooleanAttribute(a.getKey())) {
booleanAttributes.add(a.getKey());
}
}
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]*", "");
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);
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);
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);
@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");
}