kivi.detect_duplicate_ids_in_dom: Funktion zum Auffinden doppelter IDs im DOM
[kivitendo-erp.git] / js / kivi.js
index c456bd7..1738422 100644 (file)
@@ -415,6 +415,22 @@ namespace("kivi", function(ns) {
     console.error('kivi.run("' + function_name + '"): No function by that name found');
     return undefined;
   };
+
+  ns.detect_duplicate_ids_in_dom = function() {
+    var ids   = {},
+        found = false;
+
+    $('[id]').each(function() {
+      if (this.id && ids[this.id]) {
+        found = true;
+        console.warn('Duplicate ID #' + this.id);
+      }
+      ids[this.id] = 1;
+    });
+
+    if (!found)
+      console.log('No duplicate IDs found :)');
+  };
 });
 
 kivi = namespace('kivi');