mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
HAS_SIDE_EFFECTS properties must compare as property type
This commit is contained in:
1 parent
32b84a4c5e
commit
3b94abcb3b
1 file changed
+9
-2
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user