On Tue, 11 Jun 2024 14:42:48 GMT, Nizar Benalla <nbena...@openjdk.org> wrote:

>> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java line 
>> 695:
>> 
>>> 693:             // custom "data-*" attributes are also accepted
>>> 694:             var attrName=name.toString();
>>> 695:             if (!attrName.startsWith("on") && 
>>> !attrName.matches("data-[a-z]+(-[a-z]+)*")){
>> 
>> I understand that `startsWith("on")` precedes this PR. However, it's more 
>> permissive than it should be: in reality, there are only 70 global 
>> attributes that start with "on". On the other hand, 
>> `attrName.matches("data-[a-z]+(-[a-z]+)*")` is less permissive. For example, 
>> if I read the XML spec correctly, such an attribute can contain `_` or start 
>> with `data-.`.
>> 
>> But maybe those checks are good enough?
>
> I think like being slightly restrictive and safe.

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]*

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19652#discussion_r1635059794

Reply via email to