DEV Community

Discussion on: Stay alert

Collapse
 
scunliffe profile image
Stephen Cunliffe

Using public web usage tracking as your "primary signal" to determine feature usage is an utter #FAIL. The private web applications that Google doesn't see is where most of the use of "less desired" web features are used, and where they are most depended on.

By all means discourage the use of confirm() and friends, however attempting to remove them when <dialog/> isn't available yet (9 years and counting bugs.webkit.org/show_bug.cgi?id=84635) is just bonkers.

What also isn't clear is what is the behavior when these are removed. e.g. what values do foo and bar get?

var foo = confirm("Do you want to backup {thing} before deleting it?");
var bar = prompt("Enter keyword to replace:", "example");
Enter fullscreen mode Exit fullscreen mode
Collapse
 
zakius profile image
zakius

depending on the mood browser will either stop the execution completely with 'x is not a function' or silently assign null, pretty neat, don't you think?

Collapse
 
scunliffe profile image
Stephen Cunliffe

ugh... yeah I think at a minimum... if for some reason this removal actually goes through, the replacement behavior needs to be standardized.

It will still mess things up, but at least if consistent we can focus on applicable solutions. e.g.

//override confirm() function
window.confirm(msg){
  //we are breaking the web here by changing behaviors that have worked consistently for 25+ years, but...
  return false;//immediately return false, with no user input
}

//override prompt() function
window.prompt(msg, default){
  //we are breaking the web here by changing behaviors that have worked consistently for 25+ years, but...
  return default || "";//immediately return the default passed in, or an empty string
}
Enter fullscreen mode Exit fullscreen mode