Permalink
Browse files

MDL-35754 libraries: openpopup() does not fail when window name is no…

…t set
  • Loading branch information...
1 parent 9273bd1 commit 1e5b1d6dad43919b93606682ebf429f64130de1a @FMCorz FMCorz committed Oct 3, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/javascript-static.js
View
7 lib/javascript-static.js
@@ -1190,9 +1190,12 @@ function openpopup(event, args) {
}
}
- // Cleans window name because IE does not support funky ones.
+ // Make sure the name argument is set and valid.
var nameregex = /[^a-z0-9_]/i;
- if (args.name.match(nameregex)) {
+ if (typeof args.name !== 'string') {
+ args.name = '_blank';
+ } else if (args.name.match(nameregex)) {
+ // Cleans window name because IE does not support funky ones.
args.name = args.name.replace(nameregex, '_');
if (M.cfg.developerdebug) {
alert('DEVELOPER NOTICE: Invalid \'name\' passed to openpopup()');

0 comments on commit 1e5b1d6

Please sign in to comment.