# nodeuuid.js **Repository Path**: mail_osc/nodeuuid.js ## Basic Information - **Project Name**: nodeuuid.js - **Description**: 将html中的node节点生成其唯一标识 uuid ,不污染html本身。 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2023-08-24 - **Last Updated**: 2025-01-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # nodeuuid 将html中的node节点生成其唯一标识 uuid ,不污染html本身。 将页面中的所有node节点,生成其在当前页面的唯一标识字符串uuid。 # 原理 原理: 当前节点的nodeName + 当前节点在父节点下,属于第几个 tagName ,然后追个向父级进行取,将node本身+父级+父父级+.... 拼接在一起 # 快速测试 运行 demo.html 即可 运行后控制台输出: ```` ---------------- uuid : HTML1_BODY1_DIV1_P1

哈喽

​ ---------------- uuid : HTML1_BODY1_DIV1_P2

世界

​ ````