FULL PRODUCT VERSION :
java version "1.8.0_172-ea"
Java(TM) SE Runtime Environment (build 1.8.0_172-ea-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
macOS 10.12.6
A DESCRIPTION OF THE PROBLEM :
Load this into an HTMLEditor:
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="font-family: san-serif" contenteditable="true">
<p>Test</p>
</body></html>
Then move the cursor behind "Test", press return and type "Test" again. In Java 1.8.0_172 you will get this:
<html dir="ltr"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body contenteditable="true">
<p style="font-family: san-serif;">Test</p><p><font face="Lucida Grande">Test</font></p>
</body></html>
In Java 1.8.0_112 you will get this:
<html dir="ltr"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="font-family: san-serif" contenteditable="true">
<p>Test</p><p><font face="Lucida Grande">Test</font></p>
</body></html>
As you can see Java 1.8.0_172 now removes the style from the body tag which influences how future text is displayed. It has added a style attribute to the existing <p> tag but if the program adds another <p> tag later, it makes a difference. In earlier Java versions, i.e. in 1.8.0_112 the body's style attribute was not modified. I think that was the correct behaviour.
REGRESSION. Last worked in version 8u151
ADDITIONAL REGRESSION INFORMATION:
java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b16, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Please see the "Description" above.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The body's style attribute should not be modified.
ACTUAL -
The body's style attribute is modified when just typing some text.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Controller implements Initializable {
public HTMLEditor htmlEditor;
@Override
public void initialize(URL location, ResourceBundle resources) {
htmlEditor.setHtmlText("<html>\n" +
"<head>\n" +
" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n" +
"</head>\n" +
"<body style=\"font-family: san-serif\">\n" +
"<p>Test</p>\n" +
"</body>\n" +
"</html>");
}
public void onPrintConsole(ActionEvent actionEvent) {
System.out.println(htmlEditor.getHtmlText());
}
}
and
public class Controller implements Initializable {
public HTMLEditor htmlEditor;
@Override
public void initialize(URL location, ResourceBundle resources) {
htmlEditor.setHtmlText("<html>\n" +
"<head>\n" +
" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n" +
"</head>\n" +
"<body style=\"font-family: san-serif\">\n" +
"<p>Test</p>\n" +
"</body>\n" +
"</html>");
}
public void onPrintConsole(ActionEvent actionEvent) {
System.out.println(htmlEditor.getHtmlText());
}
}
---------- END SOURCE ----------