DEV Community

Discussion on: Stay alert

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