Merge pull request #511 from O2Graphics/O2Graphics-patch-1

Don't run a replace() when not needed
This commit is contained in:
Amauri CHAMPEAUX 2020-11-02 08:37:05 +01:00 committed by GitHub
commit 75ab30442a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -867,9 +867,12 @@ var tarteaucitron = {
}, },
"respond": function (el, status) { "respond": function (el, status) {
"use strict"; "use strict";
if (el.id === '') {
return;
}
var key = el.id.replace(new RegExp("(Eng[0-9]+|Allow|Deni)ed", "g"), ''); var key = el.id.replace(new RegExp("(Eng[0-9]+|Allow|Deni)ed", "g"), '');
if (key.substring(0, 13) == 'tarteaucitron' || key == "") {return;} if (key.substring(0, 13) === 'tarteaucitron' || key === '') {return;}
// return if same state // return if same state
if (tarteaucitron.state[key] === status) { if (tarteaucitron.state[key] === status) {