RFR: 8352740: Introduce new factory method HtmlTree.IMG
Chen Liang
liach at openjdk.org
Tue Mar 25 03:18:09 UTC 2025
On Mon, 24 Mar 2025 17:08:32 GMT, Nizar Benalla <nbenalla at openjdk.org> wrote:
> Please review this small patch to add a new factory method `HtmlTree IMG(DocPath src, String alt)`, to provide a convenient way to reliably create valid tree nodes.
>
> Previously, all uses of `HtmlTag.IMG` followed a similar pattern :
>
> HtmlTree.of(HtmlTag.IMG)
> .put(HtmlAttr.SRC, docpath)
> .put(HtmlAttr.ALT, alt)
>
>
> However, it was easy to forget to add the required "alt" attribute. Those have been replaced by the new factory method.
>
> No tests are required as part of this change.
>
> TIA
src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/HtmlTree.java line 1163:
> 1161: * {@return an HTML {@code IMG} element}
> 1162: */
> 1163:
Suggestion:
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24204#discussion_r2011223141
More information about the javadoc-dev
mailing list