Skip to content

Commit 54abb3a

Browse files
Fix null reference in toType
If the regex doesn't match, this should return 'object'. Currently, in web views on Android 5, input elements return `[object ]` when `toString` is called.
1 parent fff677c commit 54abb3a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

source/quo.coffee

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@ Quo = do ->
7373
target[key] = source[key] for key of source
7474
target
7575

76-
$$.toType = (obj) ->
77-
OBJECT_PROTOTYPE.toString.call(obj).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()
76+
$$.toType = (obj) -> $$.toType = (obj) ->
77+
match = OBJECT_PROTOTYPE.toString.call(obj).match(/\s([a-z|A-Z])/);
78+
if match then match[1].toLowerCase() else 'object'
7879

7980
$$.each = (elements, callback) ->
8081
i = undefined

0 commit comments

Comments
 (0)