6
6
* http://www.opensource.org/licenses/mit-license.php
7
7
* http://www.gnu.org/licenses/gpl.html
8
8
*
9
- * @version 1.0.1
9
+ * @version 1.0.2
10
10
* @requires $.identify
11
11
* @requires $.inherit
12
12
*/
@@ -41,6 +41,7 @@ var storageExpando = '__' + +new Date + 'storage',
41
41
*/
42
42
on : function ( e , data , fn , ctx , _special ) {
43
43
44
+ var _this = this ;
44
45
if ( typeof e == 'string' ) {
45
46
if ( $ . isFunction ( data ) ) {
46
47
ctx = fn ;
@@ -49,13 +50,13 @@ var storageExpando = '__' + +new Date + 'storage',
49
50
}
50
51
51
52
var id = getFnId ( fn , ctx ) ,
52
- storage = this [ storageExpando ] || ( this [ storageExpando ] = { } ) ,
53
+ storage = _this [ storageExpando ] || ( _this [ storageExpando ] = { } ) ,
53
54
eList = e . split ( ' ' ) ,
54
55
i = 0 ,
55
56
eStorage ;
56
57
57
58
while ( e = eList [ i ++ ] ) {
58
- e = this . buildEventName ( e ) ;
59
+ e = _this . buildEventName ( e ) ;
59
60
eStorage = storage [ e ] || ( storage [ e ] = { ids : { } , list : { } } ) ;
60
61
61
62
if ( ! ( id in eStorage . ids ) ) {
@@ -72,13 +73,12 @@ var storageExpando = '__' + +new Date + 'storage',
72
73
}
73
74
}
74
75
} else {
75
- var _this = this ;
76
76
$ . each ( e , function ( e , fn ) {
77
77
_this . on ( e , fn , data , _special ) ;
78
78
} ) ;
79
79
}
80
80
81
- return this ;
81
+ return _this ;
82
82
83
83
} ,
84
84
@@ -97,15 +97,16 @@ var storageExpando = '__' + +new Date + 'storage',
97
97
*/
98
98
un : function ( e , fn , ctx ) {
99
99
100
+ var _this = this ;
100
101
if ( typeof e == 'string' || typeof e == 'undefined' ) {
101
- var storage = this [ storageExpando ] ;
102
+ var storage = _this [ storageExpando ] ;
102
103
if ( storage ) {
103
104
if ( e ) { // если передан тип события
104
105
var eList = e . split ( ' ' ) ,
105
106
i = 0 ,
106
107
eStorage ;
107
108
while ( e = eList [ i ++ ] ) {
108
- e = this . buildEventName ( e ) ;
109
+ e = _this . buildEventName ( e ) ;
109
110
if ( eStorage = storage [ e ] ) {
110
111
if ( fn ) { // если передан конкретный обработчик
111
112
var id = getFnId ( fn , ctx ) ,
@@ -133,22 +134,21 @@ var storageExpando = '__' + +new Date + 'storage',
133
134
delete ids [ id ] ;
134
135
}
135
136
} else {
136
- delete this [ storageExpando ] [ e ] ;
137
+ delete _this [ storageExpando ] [ e ] ;
137
138
}
138
139
}
139
140
}
140
141
} else {
141
- delete this [ storageExpando ] ;
142
+ delete _this [ storageExpando ] ;
142
143
}
143
144
}
144
145
} else {
145
- var _this = this ;
146
146
$ . each ( e , function ( e , fn ) {
147
147
_this . un ( e , fn , ctx ) ;
148
148
} ) ;
149
149
}
150
150
151
- return this ;
151
+ return _this ;
152
152
153
153
} ,
154
154
@@ -190,7 +190,7 @@ var storageExpando = '__' + +new Date + 'storage',
190
190
}
191
191
}
192
192
193
- return this ;
193
+ return _this ;
194
194
195
195
}
196
196
0 commit comments