We can not simply replace "copying" with "inheriting". It is
semantically too different, and it would break almost every current
usage of deep cloning.
jQuery.extend is usually used to create a "snapshot" of an object (the
new object would not change if the original one is afterward altered).
Using "object inheritance" instead, would propagate new properties to
cloned objects too.
Eventually, we could introduce a new signature to jQuery.extend:
- jQuery.extend( true, true, objA, objB, objC );
where the second "true" would indicate that deep cloning will be performed via Object.create or a similar one.
However, there is a possible problem: currently deep extending will also
extent every arrays too, and we can not create new arrays inheriting other
arrays. Solutions for such cases would probably be: a) inheriting arrays
to obtain objects; or b) do not extend arrays on deep extending at all
(that for me is insane anyway).
EDIT: Of course, there would be also: c) continue to extend new arrays even with the second argument equal to true.