RFR: 8352740: Introduce new factory method HtmlTree.IMG [v2]
Hannes Wallnöfer
hannesw at openjdk.org
Tue Mar 25 11:15:13 UTC 2025
On Tue, 25 Mar 2025 10:58:57 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
>
> Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision:
>
> remove empty line
src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/HtmlTree.java line 1162:
> 1160: /**
> 1161: * {@return an HTML {@code IMG} element}
> 1162: */
It would be nice to also document/mention `src` and `alt` parameters/atttributes.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24204#discussion_r2011868131
More information about the javadoc-dev
mailing list