RFR: 8322708: Global HTML attributes are not allowed [v3]

Hannes Wallnöfer hannesw at openjdk.org
Fri Jun 14 12:15:47 UTC 2024


On Wed, 12 Jun 2024 09:02:20 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:

>> I suggest one of
>> 
>> 1. Add a `boolean global;` member to the enum, and provide a second constructor that allows that boolean member to be set true.   For example,
>> 
>> WIDTH,
>> STYLE(true),
>> 
>> 
>> 2. Make the `Set` be static and init it in a static initializer.
>> See the `javac` `Source` and `Target` classes for examples of this technique.
>
> Wouldn't the easiest solution be to add a boolean `global`/`isGlobal` field and getter to `Attr`?
> 
> That would give use some more opportunities to simplify the code: We could get rid of the `GLOBAL_ATTRS` map here *and* avoid putting global attributes in the the `attr` map of each `HtmlTag` instance by simply adding a shortcut to return `AttrKind.OK` in `getAttrKind(Name)` if the given attribute is global.

BTW, this should also be done by global attributes that are already respected, such as `id`, `class`, and the `aria-*` accessibility attributes.

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

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


More information about the javadoc-dev mailing list