JS: Fix issue with new RegExp().exec()

This commit is contained in:
Asger F
2024-12-04 13:59:27 +01:00
parent f6d0835c64
commit 71a6a47713
2 changed files with 4 additions and 4 deletions

View File

@@ -6,7 +6,7 @@ window.location = /.*redirect=([^&]*).*/.exec(document.location.href)[1];
window.location = indirect.exec(document.location.href)[1];
});
// NOT OK [INCONSISTENCY]
// NOT OK
window.location = new RegExp('.*redirect=([^&]*).*').exec(document.location.href)[1];
(function(){
@@ -14,7 +14,7 @@ window.location = new RegExp('.*redirect=([^&]*).*').exec(document.location.href
window.location = indirect.exec(document.location.href)[1];
});
// NOT OK [INCONSISTENCY]
// NOT OK
window.location = new RegExp(/.*redirect=([^&]*).*/).exec(document.location.href)[1];
(function(){
@@ -23,7 +23,7 @@ window.location = new RegExp(/.*redirect=([^&]*).*/).exec(document.location.href
});
function foo(win) {
win.location.assign(new RegExp(/.*redirect=([^&]*).*/).exec(win.location.href)[1]); // NOT OK [INCONSISTENCY]
win.location.assign(new RegExp(/.*redirect=([^&]*).*/).exec(win.location.href)[1]); // NOT OK
}
foo(window);