From 52552b0520bcb079c96812bdaf5a8a1a106d2fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matias=20Niemel=C3=A4?= Date: Thu, 19 Sep 2019 12:59:12 -0700 Subject: [PATCH] perf(ivy): remove extra SafeStyle detection code (#32775) PR Close #32775 --- .../core/src/render3/styling/styling_debug.ts | 2 +- packages/core/src/render3/util/styling_utils.ts | 17 ++--------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/packages/core/src/render3/styling/styling_debug.ts b/packages/core/src/render3/styling/styling_debug.ts index f7a4327ca3..f255056df3 100644 --- a/packages/core/src/render3/styling/styling_debug.ts +++ b/packages/core/src/render3/styling/styling_debug.ts @@ -10,7 +10,7 @@ import {RElement} from '../interfaces/renderer'; import {ApplyStylingFn, LStylingData, TStylingConfig, TStylingContext, TStylingContextIndex} from '../interfaces/styling'; import {getCurrentStyleSanitizer} from '../state'; import {attachDebugObject} from '../util/debug_utils'; -import {allowDirectStyling as _allowDirectStyling, getDefaultValue, getGuardMask, getProp, getPropValuesStartPosition, getValuesCount, hasConfig, isContextLocked, isMapBased, isSanitizationRequired} from '../util/styling_utils'; +import {allowDirectStyling as _allowDirectStyling, getDefaultValue, getGuardMask, getProp, getPropValuesStartPosition, getValuesCount, hasConfig, isContextLocked, isSanitizationRequired} from '../util/styling_utils'; import {applyStylingViaContext} from './bindings'; import {activateStylingMapFeature} from './map_based_bindings'; diff --git a/packages/core/src/render3/util/styling_utils.ts b/packages/core/src/render3/util/styling_utils.ts index 6b7bb8376d..bcb98e814f 100644 --- a/packages/core/src/render3/util/styling_utils.ts +++ b/packages/core/src/render3/util/styling_utils.ts @@ -166,27 +166,14 @@ export function getPropValuesStartPosition(context: TStylingContext) { return startPosition; } -export function isMapBased(prop: string) { - return prop === MAP_BASED_ENTRY_PROP_NAME; -} - export function hasValueChanged( a: NO_CHANGE | StylingMapArray | number | String | string | null | boolean | undefined | {}, b: NO_CHANGE | StylingMapArray | number | String | string | null | boolean | undefined | {}): boolean { if (b === NO_CHANGE) return false; - let compareValueA = Array.isArray(a) ? a[StylingMapArrayIndex.RawValuePosition] : a; - let compareValueB = Array.isArray(b) ? b[StylingMapArrayIndex.RawValuePosition] : b; - - // these are special cases for String based values (which are created as artifacts - // when sanitization is bypassed on a particular value) - if (compareValueA instanceof String) { - compareValueA = compareValueA.toString(); - } - if (compareValueB instanceof String) { - compareValueB = compareValueB.toString(); - } + const compareValueA = Array.isArray(a) ? a[StylingMapArrayIndex.RawValuePosition] : a; + const compareValueB = Array.isArray(b) ? b[StylingMapArrayIndex.RawValuePosition] : b; return !Object.is(compareValueA, compareValueB); }