On Wed, 12 Jun 2024 09:02:20 GMT, Hannes Wallnöfer <hann...@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