jQuery extend with prototypes
<p>Hi I am relatively new to jQuery and JavaScript and have a question regarding the functionality of <code>$.extend</code>.
I am using <code>extend</code> to overwrite the prototype of a class that extends a "base class".
Lets call the base <code>Parent</code> and the the children/extend classes <code>A</code> and <code>B</code>.
Now when I use <code>$.extend(true, A.prototype, {someObject: {extraKey: 'value'}});</code> it seems also the Prototype of <code>Parent</code> is changed regarding the contents of <code>someObject</code>, resulting in really odd behavior if several objects/classes inherit from parents. Also this only happens if the "deep" extending is used.</p>

<p>I managed to avoid this problem by extending an empty object with the respective prototype and then using the return value of extend as the new prototype. E.g. <code>A.prototype = $.extend(true, {}, A.prototype, {someObject: {extraKey: 'value'}});</code></p>

<p>To show the problem I created this small jsfiddle: <a href="http://jsfiddle.net/x8UtF/12/" rel="nofollow">http://jsfiddle.net/x8UtF/12/</a></p>

<p>The actual question: Is there a way to get around the empty objects and stuff to just go <code>extend(true, X.prototype, {});</code></p>
