Skip to content

Use aOrB parameter names for union options/primitive parameters - #2577

Open
Samuel Kapust (spkapust) wants to merge 1 commit into
microsoft:mainfrom
spkapust:fix-2470-union-param-names
Open

Samuel Kapust (spkapust) wants to merge 1 commit into
microsoft:mainfrom
spkapust:fix-2470-union-param-names

Conversation

@spkapust

Copy link
Copy Markdown

Fixes #2470

Several web APIs evolved from accepting a single primitive parameter to accepting a union of that primitive and an options/arg dictionary (e.g., boolean | AddEventListenerOptions), replacing the original descriptive parameter name with a generic options or arg in WebIDL.

Following the naming convention already used in upstream WebIDL for similar APIs (such as IDBObjectStore.getAll(queryOrOptions) and Performance.measure(name, startOrMeasureOptions)), this change adds overrideName support for KDL parameter patches and renames the affected union parameters to aOrB form while preserving each spec's options vs. arg prefix:

  • EventTarget.addEventListener (and synthesized event-map overloads): options -> optionsOrUseCapture
  • EventTarget.removeEventListener (and synthesized event-map overloads): options -> optionsOrUseCapture
  • Document.importNode: options -> optionsOrDeep
  • Element.scrollIntoView: arg -> argOrAlignToTop
  • HTMLElement.togglePopover: options -> optionsOrForce
  • new SharedWorker: options -> optionsOrName

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the PR!

This section of the codebase is owned by Kagami Sascha Rosylight (@saschanaz) - if they write a comment saying "LGTM" then it will be merged.

@spkapust

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="Google"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use overloads to preserve legacy parameter names when combined with modern Options objects

1 participant