@@ -38,6 +38,9 @@ steal('can/construct', function( $ ) {
38
38
// Moves `this` to the first argument, wraps it with `jQuery` if it's an element
39
39
shifter = function shifter ( context , name ) {
40
40
var method = typeof name == "string" ? context [ name ] : name ;
41
+ if ( ! isFunction ( method ) ) {
42
+ method = context [ method ] ;
43
+ }
41
44
return function ( ) {
42
45
context . called = name ;
43
46
return method . apply ( context , [ this . nodeName ? can . $ ( this ) : this ] . concat ( slice . call ( arguments , 0 ) ) ) ;
@@ -75,11 +78,7 @@ steal('can/construct', function( $ ) {
75
78
76
79
// Calculate and cache actions.
77
80
control . actions = { } ;
78
-
79
81
for ( funcName in control . prototype ) {
80
- if ( funcName == 'constructor' || ! isFunction ( control . prototype [ funcName ] ) ) {
81
- continue ;
82
- }
83
82
if ( control . _isAction ( funcName ) ) {
84
83
control . actions [ funcName ] = control . _action ( funcName ) ;
85
84
}
@@ -93,7 +92,15 @@ steal('can/construct', function( $ ) {
93
92
* @return {Boolean } truthy if an action or not
94
93
*/
95
94
_isAction : function ( methodName ) {
96
- return ! ! ( special [ methodName ] || processors [ methodName ] || / [ ^ \w ] / . test ( methodName ) ) ;
95
+
96
+ var val = this . prototype [ methodName ] ,
97
+ type = typeof val ;
98
+ // if not the constructor
99
+ return ( methodName !== 'constructor' ) &&
100
+ // and is a function or links to a function
101
+ ( type == "function" || ( type == "string" && isFunction ( this . prototype [ val ] ) ) ) &&
102
+ // and is in special, a processor, or has a funny character
103
+ ! ! ( special [ methodName ] || processors [ methodName ] || / [ ^ \w ] / . test ( methodName ) ) ;
97
104
} ,
98
105
// Takes a method name and the options passed to a control
99
106
// and tries to return the data necessary to pass to a processor
@@ -123,7 +130,7 @@ steal('can/construct', function( $ ) {
123
130
124
131
// If we don't have options (a `control` instance), we'll run this
125
132
// later.
126
- paramReplacer . lastIndex = 0 ;
133
+ paramReplacer . lastIndex = 0 ;
127
134
if ( options || ! paramReplacer . test ( methodName ) ) {
128
135
// If we have options, run sub to replace templates `{}` with a
129
136
// value from the options or the window
0 commit comments