From a0e59e43ab8c330e3617929db29d6b53efb22286 Mon Sep 17 00:00:00 2001 From: Jim Date: Tue, 7 Jun 2016 10:28:51 -0700 Subject: [PATCH] Remove dead HAS_SIDE_EFFECTS logic --- src/renderers/dom/shared/DOMProperty.js | 13 ------------- .../dom/shared/DOMPropertyOperations.js | 18 ++++-------------- 2 files changed, 4 insertions(+), 27 deletions(-) diff --git a/src/renderers/dom/shared/DOMProperty.js b/src/renderers/dom/shared/DOMProperty.js index 8e0f3ff316cfc..068638ad6b7cb 100644 --- a/src/renderers/dom/shared/DOMProperty.js +++ b/src/renderers/dom/shared/DOMProperty.js @@ -23,7 +23,6 @@ var DOMPropertyInjection = { * specifies how the associated DOM property should be accessed or rendered. */ MUST_USE_PROPERTY: 0x1, - HAS_SIDE_EFFECTS: 0x2, HAS_BOOLEAN_VALUE: 0x4, HAS_NUMERIC_VALUE: 0x8, HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8, @@ -91,7 +90,6 @@ var DOMPropertyInjection = { mutationMethod: null, mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY), - hasSideEffects: checkMask(propConfig, Injection.HAS_SIDE_EFFECTS), hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE), hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE), hasPositiveNumericValue: @@ -99,12 +97,6 @@ var DOMPropertyInjection = { hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE), }; - - invariant( - propertyInfo.mustUseProperty || !propertyInfo.hasSideEffects, - 'DOMProperty: Properties that have side effects must use property: %s', - propName - ); invariant( propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1, @@ -183,11 +175,6 @@ var DOMProperty = { * initial render. * mustUseProperty: * Whether the property must be accessed and mutated as an object property. - * hasSideEffects: - * Whether or not setting a value causes side effects such as triggering - * resources to be loaded or text selection changes. If true, we read from - * the DOM before updating to ensure that the value is only set if it has - * changed. * hasBooleanValue: * Whether the property should be removed when set to a falsey value. * hasNumericValue: diff --git a/src/renderers/dom/shared/DOMPropertyOperations.js b/src/renderers/dom/shared/DOMPropertyOperations.js index c242f4b0ed9ce..d0cce18dcf9b2 100644 --- a/src/renderers/dom/shared/DOMPropertyOperations.js +++ b/src/renderers/dom/shared/DOMPropertyOperations.js @@ -145,15 +145,9 @@ var DOMPropertyOperations = { this.deleteValueForProperty(node, name); return; } else if (propertyInfo.mustUseProperty) { - var propName = propertyInfo.propertyName; - // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the - // property type before comparing; only `value` does and is string. - if (!propertyInfo.hasSideEffects || - ('' + node[propName]) !== ('' + value)) { - // Contrary to `setAttribute`, object properties are properly - // `toString`ed by IE8/9. - node[propName] = value; - } + // Contrary to `setAttribute`, object properties are properly + // `toString`ed by IE8/9. + node[propertyInfo.propertyName] = value; } else { var attributeName = propertyInfo.attributeName; var namespace = propertyInfo.attributeNamespace; @@ -240,13 +234,9 @@ var DOMPropertyOperations = { } else if (propertyInfo.mustUseProperty) { var propName = propertyInfo.propertyName; if (propertyInfo.hasBooleanValue) { - // No HAS_SIDE_EFFECTS logic here, only `value` has it and is string. node[propName] = false; } else { - if (!propertyInfo.hasSideEffects || - ('' + node[propName]) !== '') { - node[propName] = ''; - } + node[propName] = ''; } } else { node.removeAttribute(propertyInfo.attributeName);