From 176d0329a475b70ad8b593f3c9f8e7a62c345c14 Mon Sep 17 00:00:00 2001 From: Bo Lopker Date: Thu, 10 Sep 2015 13:36:03 -0700 Subject: [PATCH] Clean up cleanupID logic, use null prototype for maps Reduce string creation Add test for __proto__ --- plugins/cleanupIDs.js | 131 ++++++++++++++++----------------- test/plugins/cleanupIDs.04.svg | 8 +- 2 files changed, 69 insertions(+), 70 deletions(-) diff --git a/plugins/cleanupIDs.js b/plugins/cleanupIDs.js index f53b4ca4..af041cf9 100644 --- a/plugins/cleanupIDs.js +++ b/plugins/cleanupIDs.js @@ -36,8 +36,8 @@ exports.fn = function(data, params) { var currentID, currentIDstring, - IDs = {}, - referencesIDs = {}, + IDs = Object.create(null), + referencesIDs = Object.create(null), idPrefix = 'id-', // prefix IDs so that values like '__proto__' don't break the work hasStyleOrScript = false; @@ -57,58 +57,58 @@ exports.fn = function(data, params) { // check if