Skip to content

Commit

Permalink
isFunction: Fix incorrect behaviour for async functions
Browse files Browse the repository at this point in the history
  • Loading branch information
tadatuta committed Jun 9, 2018
1 parent 72ec2ab commit 7ca3278
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion common.blocks/functions/functions.vanilla.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ provide(/** @exports */{
* @returns {Boolean}
*/
isFunction : function(obj) {
return toStr.call(obj) === '[object Function]';
// In some browsers, typeof returns "function" for HTML <object> elements
// (i.e., `typeof document.createElement( "object" ) === "function"`).
// We don't want to classify *any* DOM node as a function.
return typeof obj === 'function' && typeof obj.nodeType !== 'number';
},

/**
Expand Down

0 comments on commit 7ca3278

Please sign in to comment.