From 9778e04df5fe10f99988588156f333dee14c2591 Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Mon, 25 Nov 2013 12:46:16 -0800 Subject: [PATCH] Throw DuplicateDefintion error if a custom element is registered more than once --- src/CustomElements.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/CustomElements.js b/src/CustomElements.js index 49e5235..d9f4c7c 100644 --- a/src/CustomElements.js +++ b/src/CustomElements.js @@ -109,6 +109,10 @@ if (useNative) { // offer guidance) throw new Error('Options missing required prototype property'); } + // elements may only be registered once + if (registry[name]) { + throw new Error('DuplicateDefinitionError: a type with name \'' + String(name) + '\' is already registered'); + } // ensure a lifecycle object so we don't have to null test it definition.lifecycle = definition.lifecycle || {}; // build a list of ancestral custom elements (for native base detection)