@@ -8553,14 +8553,14 @@ function wrappy (fn, cb) {
8553
8553
this . saxParser . onopentag = ( function ( _this ) {
8554
8554
return function ( node ) {
8555
8555
var key , newValue , obj , processedKey , ref ;
8556
- obj = { } ;
8556
+ obj = Object . create ( null ) ;
8557
8557
obj [ charkey ] = "" ;
8558
8558
if ( ! _this . options . ignoreAttrs ) {
8559
8559
ref = node . attributes ;
8560
8560
for ( key in ref ) {
8561
8561
if ( ! hasProp . call ( ref , key ) ) continue ;
8562
8562
if ( ! ( attrkey in obj ) && ! _this . options . mergeAttrs ) {
8563
- obj [ attrkey ] = { } ;
8563
+ obj [ attrkey ] = Object . create ( null ) ;
8564
8564
}
8565
8565
newValue = _this . options . attrValueProcessors ? processItem ( _this . options . attrValueProcessors , node . attributes [ key ] , key ) : node . attributes [ key ] ;
8566
8566
processedKey = _this . options . attrNameProcessors ? processItem ( _this . options . attrNameProcessors , key ) : key ;
@@ -8610,7 +8610,11 @@ function wrappy (fn, cb) {
8610
8610
}
8611
8611
}
8612
8612
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
+ }
8614
8618
}
8615
8619
if ( _this . options . validator != null ) {
8616
8620
xpath = "/" + ( ( function ( ) {
@@ -8634,7 +8638,7 @@ function wrappy (fn, cb) {
8634
8638
}
8635
8639
if ( _this . options . explicitChildren && ! _this . options . mergeAttrs && typeof obj === 'object' ) {
8636
8640
if ( ! _this . options . preserveChildrenOrder ) {
8637
- node = { } ;
8641
+ node = Object . create ( null ) ;
8638
8642
if ( _this . options . attrkey in obj ) {
8639
8643
node [ _this . options . attrkey ] = obj [ _this . options . attrkey ] ;
8640
8644
delete obj [ _this . options . attrkey ] ;
@@ -8649,7 +8653,7 @@ function wrappy (fn, cb) {
8649
8653
obj = node ;
8650
8654
} else if ( s ) {
8651
8655
s [ _this . options . childkey ] = s [ _this . options . childkey ] || [ ] ;
8652
- objClone = { } ;
8656
+ objClone = Object . create ( null ) ;
8653
8657
for ( key in obj ) {
8654
8658
if ( ! hasProp . call ( obj , key ) ) continue ;
8655
8659
objClone [ key ] = obj [ key ] ;
@@ -8666,7 +8670,7 @@ function wrappy (fn, cb) {
8666
8670
} else {
8667
8671
if ( _this . options . explicitRoot ) {
8668
8672
old = obj ;
8669
- obj = { } ;
8673
+ obj = Object . create ( null ) ;
8670
8674
obj [ nodeName ] = old ;
8671
8675
}
8672
8676
_this . resultObject = obj ;
0 commit comments