From 54f4b33e26aedcda51f21489f4d9ac0570c9dde2 Mon Sep 17 00:00:00 2001 From: GreLI Date: Sun, 1 Feb 2015 22:58:43 +0300 Subject: [PATCH] Fix for id prefixing --- plugins/cleanupIDs.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/cleanupIDs.js b/plugins/cleanupIDs.js index dcc0766c..71141d92 100644 --- a/plugins/cleanupIDs.js +++ b/plugins/cleanupIDs.js @@ -18,7 +18,6 @@ var referencesProps = require('./_collections').referencesProps, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ], - idPrefix = 'id-', // prefix IDs so that values like '__proto__' don't break the work maxIDindex = generateIDchars.length - 1; /** @@ -36,6 +35,7 @@ exports.fn = function(data, params) { currentIDstring, IDs = {}, referencesIDs = {}, + idPrefix = 'id-', // prefix IDs so that values like '__proto__' don't break the work hasStyleOrScript = false; /** @@ -75,7 +75,7 @@ exports.fn = function(data, params) { match = attr.value.match(regReferencesUrl); if (match) { - if (referencesIDs[match[1]]) { + if (referencesIDs[idPrefix + match[1]]) { referencesIDs[idPrefix + match[1]].push(attr); } else { referencesIDs[idPrefix + match[1]] = [attr]; @@ -88,7 +88,7 @@ exports.fn = function(data, params) { match = attr.value.match(regReferencesHref); if (match) { - if (referencesIDs[match[1]]) { + if (referencesIDs[idPrefix + match[1]]) { referencesIDs[idPrefix + match[1]].push(attr); } else { referencesIDs[idPrefix + match[1]] = [attr];