From 76c58b80836e26c38bd7bd4e71948c10f7273868 Mon Sep 17 00:00:00 2001 From: Steven Orvell Date: Tue, 18 Aug 2015 18:41:54 -0700 Subject: [PATCH] Fixes #2267: properly find dom-module for mixed case elements --- src/lib/dom-module.html | 7 +++++-- test/unit/dom-module-elements.html | 13 ++++++++++++- test/unit/dom-module.html | 5 +++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/lib/dom-module.html b/src/lib/dom-module.html index b3b438a789..7dd04fee5c 100644 --- a/src/lib/dom-module.html +++ b/src/lib/dom-module.html @@ -4,6 +4,9 @@ var modules = {}; var lcModules = {}; + var findModule = function(id) { + return modules[id] || lcModules[id.toLowerCase()]; + } /** * The `dom-module` element registers the dom it contains to the name given @@ -64,13 +67,13 @@ * at the specified `id`. */ import: function(id, selector) { - var m = modules[id] || lcModules[id.toLowerCase()]; + var m = findModule(id); if (!m) { // If polyfilling, a script can run before a dom-module element // is upgraded. We force the containing document to upgrade // and try again to workaround this polyfill limitation. forceDocumentUpgrade(); - m = modules[id]; + m = findModule(id); } if (m && selector) { m = m.querySelector(selector); diff --git a/test/unit/dom-module-elements.html b/test/unit/dom-module-elements.html index cd552e70e3..f9916cf143 100644 --- a/test/unit/dom-module-elements.html +++ b/test/unit/dom-module-elements.html @@ -4,4 +4,15 @@ case -Case \ No newline at end of file +Case + + + + + \ No newline at end of file diff --git a/test/unit/dom-module.html b/test/unit/dom-module.html index 19f9f5f1b7..cfab914ad0 100644 --- a/test/unit/dom-module.html +++ b/test/unit/dom-module.html @@ -51,6 +51,11 @@ assert.equal(Polymer.DomModule.import('Case').textContent, 'Case'); }); + test('mixed case element creation', function() { + t = new TestElement(); + assert.ok(t.$.content); + }) + });