RFR: 8012675: Javadoc for javax.swing.text.html.parser.Parser.handleComment() needs to be updated [v17]

Alexey Ivanov aivanov at openjdk.org
Tue Jun 21 19:39:22 UTC 2022


On Fri, 17 Jun 2022 17:37:59 GMT, Damon Nguyen <dnguyen at openjdk.org> wrote:

>> src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java line 1312:
>> 
>>> 1310:      *         <li>Tags display the tag text as editable text fields.</li>
>>> 1311:      *         <li>The content within the tags will be handled by the editor as
>>> 1312:      *         regular text.</li>
>> 
>> This is not how `<script>` is handled though: the content is displayed in a text field. The text in the unknown tag is displayed directly.
>> 
>> The content of `<script>` tag is handled as if it's a comment.
>> <a href="https://urldefense.com/v3/__https://github.com/openjdk/jdk/blob/ae2504b4692a5298b5835727b04a44e1edc8a4d6/src/java.desktop/share/classes/javax/swing/text/html/parser/Parser.java*L2176-L2177__;Iw!!ACWV5N9M2RV99hQ!NqsGchdsnHguT_YueWoIeXjM3AHFK0ubKRMdbIILDs_HFu0N7un0tnC0AlP9eVfP8RPOcwStlGK95a8lrFX339v9mg$">https://github.com/openjdk/jdk/blob/ae2504b4692a5298b5835727b04a44e1edc8a4d6/src/java.desktop/share/classes/javax/swing/text/html/parser/Parser.java#L2176-L2177</a>
>
> I tried to cover this in earlier commits where I differentiate known but unsupported tags, such as script tags, and completely unknown tags. In conversation and testing, HTMLEditorKit.HTMLFactory has a create method that creates HiddenTagViews for unknown tags and for a small list of tags (title, script, param, etc.). In the end, these are all treated the same, so I grouped script tags in this javadoc change. Script tags do have a special case in the Parser where it is handled as a comment but being handled as a comment doesn't change the behavior and still displays the content.

Comments are rendered in a `JTextArea`, that's the only difference. It's covered in the test.

Adding these details could be overkill.

-------------

PR: https://git.openjdk.org/jdk/pull/7446



More information about the client-libs-dev mailing list