Forráskód Böngészése

Don't run a replace() when not needed

Also, replace "==" by "===": it's better, cleaner and consistent with the rest of the code.
O2 Graphics 4 éve
szülő
commit
2e88cbbd9f
1 módosított fájl, 4 hozzáadás és 1 törlés
  1. 4 1
      tarteaucitron.js

+ 4 - 1
tarteaucitron.js

@@ -867,9 +867,12 @@ var tarteaucitron = {
         },
         "respond": function (el, status) {
             "use strict";
+            if (el.id === '') {
+                return;
+            }
             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
             if (tarteaucitron.state[key] === status) {