From a56c882e2c139e74a9adaea0baa78fb1386cbf23 Mon Sep 17 00:00:00 2001 From: Yeting Li Date: Fri, 28 Jan 2022 19:27:26 +0800 Subject: [PATCH] Fix Inefficient Regular Expression for setZoomMode (#3368) --- src/jspdf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jspdf.js b/src/jspdf.js index d626c279a..fa3dd923d 100644 --- a/src/jspdf.js +++ b/src/jspdf.js @@ -894,7 +894,7 @@ function jsPDF(options) { "original" ]; - if (/^\d*\.?\d*%$/.test(zoom)) { + if (/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(zoom)) { zoomMode = zoom; } else if (!isNaN(zoom)) { zoomMode = parseInt(zoom, 10);