diff options
author | Anna Koskinen <Ansku@users.noreply.github.com> | 2021-08-24 17:41:15 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-24 17:41:15 +0300 |
commit | 38a252948b24d8b6572db8a93ce7ad87b1fd0bad (patch) | |
tree | bf79f9f715d055a1e3c9367befb324cfa7ff96f0 | |
parent | 308c6e46b48a3d48428d933e37b1ef5e4509e0ae (diff) | |
download | vaadin-framework-38a252948b24d8b6572db8a93ce7ad87b1fd0bad.tar.gz vaadin-framework-38a252948b24d8b6572db8a93ce7ad87b1fd0bad.zip |
Update to Jsoup 1.14.2 (#12382)
7 files changed, 26 insertions, 12 deletions
@@ -25,7 +25,7 @@ <!-- 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> diff --git a/server/src/main/java/com/vaadin/server/BootstrapHandler.java b/server/src/main/java/com/vaadin/server/BootstrapHandler.java index 54ac577e78..1dbf91b624 100644 --- a/server/src/main/java/com/vaadin/server/BootstrapHandler.java +++ b/server/src/main/java/com/vaadin/server/BootstrapHandler.java @@ -368,8 +368,8 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { 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(); @@ -574,8 +574,8 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { 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); } diff --git a/server/src/main/java/com/vaadin/ui/declarative/Design.java b/server/src/main/java/com/vaadin/ui/declarative/Design.java index fe643f84f7..ddde437686 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/Design.java +++ b/server/src/main/java/com/vaadin/ui/declarative/Design.java @@ -514,7 +514,7 @@ public class Design implements Serializable { 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); diff --git a/server/src/test/java/com/vaadin/tests/design/DeclarativeTestBaseBase.java b/server/src/test/java/com/vaadin/tests/design/DeclarativeTestBaseBase.java index d60eb4622b..e66cf153ea 100644 --- a/server/src/test/java/com/vaadin/tests/design/DeclarativeTestBaseBase.java +++ b/server/src/test/java/com/vaadin/tests/design/DeclarativeTestBaseBase.java @@ -4,6 +4,7 @@ import java.io.ByteArrayInputStream; 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; @@ -14,7 +15,6 @@ import java.util.logging.Logger; 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; @@ -27,6 +27,13 @@ import com.vaadin.ui.declarative.DesignContext; 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; @@ -247,7 +254,7 @@ public abstract class DeclarativeTestBaseBase<T extends Component> { 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()); } } @@ -274,6 +281,13 @@ public abstract class DeclarativeTestBaseBase<T extends Component> { 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]*", ""); diff --git a/server/src/test/java/com/vaadin/tests/design/LocaleTest.java b/server/src/test/java/com/vaadin/tests/design/LocaleTest.java index ee44103529..c16c1adf3a 100644 --- a/server/src/test/java/com/vaadin/tests/design/LocaleTest.java +++ b/server/src/test/java/com/vaadin/tests/design/LocaleTest.java @@ -98,7 +98,7 @@ public class LocaleTest { 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); @@ -125,7 +125,7 @@ public class LocaleTest { 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); diff --git a/server/src/test/java/com/vaadin/tests/server/component/ReadEmptyDesignTest.java b/server/src/test/java/com/vaadin/tests/server/component/ReadEmptyDesignTest.java index 1156d72b71..6929e73ec6 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/ReadEmptyDesignTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/ReadEmptyDesignTest.java @@ -59,7 +59,7 @@ public class ReadEmptyDesignTest { 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); diff --git a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7b1/BootstrapListenerCode.java b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7b1/BootstrapListenerCode.java index 634da84963..fffa92796b 100644 --- a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7b1/BootstrapListenerCode.java +++ b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7b1/BootstrapListenerCode.java @@ -40,7 +40,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"); } |