🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

xmlbuilder2

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xmlbuilder2 - npm Package Compare versions

Comparing version

to
2.1.1

7

CHANGELOG.md

@@ -5,2 +5,7 @@ # Change Log

## [2.1.1] - 2020-04-01
### Bug Fixes
- Fixed a bug where calling `end` on a document fragment node would serialize the fragment's owner document not the fragment itself.
## [2.1.0] - 2020-03-31

@@ -123,1 +128,3 @@

[2.0.0]: https://github.com/oozcitak/xmlbuilder2/compare/v1.8.1...v2.0.0
[2.1.0]: https://github.com/oozcitak/xmlbuilder2/compare/v2.0.0...v2.1.0
[2.1.1]: https://github.com/oozcitak/xmlbuilder2/compare/v2.1.0...v2.1.1

16

lib/builder/XMLBuilderImpl.js

@@ -6,2 +6,3 @@ "use strict";

const writers_1 = require("../writers");
const interfaces_2 = require("@oozcitak/dom/lib/dom/interfaces");
const util_2 = require("@oozcitak/dom/lib/util");

@@ -439,3 +440,16 @@ const algorithm_1 = require("@oozcitak/dom/lib/algorithm");

doc() {
return new XMLBuilderImpl(this._doc);
if (this._doc._isFragment) {
let node = this.node;
while (node && node.nodeType !== interfaces_2.NodeType.DocumentFragment) {
node = node.parentNode;
}
/* istanbul ignore next */
if (node === null) {
throw new Error("Node has no parent node while searching for document fragment ancestor.");
}
return new XMLBuilderImpl(node);
}
else {
return new XMLBuilderImpl(this._doc);
}
}

@@ -442,0 +456,0 @@ /** @inheritdoc */

11

lib/index.js

@@ -80,3 +80,3 @@ "use strict";

const doc = dom_1.createDocument();
setOptions(doc, options);
setOptions(doc, options, true);
builder = new builder_1.XMLBuilderImpl(doc.createDocumentFragment());

@@ -87,3 +87,3 @@ }

const doc = dom_1.createDocument();
setOptions(doc, options);
setOptions(doc, options, true);
builder = new builder_1.XMLBuilderImpl(doc.createDocumentFragment());

@@ -98,3 +98,3 @@ builder.ele(contents);

dom_1.throwIfParserError(doc);
setOptions(doc, options);
setOptions(doc, options, true);
/* istanbul ignore next */

@@ -114,3 +114,3 @@ if (doc.documentElement === null) {

const doc = dom_1.createDocument();
setOptions(doc, options);
setOptions(doc, options, true);
builder = new builder_1.XMLBuilderImpl(doc.createDocumentFragment());

@@ -186,6 +186,7 @@ const obj = JSON.parse(contents);

}
function setOptions(doc, options) {
function setOptions(doc, options, isFragment) {
const docWithSettings = doc;
docWithSettings._xmlBuilderOptions = options;
docWithSettings._isFragment = isFragment;
}
//# sourceMappingURL=index.js.map

@@ -7,2 +7,3 @@ import { Node, Document } from "@oozcitak/dom/lib/dom/interfaces";

_xmlBuilderOptions: XMLBuilderOptions;
_isFragment?: boolean;
}

@@ -9,0 +10,0 @@ /**

{
"name": "xmlbuilder2",
"version": "2.1.0",
"version": "2.1.1",
"keywords": [

@@ -5,0 +5,0 @@ "xml",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet