From 760ff1a357aeeda67867f42b7ba000e64781bcb4 Mon Sep 17 00:00:00 2001 From: Andrew Kushnir Date: Fri, 13 Oct 2023 17:07:42 -0700 Subject: [PATCH] refactor(core): simplify hydration annotation key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit drops the `ɵ` symbol from hydration annotation key: `__ɵnghData__` -> `__nghData__`. This helps ensure that there are no UTF8 symbols that might be damaged in case a web server is misconfigured. Noticed while working on https://github.com/angular/angular/pull/52206. --- packages/core/src/hydration/utils.ts | 2 +- packages/platform-server/test/hydration_spec.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/hydration/utils.ts b/packages/core/src/hydration/utils.ts index a6980bf371990..9d288ca2ccec5 100644 --- a/packages/core/src/hydration/utils.ts +++ b/packages/core/src/hydration/utils.ts @@ -23,7 +23,7 @@ import {CONTAINERS, DehydratedView, DISCONNECTED_NODES, ELEMENT_CONTAINERS, MULT * The name of the key used in the TransferState collection, * where hydration information is located. */ -const TRANSFER_STATE_TOKEN_ID = '__ɵnghData__'; +const TRANSFER_STATE_TOKEN_ID = '__nghData__'; /** * Lookup key used to reference DOM hydration data (ngh) in `TransferState`. diff --git a/packages/platform-server/test/hydration_spec.ts b/packages/platform-server/test/hydration_spec.ts index c42880d87d851..cbdb911864f3b 100644 --- a/packages/platform-server/test/hydration_spec.ts +++ b/packages/platform-server/test/hydration_spec.ts @@ -34,7 +34,7 @@ const TEXT_NODE_SEPARATOR_COMMENT = 'ngtns'; const SKIP_HYDRATION_ATTR_NAME = 'ngSkipHydration'; const SKIP_HYDRATION_ATTR_NAME_LOWER_CASE = SKIP_HYDRATION_ATTR_NAME.toLowerCase(); -const TRANSFER_STATE_TOKEN_ID = '__ɵnghData__'; +const TRANSFER_STATE_TOKEN_ID = '__nghData__'; const NGH_ATTR_REGEXP = new RegExp(` ${NGH_ATTR_NAME}=".*?"`, 'g'); const EMPTY_TEXT_NODE_REGEXP = new RegExp(``, 'g');