@@ -13,7 +13,16 @@ module.exports = {
13
13
javaKeywords : [ 'for' , 'switch' ] , // TODO: if it's necessary add other keywords as well
14
14
findBehavior : function ( name ) {
15
15
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 ) ) {
17
26
return global . parsed [ i ] ;
18
27
}
19
28
}
@@ -104,10 +113,11 @@ module.exports = {
104
113
if ( / ^ e l e m e n t / i. test ( t ) ) return 'Element' ;
105
114
if ( / ^ n u m b e r / i. test ( t ) ) return 'double' ;
106
115
if ( / ^ f u n c t i o n / 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' ;
111
121
}
112
122
113
123
return "JavaScriptObject" ;
0 commit comments