Permalink
Browse files

jQuery.print: add support for NaN; remove $.isFunction ($.isFunction(…

…jQuery) is false); use .nodeType to detect DOM elements (no HTMLElement in IE6)
  • Loading branch information...
tmm1 committed May 12, 2008
1 parent 4e47ead commit 4627630985856558ea140a9417c50ce447bf0469
Showing with 7 additions and 3 deletions.
  1. +7 −3 lib/jquery.print.js
View
@@ -94,19 +94,23 @@
else if (typeof obj == 'boolean')
return obj.toString()
+ else if (!obj && typeof obj == 'number')
+ return 'NaN'
+
else if (!obj)
return "null"
else if (typeof obj == 'string')
return print_string(obj, opts)
- else if ($.isFunction(obj))
- return obj.toString().match(/^([^\{]*)\s{/)[1]
+ else if (typeof obj == 'function' || obj instanceof Function)
+ return (m = obj.toString().match(/^([^\{]*?)\s*{/)) ? m[1].replace(' (','(') : 'function()'
else if (obj instanceof Array)
return print_array(obj, opts)
- else if (obj instanceof HTMLElement)
+ // no HTMLElement in IE6
+ else if (obj.nodeType)
return print_element(obj)
else if (obj instanceof jQuery)

0 comments on commit 4627630

Please sign in to comment.