HAS_SIDE_EFFECTS properties must compare as property type

This commit is contained in:
Andreas Svensson committed 2014-07-24 11:53:02 +02:00
1 parent 32b84a4c5e
commit 3b94abcb3b
1 file changed
+9 -2
+9 -2
View File
@@ -130,10 +130,17 @@ var DOMPropertyOperations = {
} else if (shouldIgnoreValue(name, value)) {
this.deleteValueForProperty(node, name);
} else if (DOMProperty.mustUseAttribute[name]) {
// `setAttribute` with objects becomes only `[object]` in IE8/9,
// ('' + value) makes it output the correct toString()-value.
node.setAttribute(DOMProperty.getAttributeName[name], '' + value);
} else {
var propName = DOMProperty.getPropertyName[name];
if (!DOMProperty.hasSideEffects[name] || node[propName] !== value) {
// Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
// property type before comparing; only `value` does and is string.
if (!DOMProperty.hasSideEffects[name] ||
('' + node[propName]) !== ('' + value)) {
// Contrary to `setAttribute`, object properties are properly
// `toString`ed by IE8/9.
node[propName] = value;
}
}
@@ -168,7 +175,7 @@ var DOMPropertyOperations = {
propName
);
if (!DOMProperty.hasSideEffects[name] ||
node[propName] !== defaultValue) {
('' + node[propName]) !== defaultValue) {
node[propName] = defaultValue;
}
}