RFR: 8322708: Global HTML attributes are not allowed [v3]
Pavel Rappo
prappo at openjdk.org
Fri Jun 14 12:15:47 UTC 2024
On Tue, 11 Jun 2024 23:49:15 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:
>> As @jonathan-gibbons likes to point out, javadoc is not an HTML validation tool. So I think, it's okay to leave the code simple. Maybe this would be even simpler?
>>
>> data-[a-z][-a-z0-9]*
>
> I admit to being "lazy" when I wrote `startsWith("on")`. In general, I don't think folk should be writing many if any event handlers in doc comments, and it was easier to give forward compatibility with a weak test for `"on"`. Likewise, there should not be many if any uses of `data-*` attributes, and it is easy enough to give a simple regex. It's more important to not reject valid uses of event attributes and custom data attributes than it is to detect all invalid cases. The right place to detect all invalid cases is downstream in recognized validation tools, like `tidy` which catch all occurrences of bad stuff, wherever they originate (doc comment, command-line options, the `javadoc` tool, post-processors, etc). DocLint is primarily an "early warning system" for common errors.
I agree with you, Jon. So, we can simply use `startsWith("data-")`, which would be good enough and most permissive (i.e. no false negatives).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19652#discussion_r1636126138
More information about the javadoc-dev
mailing list