isFunction.js (674B)
1 define( function() { 2 "use strict"; 3 4 return function isFunction( obj ) { 5 6 // Support: Chrome <=57, Firefox <=52 7 // In some browsers, typeof returns "function" for HTML <object> elements 8 // (i.e., `typeof document.createElement( "object" ) === "function"`). 9 // We don't want to classify *any* DOM node as a function. 10 // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 11 // Plus for old WebKit, typeof returns "function" for HTML collections 12 // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) 13 return typeof obj === "function" && typeof obj.nodeType !== "number" && 14 typeof obj.item !== "function"; 15 }; 16 17 } );