aboutsummaryrefslogtreecommitdiff
path: root/lib/docx/numbering-xml.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-08-28 17:30:31 +0100
committerMichael Williamson <mike@zwobble.org>2026-08-28 17:30:31 +0100
commit2888fa158d67c1419199f152326e12a05618b53e (patch)
treec239ed44678ba87f29ff9b84625cf1a0ba48a68a /lib/docx/numbering-xml.js
parent31f0c370be4b95ac4fa285fea3be970606735f16 (diff)
Create objects without prototypes when used as map with arbitrary keys
Diffstat (limited to 'lib/docx/numbering-xml.js')
-rw-r--r--lib/docx/numbering-xml.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/docx/numbering-xml.js b/lib/docx/numbering-xml.js
index 9c86536..c747609 100644
--- a/lib/docx/numbering-xml.js
+++ b/lib/docx/numbering-xml.js
@@ -17,7 +17,7 @@ function Numbering(nums, abstractNums, styles) {
);
function findLevel(numId, level) {
- return findLevelWithSeenNumIds(numId, level, {});
+ return findLevelWithSeenNumIds(numId, level, Object.create(null));
}
function findLevelWithSeenNumIds(numId, level, seenNumIds) {
@@ -63,7 +63,7 @@ function readNumberingXml(root, options) {
}
function readAbstractNums(root) {
- var abstractNums = {};
+ var abstractNums = Object.create(null);
root.getElementsByTagName("w:abstractNum").forEach(function(element) {
var id = element.attributes["w:abstractNumId"];
abstractNums[id] = readAbstractNum(element);
@@ -72,7 +72,7 @@ function readAbstractNums(root) {
}
function readAbstractNum(element) {
- var levels = {};
+ var levels = Object.create(null);
// Some malformed documents define numbering levels without an index, and
// reference the numbering using a w:numPr element without a w:ilvl child.
@@ -110,7 +110,7 @@ function readAbstractNum(element) {
}
function readNums(root) {
- var nums = {};
+ var nums = Object.create(null);
root.getElementsByTagName("w:num").forEach(function(element) {
var numId = element.attributes["w:numId"];
var abstractNumId = element.first("w:abstractNumId").attributes["w:val"];