Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify Window.alert IDL #3822

Closed
saschanaz opened this issue Jul 15, 2018 · 1 comment
Closed

Simplify Window.alert IDL #3822

saschanaz opened this issue Jul 15, 2018 · 1 comment

Comments

@saschanaz
Copy link
Member

https://html.spec.whatwg.org/multipage/window-object.html#the-window-object

interface Window : EventTarget {
  // user prompts
  void alert();
  void alert(DOMString message);
}

How about merging them into void alert(optional DOMString message);?

@TimothyGu
Copy link
Member

These two are not compatible. See https://heycam.github.io/webidl/#idl-overloading-vs-union. With the current scheme, alert(undefined) would go to the second overload (with undefined stringified to "undefined"), while using an optional here would make that code function the same way as alert(). Executing alert(undefined) in web browsers seems to indicate that implementations currently use operation overloading.

We could change that behavior of course, but just wanted to make the point clear about compatibility.

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

No branches or pull requests

2 participants