r3543 committed - Widget factory: Fixed a bug where inheritance was modifying the base p...
Revision: 3543
Author: scott.gonzalez
Date: Sun Dec 27 21:48:13 2009
Log: Widget factory: Fixed a bug where inheritance was modifying the base
prototype's options hash.
http://code.google.com/p/jquery-ui/source/detail?r=3543
Modified:
/branches/dev/ui/jquery.ui.widget.js
=======================================
--- /branches/dev/ui/jquery.ui.widget.js Wed Dec 23 02:45:37 2009
+++ /branches/dev/ui/jquery.ui.widget.js Sun Dec 27 21:48:13 2009
@@ -41,7 +41,13 @@
// allow instantiation without initializing for simple inheritance
(arguments.length && this._widgetInit(options, element));
};
- $[namespace][name].prototype = $.extend(true, new base(), {
+
+ var basePrototype = new base();
+ // we need to make the options hash a property directly on the new
instance
+ // otherwise we'll modify the options hash on the prototype that we're
+ // inheriting from
+ basePrototype.options = $.extend({}, basePrototype.options);
+ $[namespace][name].prototype = $.extend(true, basePrototype, {
namespace: namespace,
widgetName: name,
widgetEventPrefix: $[namespace][name].prototype.widgetEventPrefix ||
name,
--