domino 2.1.5 → 2.1.6

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
@@ -1,3 +1,9 @@
1
+ # domino 2.1.6 (16 Jul 2020)
2
+ * Bumped version of lodash (#169)
3
+ * Performance improvement to DOMTokenList (#166)
4
+ * `mocha` dependency has been updated to 6.x. As a result, we are
5
+ no longer testing on node 4.
6
+
1
7
  # domino 2.1.5 (30 Apr 2020)
2
8
  * Bumped version of jquery dev dependency (#163)
3
9
  * Omit tests/ directory from NPM package (#161)
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  // DOMTokenList implementation based on https://github.com/Raynos/DOM-shim
3
- // XXX: should cache the getList(this) value more aggressively!
4
3
  var utils = require('./utils');
5
4
 
6
5
  module.exports = DOMTokenList;
@@ -9,6 +8,7 @@ function DOMTokenList(getter, setter) {
9
8
  this._getString = getter;
10
9
  this._setString = setter;
11
10
  this._length = 0;
11
+ this._lastStringValue = '';
12
12
  this._update();
13
13
  }
14
14
 
@@ -129,6 +129,7 @@ Object.defineProperties(DOMTokenList.prototype, {
129
129
  } else {
130
130
  fixIndex(this, getList(this));
131
131
  }
132
+ this._lastStringValue = this._getString();
132
133
  } },
133
134
  });
134
135
 
@@ -156,8 +157,21 @@ function handleErrors(token) {
156
157
  return token;
157
158
  }
158
159
 
160
+ function toArray(clist) {
161
+ var length = clist._length;
162
+ var arr = Array(length);
163
+ for (var i = 0; i < length; i++) {
164
+ arr[i] = clist[i];
165
+ }
166
+ return arr;
167
+ }
168
+
159
169
  function getList(clist) {
160
- var str = clist._getString().replace(/(^[ \t\r\n\f]+)|([ \t\r\n\f]+$)/g, '');
170
+ var strProp = clist._getString();
171
+ if (strProp === clist._lastStringValue) {
172
+ return toArray(clist);
173
+ }
174
+ var str = strProp.replace(/(^[ \t\r\n\f]+)|([ \t\r\n\f]+$)/g, '');
161
175
  if (str === "") {
162
176
  return [];
163
177
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "domino",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "license": "BSD-2-Clause",
5
5
  "author": "Felix Gnass <fgnass@gmail.com>",
6
6
  "description": "Server-side DOM implementation based on Mozilla's dom.js",
@@ -28,9 +28,9 @@
28
28
  },
29
29
  "types": "lib/index.d.ts",
30
30
  "devDependencies": {
31
- "jquery": "^3.4.1",
32
- "jshint": "^2.10.1",
33
- "mocha": "^5.2.0",
31
+ "jquery": "^3.5.1",
32
+ "jshint": "^2.11.1",
33
+ "mocha": "^6.2.3",
34
34
  "should": "^13.2.3"
35
35
  }
36
36
  }