This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +14
-3
lines changed
2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -193,8 +193,8 @@ function JQLiteDealoc(element){
193
193
}
194
194
}
195
195
196
- function JQLiteOff ( element , type , fn ) {
197
- if ( arguments . length > 4 ) throw jqLiteMinErr ( 'off_args' , 'jqLite#off() does not support the `selector` parameter ' ) ;
196
+ function JQLiteOff ( element , type , fn , selector ) {
197
+ if ( isDefined ( selector ) ) throw jqLiteMinErr ( 'off_args' , 'jqLite#off() does not support the `selector` argument ' ) ;
198
198
199
199
var events = JQLiteExpandoStore ( element , 'events' ) ,
200
200
handle = JQLiteExpandoStore ( element , 'handle' ) ;
Original file line number Diff line number Diff line change @@ -901,7 +901,7 @@ describe('jqLite', function() {
901
901
} ) ;
902
902
903
903
904
- describe ( 'unbind ' , function ( ) {
904
+ describe ( 'off ' , function ( ) {
905
905
it ( 'should do nothing when no listener was registered with bound' , function ( ) {
906
906
var aElem = jqLite ( a ) ;
907
907
@@ -1051,6 +1051,17 @@ describe('jqLite', function() {
1051
1051
expect ( masterSpy ) . not . toHaveBeenCalled ( ) ;
1052
1052
expect ( extraSpy ) . toHaveBeenCalledOnce ( ) ;
1053
1053
} ) ;
1054
+
1055
+ // Only run this test for jqLite and not normal jQuery
1056
+ if ( _jqLiteMode ) {
1057
+ it ( 'should throw an error if a selector is passed' , function ( ) {
1058
+ var aElem = jqLite ( a ) ;
1059
+ aElem . on ( 'click' , noop ) ;
1060
+ expect ( function ( ) {
1061
+ aElem . off ( 'click' , noop , '.test' ) ;
1062
+ } ) . toThrowMatching ( / \[ j q L i t e : o f f _ a r g s \] / ) ;
1063
+ } ) ;
1064
+ }
1054
1065
} ) ;
1055
1066
1056
1067
You can’t perform that action at this time.
0 commit comments