From 808f872d3b58fa1a89e256a3d6469186dcee8b17 Mon Sep 17 00:00:00 2001 From: Alexis Date: Tue, 29 May 2018 16:54:43 +0200 Subject: [PATCH] Function uniqueId always returns a 12 chars id --- src/htmlminifier.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/htmlminifier.js b/src/htmlminifier.js index 7550c72f..e41e48c2 100644 --- a/src/htmlminifier.js +++ b/src/htmlminifier.js @@ -726,7 +726,9 @@ function processOptions(values) { function uniqueId(value) { var id; do { - id = Math.random().toString(36).replace(/^0\.[0-9]*/, ''); + id = 'xxxxxxxxxxxx'.replace(/x/g, function () { + return (Math.random() * 16 | 0).toString(16); + }); } while (~value.indexOf(id)); return id; }