Skip to content

Commit 1939dd7

Browse files
committed
Update from CI
1 parent 62bc5c6 commit 1939dd7

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

index.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8553,14 +8553,14 @@ function wrappy (fn, cb) {
85538553
this.saxParser.onopentag = (function(_this) {
85548554
return function(node) {
85558555
var key, newValue, obj, processedKey, ref;
8556-
obj = {};
8556+
obj = Object.create(null);
85578557
obj[charkey] = "";
85588558
if (!_this.options.ignoreAttrs) {
85598559
ref = node.attributes;
85608560
for (key in ref) {
85618561
if (!hasProp.call(ref, key)) continue;
85628562
if (!(attrkey in obj) && !_this.options.mergeAttrs) {
8563-
obj[attrkey] = {};
8563+
obj[attrkey] = Object.create(null);
85648564
}
85658565
newValue = _this.options.attrValueProcessors ? processItem(_this.options.attrValueProcessors, node.attributes[key], key) : node.attributes[key];
85668566
processedKey = _this.options.attrNameProcessors ? processItem(_this.options.attrNameProcessors, key) : key;
@@ -8610,7 +8610,11 @@ function wrappy (fn, cb) {
86108610
}
86118611
}
86128612
if (isEmpty(obj)) {
8613-
obj = _this.options.emptyTag !== '' ? _this.options.emptyTag : emptyStr;
8613+
if (typeof _this.options.emptyTag === 'function') {
8614+
obj = _this.options.emptyTag();
8615+
} else {
8616+
obj = _this.options.emptyTag !== '' ? _this.options.emptyTag : emptyStr;
8617+
}
86148618
}
86158619
if (_this.options.validator != null) {
86168620
xpath = "/" + ((function() {
@@ -8634,7 +8638,7 @@ function wrappy (fn, cb) {
86348638
}
86358639
if (_this.options.explicitChildren && !_this.options.mergeAttrs && typeof obj === 'object') {
86368640
if (!_this.options.preserveChildrenOrder) {
8637-
node = {};
8641+
node = Object.create(null);
86388642
if (_this.options.attrkey in obj) {
86398643
node[_this.options.attrkey] = obj[_this.options.attrkey];
86408644
delete obj[_this.options.attrkey];
@@ -8649,7 +8653,7 @@ function wrappy (fn, cb) {
86498653
obj = node;
86508654
} else if (s) {
86518655
s[_this.options.childkey] = s[_this.options.childkey] || [];
8652-
objClone = {};
8656+
objClone = Object.create(null);
86538657
for (key in obj) {
86548658
if (!hasProp.call(obj, key)) continue;
86558659
objClone[key] = obj[key];
@@ -8666,7 +8670,7 @@ function wrappy (fn, cb) {
86668670
} else {
86678671
if (_this.options.explicitRoot) {
86688672
old = obj;
8669-
obj = {};
8673+
obj = Object.create(null);
86708674
obj[nodeName] = old;
86718675
}
86728676
_this.resultObject = obj;

0 commit comments

Comments
 (0)