Skip to main content

Bug Tracker

Side navigation

#5275 closed enhancement (wontfix)

Opened September 21, 2009 08:56AM UTC

Closed November 19, 2010 10:14AM UTC

jquery.extend should set displayName on functions

Reported by: dwt Owned by:
Priority: minor Milestone: 1.4
Component: core Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:

Both Firebug and the Safari debugger support the convention that if a function has the displayName propperty set, that will be used to display it's name in the debugger.

(see :

This is mightily usefull as one doesn't get as many 'anonymous functions) in the stacktrace which makes it much easier to work with it.

Here's a monkey-patched version that does enough to make it useful for me - but this should really be in the core of jQuery Extend:

(function() {
	var oldExtend = $.fn.extend;
	function isSecondArgumentDictionary(arguments) {
		var methodDict = arguments[1];
		return (2 === arguments.length)
			&& (null !== methodDict || 'object' === typeof(methodDict));
	$.extend = function namingExtend() {
		if (isSecondArgumentDictionary(arguments)) {
			var methodDict = arguments[1];
			for (var key in arguments[1]) {
				if ($.isFunction(methodDict[key]) 
					&& ! methodDict[key].displayName)
					methodDict[key].displayName = key;
		return oldExtend.apply(this, arguments);
Attachments (0)
Change History (3)

Changed September 24, 2009 02:32AM UTC by dmethvin comment:1

priority: majorminor
type: bugenhancement

Changed November 24, 2009 10:58AM UTC by dwt comment:2

Does this have any chance of getting into core? I gather it is very usefull to all users while not having any incompatibility problems at all.

Changed November 19, 2010 10:14AM UTC by snover comment:3

resolution: → wontfix
status: newclosed

This should go into a debug plugin, not core.