Skip to content

Commit d8ba970

Browse files
committed
Fix for uppercased behaviors
1 parent afa485a commit d8ba970

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

template/helpers.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@ module.exports = {
1313
javaKeywords: ['for', 'switch'], // TODO: if it's necessary add other keywords as well
1414
findBehavior: function(name) {
1515
for (var i = 0; name && i < global.parsed.length; i++) {
16-
if (this.className(global.parsed[i].is) == this.className(name)) {
16+
var item = global.parsed[i];
17+
if (this.isBehavior(item) && this.className(item.is) == this.className(name)) {
18+
return global.parsed[i];
19+
}
20+
}
21+
},
22+
findElement: function(name) {
23+
for (var i = 0; name && i < global.parsed.length; i++) {
24+
var item = global.parsed[i];
25+
if (!this.isBehavior(item) && this.className(item.is) == this.className(name)) {
1726
return global.parsed[i];
1827
}
1928
}
@@ -104,10 +113,11 @@ module.exports = {
104113
if (/^element/i.test(t)) return 'Element';
105114
if (/^number/i.test(t)) return 'double';
106115
if (/^function/i.test(t)) return 'Function';
107-
var b = this.findBehavior(t);
108-
if (b) {
109-
var c = this.camelCase(t);
110-
return c != t ? c + 'Element' : c;
116+
if (this.findBehavior(t)) {
117+
return this.camelCase(t);
118+
}
119+
if (this.findElement(t)) {
120+
return this.camelCase(t) + 'Element';
111121
}
112122

113123
return "JavaScriptObject";

0 commit comments

Comments
 (0)