Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…t set
  • Loading branch information...
commit 5d07f6e84f110313d665a1196dd2076539869da4 1 parent c5575c6
@FMCorz FMCorz authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/javascript-static.js
View
7 lib/javascript-static.js
@@ -1109,9 +1109,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()');
Please sign in to comment.
Something went wrong with that request. Please try again.