Skip to content

Commit

Permalink
refactor(core): simplify hydration annotation key
Browse files Browse the repository at this point in the history
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 angular#52206.
  • Loading branch information
AndrewKushnir committed Oct 14, 2023
1 parent d32767d commit 760ff1a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/hydration/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion packages/platform-server/test/hydration_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(`<!--${EMPTY_TEXT_NODE_COMMENT}-->`, 'g');
Expand Down

0 comments on commit 760ff1a

Please sign in to comment.