Skip to content

Instantly share code, notes, and snippets.

@McFoggy
Created April 13, 2016 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save McFoggy/e6166349b8ea012c925665fcf9625501 to your computer and use it in GitHub Desktop.
Save McFoggy/e6166349b8ea012c925665fcf9625501 to your computer and use it in GitHub Desktop.
jdk bug-webview-colgroup
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<script src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
<style type="text/css">
td {
text-align: center;
}
#t {
width: 100%;
}
</style>
</head>
<div id="main">
<script type="text/javascript">
function randomInt(max) {
return parseInt(Math.random() * max, 10);
}
function initTable() {
$("#t").empty();
$("#t").append("<colgroup></colgroup>");
var nbElements = $("#nbCols").val();
for (i = 0; i < nbElements; i++) {
$("#t colgroup").append("<col></col>");
}
$("#t").append("<tbody></tbody>");
var tBody = $("#t > tbody");
for (i = 0; i < nbElements; i++) {
tBody.append("<tr></tr>");
var tr = $("#t > tbody tr:last-child");
for (j = 0; j < nbElements; j++) {
tr.append("<td>init</td>");
}
}
}
function resetTable() {
var nbElements = $("#nbCols").val();
if ($("#clearCol").is(':checked')) {
// set all cols to 0px
$("col").attr("style", "width:0px");
}
// remove all rows
$("tr").remove();
// recreate some content
for (row = 0; row < nbElements; row++) {
$("#t").append("<tr></tr>");
var lastTR = $("#t tr:last-child");
for (col = 0; col < nbElements; col++) {
lastTR.append("<td>" + randomInt(10) + "</td>");
}
}
if ($("#clearCol").is(':checked')) {
$("col").attr("style",
"width:" + parseInt(100 / nbElements, 10) + "%");
}
};
$(document).ready(function() {
$("#nbCols").val(10);
$("#clearCol").attr("checked", true);
$("#nbCols").change(function(event) {
// Reset the table on width change
initTable();
});
initTable();
});
</script>
<button onclick="resetTable()">Clean and Recreate table</button>
<input type="number" id="nbCols">Number of row/cols</input> <input type="checkbox" id="clearCol">Clear col
sizes</input>
<table id="t" border="1">
</table>
</div>
</html>
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
public class SimpleBrowser extends Application {
@Override
public void start(Stage stage) {
WebView wv = new WebView();
wv.getEngine().load("http://localhost:8080/app.html");
Scene s = new Scene(wv);
stage.setScene(s);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment