This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +21
-1
lines changed
2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -601,7 +601,7 @@ var trim = (function() {
601
601
function isElement ( node ) {
602
602
return ! ! ( node &&
603
603
( node . nodeName // we are a direct element
604
- || ( node . on && node . find ) ) ) ; // we have an on and find method part of jQuery API
604
+ || ( node . prop && node . attr && node . find ) ) ) ; // we have an on and find method part of jQuery API
605
605
}
606
606
607
607
/**
Original file line number Diff line number Diff line change @@ -1127,5 +1127,25 @@ describe('angular', function() {
1127
1127
expect ( result ) . toEqual ( expected [ idx ] ) ;
1128
1128
} ) ;
1129
1129
} ) ) ;
1130
+
1131
+ // Issue #4805
1132
+ it ( 'should return false for objects resembling a Backbone Collection' , function ( ) {
1133
+ // Backbone stuff is sort of hard to mock, if you have a better way of doing this,
1134
+ // please fix this.
1135
+ var fakeBackboneCollection = {
1136
+ children : [ { } , { } , { } ] ,
1137
+ find : function ( ) { } ,
1138
+ on : function ( ) { } ,
1139
+ off : function ( ) { } ,
1140
+ bind : function ( ) { }
1141
+ } ;
1142
+ expect ( isElement ( fakeBackboneCollection ) ) . toBe ( false ) ;
1143
+ } ) ;
1144
+
1145
+ it ( 'should return false for arrays with node-like properties' , function ( ) {
1146
+ var array = [ 1 , 2 , 3 ] ;
1147
+ array . on = true ;
1148
+ expect ( isElement ( array ) ) . toBe ( false ) ;
1149
+ } ) ;
1130
1150
} ) ;
1131
1151
} ) ;
You can’t perform that action at this time.
0 commit comments