Skip to content

Commit c019c5d

Browse files
authored
Update to Jsoup 1.14.2 (#12381)
1 parent f4e16a1 commit c019c5d

File tree

6 files changed

+22
-8
lines changed

6 files changed

+22
-8
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
<!-- Used in OSGi manifests -->
3333
<javax.validation.version>2.0.1.Final</javax.validation.version>
34-
<jsoup.version>1.11.2</jsoup.version>
34+
<jsoup.version>1.14.2</jsoup.version>
3535
<javax.portlet.version>2.0</javax.portlet.version>
3636
<vaadin.sass.version>0.9.13</vaadin.sass.version>
3737
<!-- Note that this should be kept in sync with the class Constants -->

server/src/main/java/com/vaadin/ui/declarative/Design.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ private static DesignContext designToComponentTree(Document doc,
534534
private static Document createHtml(DesignContext designContext) {
535535
// Create the html tree skeleton.
536536
Document doc = new Document("");
537-
DocumentType docType = new DocumentType("html", "", "", "");
537+
DocumentType docType = new DocumentType("html", "", "");
538538
doc.appendChild(docType);
539539
Element html = doc.createElement("html");
540540
doc.appendChild(html);

server/src/test/java/com/vaadin/tests/design/DeclarativeTestBaseBase.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.io.ByteArrayInputStream;
77
import java.io.ByteArrayOutputStream;
88
import java.util.ArrayList;
9+
import java.util.Arrays;
910
import java.util.Collection;
1011
import java.util.Collections;
1112
import java.util.HashSet;
@@ -16,7 +17,6 @@
1617

1718
import org.jsoup.Jsoup;
1819
import org.jsoup.nodes.Attribute;
19-
import org.jsoup.nodes.BooleanAttribute;
2020
import org.jsoup.nodes.Element;
2121
import org.jsoup.nodes.Node;
2222
import org.jsoup.nodes.TextNode;
@@ -29,6 +29,13 @@
2929
import com.vaadin.ui.declarative.ShouldWriteDataDelegate;
3030

3131
public abstract class DeclarativeTestBaseBase<T extends Component> {
32+
private static final String[] booleanAttributes = { "allowfullscreen",
33+
"async", "autofocus", "checked", "compact", "declare", "default",
34+
"defer", "disabled", "formnovalidate", "hidden", "inert", "ismap",
35+
"itemscope", "multiple", "muted", "nohref", "noresize", "noshade",
36+
"novalidate", "nowrap", "open", "readonly", "required", "reversed",
37+
"seamless", "selected", "sortable", "truespeed", "typemustmatch" };
38+
3239
private static final class AlwaysWriteDelegate
3340
implements ShouldWriteDataDelegate {
3441
private static final long serialVersionUID = -6345914431997793599L;
@@ -249,7 +256,7 @@ private String elementToHtml(Element producedElem, StringBuilder sb) {
249256
List<String> names = new ArrayList<>();
250257
for (Attribute a : producedElem.attributes().asList()) {
251258
names.add(a.getKey());
252-
if (a instanceof BooleanAttribute) {
259+
if (isBooleanAttribute(a.getKey())) {
253260
booleanAttributes.add(a.getKey());
254261
}
255262
}
@@ -276,6 +283,13 @@ private String elementToHtml(Element producedElem, StringBuilder sb) {
276283
return sb.toString();
277284
}
278285

286+
/**
287+
* Checks if this attribute name is defined as a boolean attribute in HTML5
288+
*/
289+
protected static boolean isBooleanAttribute(final String key) {
290+
return Arrays.binarySearch(booleanAttributes, key) >= 0;
291+
}
292+
279293
protected String stripOptionTags(String design) {
280294
return design.replaceAll("[ \n]*<option(.*)</option>[ \n]*", "");
281295

server/src/test/java/com/vaadin/tests/design/LocaleTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public void testHtmlGeneration() {
9797
private Document componentToDoc(DesignContext dc) {
9898
// Create the html tree skeleton.
9999
Document doc = new Document("");
100-
DocumentType docType = new DocumentType("html", "", "", "");
100+
DocumentType docType = new DocumentType("html", "", "");
101101
doc.appendChild(docType);
102102
Element html = doc.createElement("html");
103103
doc.appendChild(html);
@@ -124,7 +124,7 @@ private Document componentToDoc(DesignContext dc) {
124124
public void testParsing() {
125125
// create an html document
126126
Document doc = new Document("");
127-
DocumentType docType = new DocumentType("html", "", "", "");
127+
DocumentType docType = new DocumentType("html", "", "");
128128
doc.appendChild(docType);
129129
Element html = doc.createElement("html");
130130
doc.appendChild(html);

server/src/test/java/com/vaadin/tests/server/component/ReadEmptyDesignTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void testReadContextWithRootParameter() {
5959

6060
private Document createDesign() {
6161
Document doc = new Document("");
62-
DocumentType docType = new DocumentType("html", "", "", "");
62+
DocumentType docType = new DocumentType("html", "", "");
6363
doc.appendChild(docType);
6464
Element html = doc.createElement("html");
6565
doc.appendChild(html);

uitest/src/main/java/com/vaadin/tests/minitutorials/v7b1/BootstrapListenerCode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class BootstrapListenerCode {
2424
@Override
2525
public void modifyBootstrapPage(BootstrapPageResponse response) {
2626
response.getDocument().body()
27-
.appendChild(new Comment("Powered by Vaadin!", ""));
27+
.appendChild(new Comment("Powered by Vaadin!"));
2828
response.setHeader("X-Powered-By", "Vaadin 7");
2929
}
3030

0 commit comments

Comments
 (0)