Integrated: 8352740: Introduce new factory method HtmlTree.IMG

Nizar Benalla nbenalla at openjdk.org
Wed Mar 26 12:48:17 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

This pull request has now been integrated.

Changeset: c14bbea9
Author:    Nizar Benalla <nbenalla at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/c14bbea93e6701719b934dbd1711d26a91b50d7d
Stats:     31 lines in 4 files changed: 14 ins; 7 del; 10 mod

8352740: Introduce new factory method HtmlTree.IMG

Reviewed-by: liach, jjg

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

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


More information about the javadoc-dev mailing list