@xmldom/xmldom 0.8.9 → 0.8.10

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 CHANGED
@@ -4,6 +4,15 @@ 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.8.10](https://github.com/xmldom/xmldom/compare/0.8.9...0.8.10)
8
+
9
+ ### Fixed
10
+
11
+ - dom: prevent iteration over deleted items [`#514`](https://github.com/xmldom/xmldom/pull/514)/ [`#499`](https://github.com/xmldom/xmldom/issues/499)
12
+
13
+ Thank you, [@qtow](https://github.com/qtow), for your contributions
14
+
15
+
7
16
  ## [0.8.9](https://github.com/xmldom/xmldom/compare/0.8.8...0.8.9)
8
17
 
9
18
  ### Fixed
package/lib/dom.js CHANGED
@@ -169,7 +169,7 @@ NodeList.prototype = {
169
169
  * The node at the indexth position in the NodeList, or null if that is not a valid index.
170
170
  */
171
171
  item: function(index) {
172
- return this[index] || null;
172
+ return index >= 0 && index < this.length ? this[index] : null;
173
173
  },
174
174
  toString:function(isHTML,nodeFilter){
175
175
  for(var buf = [], i = 0;i<this.length;i++){
@@ -202,17 +202,23 @@ function LiveNodeList(node,refresh){
202
202
  }
203
203
  function _updateLiveList(list){
204
204
  var inc = list._node._inc || list._node.ownerDocument._inc;
205
- if(list._inc != inc){
205
+ if (list._inc !== inc) {
206
206
  var ls = list._refresh(list._node);
207
- //console.log(ls.length)
208
207
  __set__(list,'length',ls.length);
208
+ if (!list.$$length || ls.length < list.$$length) {
209
+ for (var i = ls.length; i in list; i++) {
210
+ if (Object.prototype.hasOwnProperty.call(list, i)) {
211
+ delete list[i];
212
+ }
213
+ }
214
+ }
209
215
  copy(ls,list);
210
216
  list._inc = inc;
211
217
  }
212
218
  }
213
219
  LiveNodeList.prototype.item = function(i){
214
220
  _updateLiveList(this);
215
- return this[i];
221
+ return this[i] || null;
216
222
  }
217
223
 
218
224
  _extends(LiveNodeList,NodeList);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmldom/xmldom",
3
- "version": "0.8.9",
3
+ "version": "0.8.10",
4
4
  "description": "A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.",
5
5
  "keywords": [
6
6
  "w3c",