Customizer: Revert [26548], removing _.isEqual() for proper object comparison.

This broke the customizer in IE 11, with possibly other side effects. Revisit in 3.9.

Also reverts [26632].

see #26061 (reopens), fixes #26438.

Built from https://develop.svn.wordpress.org/trunk@26702


git-svn-id: http://core.svn.wordpress.org/trunk@26592 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-12-05 23:13:10 +00:00
parent 1a34e361ac
commit e7f80a8fad
2 changed files with 2 additions and 73 deletions

View File

@ -176,7 +176,7 @@ window.wp = window.wp || {};
to = this.validate( to ); to = this.validate( to );
// Bail if the sanitized value is null or unchanged. // Bail if the sanitized value is null or unchanged.
if ( null === to || this.isEqual( to ) ) if ( null === to || this._value === to )
return this; return this;
this._value = to; this._value = to;
@ -251,77 +251,6 @@ window.wp = window.wp || {};
this.unlink( that ); this.unlink( that );
}); });
return this; return this;
},
/**
* Internal recursive comparison function for `isEqual`.
* Copied from Underscore.js.
*/
/* jshint ignore:start */
_eq: function(a, b, aStack, bStack) {
if (a === b) return a !== 0 || 1 / a == 1 / b;
if (a == null || b == null) return a === b;
var className = toString.call(a);
if (className != toString.call(b)) return false;
switch (className) {
case '[object String]':
return a == String(b);
case '[object Number]':
return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b);
case '[object Date]':
case '[object Boolean]':
return +a == +b;
case '[object RegExp]':
return a.source == b.source &&
a.global == b.global &&
a.multiline == b.multiline &&
a.ignoreCase == b.ignoreCase;
}
if (typeof a != 'object' || typeof b != 'object') return false;
var length = aStack.length;
while (length--) {
if (aStack[length] == a) return bStack[length] == b;
}
var aCtor = a.constructor, bCtor = b.constructor;
if (aCtor !== bCtor && !((typeof aCtor === 'function') && (aCtor instanceof aCtor) &&
(typeof bCtor === 'function') && (bCtor instanceof bCtor))) {
return false;
}
aStack.push(a);
bStack.push(b);
var size = 0, result = true;
if (className == '[object Array]') {
size = a.length;
result = size == b.length;
if (result) {
while (size--) {
if (!(result = this._eq(a[size], b[size], aStack, bStack))) break;
}
}
} else {
for (var key in a) {
if (hasOwnProperty.call(a, key)) {
size++;
if (!(result = hasOwnProperty.call(b, key) && this._eq(a[key], b[key], aStack, bStack))) break;
}
}
if (result) {
for (key in b) {
if (hasOwnProperty.call(b, key) && !(size--)) break;
}
result = !size;
}
}
aStack.pop();
bStack.pop();
return result;
},
/* jshint ignore:end */
isEqual: function( to ) {
return this._eq( this._value, to, [], [] );
} }
}); });

File diff suppressed because one or more lines are too long