Skip to content

More permissive extended attributes grammar #455

@TimothyGu

Description

@TimothyGu

We would like to use some extended attribute types in jsdom, but that webidl2.js cannot currently parse.

interface HTMLMyElement {
  // List of strings (from https://chromium.googlesource.com/chromium/src/+/master/third_party/blink/renderer/bindings/IDLExtendedAttributes.md#reflectonly_a)
  [Reflect, ReflectOnly=("first", "second", "third", "fourth")] attribute DOMString quarter;

  // List of integers
  [Reflect, ReflectRange=(1, 4)] attribute unsigned long span;
};

#222 looked into changing the extended attributes parser to be more restrictive. whatwg/webidl#574 resolved the question by saying that the grammar is intentionally generic. Indeed, the current ExtendedAttribute grammar allows for basically anything given that (quoting from #222):

Any types of brackets must be closed if appears. Commas are allowed only inside brackets (as any comma outside will be a separator for the extended attribute).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions