@xmldom/xmldom 0.9.0-beta.7 → 0.9.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/lib/dom.js +16 -11
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.9.0-beta.8](https://github.com/xmldom/xmldom/compare/0.9.0-beta.7...0.9.0-beta.8)
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- fix: Throw DOMException when calling removeChild with invalid parameter [`#494`](https://github.com/xmldom/xmldom/pull/494) / [`#135`](https://github.com/xmldom/xmldom/issues/135)
|
|
12
|
+
|
|
13
|
+
BREAKING CHANGE: Previously it was possible (but not documented) to call `Node.removeChild` with any node in the tree,
|
|
14
|
+
and with certain exceptions, it would work. This is no longer the case: calling `Node.removeChild` with an argument that is not a direct child of the node that it is called from, will throw a NotFoundError DOMException, as it is described by the specs.
|
|
15
|
+
|
|
16
|
+
Thank you, [@noseworthy](https://github.com/noseworthy), [@davidmc24](https://github.com/davidmc24), for your contributions
|
|
17
|
+
|
|
18
|
+
|
|
7
19
|
## [0.9.0-beta.7](https://github.com/xmldom/xmldom/compare/0.9.0-beta.6...0.9.0-beta.7)
|
|
8
20
|
|
|
9
21
|
### Feature
|
package/lib/dom.js
CHANGED
|
@@ -952,22 +952,26 @@ function _onUpdateChild(doc, el, newChild) {
|
|
|
952
952
|
* @private
|
|
953
953
|
*/
|
|
954
954
|
function _removeChild(parentNode, child) {
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
955
|
+
if (parentNode !== child.parentNode) {
|
|
956
|
+
throw new DOMException(NOT_FOUND_ERR, "child's parent is not parent");
|
|
957
|
+
}
|
|
958
|
+
//var index = parentNode.childNodes.
|
|
959
|
+
var oldPreviousSibling = child.previousSibling;
|
|
960
|
+
var oldNextSibling = child.nextSibling;
|
|
961
|
+
if (oldPreviousSibling) {
|
|
962
|
+
oldPreviousSibling.nextSibling = oldNextSibling;
|
|
959
963
|
} else {
|
|
960
|
-
parentNode.firstChild =
|
|
964
|
+
parentNode.firstChild = oldNextSibling;
|
|
961
965
|
}
|
|
962
|
-
if (
|
|
963
|
-
|
|
966
|
+
if (oldNextSibling) {
|
|
967
|
+
oldNextSibling.previousSibling = oldPreviousSibling;
|
|
964
968
|
} else {
|
|
965
|
-
parentNode.lastChild =
|
|
969
|
+
parentNode.lastChild = oldPreviousSibling;
|
|
966
970
|
}
|
|
971
|
+
_onUpdateChild(parentNode.ownerDocument, parentNode);
|
|
967
972
|
child.parentNode = null;
|
|
968
973
|
child.previousSibling = null;
|
|
969
974
|
child.nextSibling = null;
|
|
970
|
-
_onUpdateChild(parentNode.ownerDocument, parentNode);
|
|
971
975
|
return child;
|
|
972
976
|
}
|
|
973
977
|
|
|
@@ -1345,10 +1349,11 @@ Document.prototype = {
|
|
|
1345
1349
|
return newChild;
|
|
1346
1350
|
},
|
|
1347
1351
|
removeChild: function (oldChild) {
|
|
1348
|
-
|
|
1352
|
+
var removed = _removeChild(this, oldChild);
|
|
1353
|
+
if (removed === this.documentElement) {
|
|
1349
1354
|
this.documentElement = null;
|
|
1350
1355
|
}
|
|
1351
|
-
return
|
|
1356
|
+
return removed;
|
|
1352
1357
|
},
|
|
1353
1358
|
replaceChild: function (newChild, oldChild) {
|
|
1354
1359
|
//raises
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xmldom/xmldom",
|
|
3
|
-
"version": "0.9.0-beta.
|
|
3
|
+
"version": "0.9.0-beta.8",
|
|
4
4
|
"description": "A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"w3c",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@stryker-mutator/core": "5.6.1",
|
|
48
48
|
"auto-changelog": "2.4.0",
|
|
49
|
-
"eslint": "8.
|
|
49
|
+
"eslint": "8.42.0",
|
|
50
50
|
"eslint-config-prettier": "8.8.0",
|
|
51
51
|
"eslint-plugin-anti-trojan-source": "1.1.1",
|
|
52
52
|
"eslint-plugin-es5": "1.5.0",
|