Skip to content
Browse files

Fixes #2267: properly find dom-module for mixed case elements

  • Loading branch information...
1 parent d25925b commit 76c58b80836e26c38bd7bd4e71948c10f7273868 @sorvell sorvell committed
Showing with 22 additions and 3 deletions.
  1. +5 −2 src/lib/dom-module.html
  2. +12 −1 test/unit/dom-module-elements.html
  3. +5 −0 test/unit/dom-module.html
View
7 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);
View
13 test/unit/dom-module-elements.html
@@ -4,4 +4,15 @@
<dom-module id="case">case</dom-module>
-<dom-module id="Case">Case</dom-module>
+<dom-module id="Case">Case</dom-module>
+
+<dom-module id="Test-element">
+ <template>
+ <span id="content">test uppercase</span>
+ </template>
+</dom-module>
+<script>
+ TestElement = Polymer({
+ is: 'Test-element'
+ });
+</script>
View
5 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);
+ })
+
});
</script>

0 comments on commit 76c58b8

Please sign in to comment.
Something went wrong with that request. Please try again.