Skip to content

Commit

Permalink
Fixes #2267: properly find dom-module for mixed case elements
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Orvell committed Aug 19, 2015
1 parent d25925b commit 76c58b8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/lib/dom-module.html
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
13 changes: 12 additions & 1 deletion test/unit/dom-module-elements.html
Expand Up @@ -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>
5 changes: 5 additions & 0 deletions test/unit/dom-module.html
Expand Up @@ -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>
Expand Down

0 comments on commit 76c58b8

Please sign in to comment.