WebIDL extended attribute for element(s) that implement the interface
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 9.4k
- Forks
- 3.2k
- PR merge metrics
- PR metrics pending
Description
For tooling and code generation reason, we (Edge) have custom (non-standard) lines in WebIDL to specify the elements that implement the HTML/SVG*Element interface.
As part of using WebIDL for more tooling purposes I'd like to get a standardised way in WebIDL to define this.
For example, for HTMLHeadingElement we currently use"
/// @element name="h1", ns="HTML"
/// @element name="h2", ns="HTML"
/// @element name="h3", ns="HTML"
/// @element name="h4", ns="HTML"
/// @element name="h5", ns="HTML"
/// @element name="h6", ns="HTML"
[Exposed=Window, HTMLConstructor]
interface HTMLHeadingElement : HTMLElement
I'd like to be able to specify something like:
[Element="h1,h2,h3,h4,h5,h6", Exposed=Window, HTMLConstructor]
interface HTMLHeadingElement : HTMLElement
As an aside we also specify the namespace and if it is self closing, but that could probably be handled separately if that makes it more complex.
The main use cases are:
- Allow tooling such as compat tables, intellisense, and syntax highlighting directly from the formal definitions that the browsers use to generate code (or that are more likely to be kept in sync) rather than manually created lists that don't get updated or are prone to errors.
- Allow for code generation defined closer to the rest of the element's interface definition.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing custom @element WebIDL lines for HTMLHeadingElement and the proposed Element attribute. Compare the tooling and code-generation use cases, including namespace and self-closing metadata, and determine whether the proposal has a sufficiently defined standard shape. Done means a resolved design for representing these element relationships in WebIDL.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html
- Domain
- web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100