@asamuzakjp/dom-selector 0.6.0 → 0.6.2
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/package.json +1 -1
- package/src/js/matcher.js +4 -6
package/package.json
CHANGED
package/src/js/matcher.js
CHANGED
|
@@ -1337,15 +1337,13 @@ class Matcher {
|
|
|
1337
1337
|
*/
|
|
1338
1338
|
querySelector() {
|
|
1339
1339
|
const arr = this._match(this.#ast, this.#node);
|
|
1340
|
-
let res;
|
|
1341
1340
|
if (arr.length) {
|
|
1342
|
-
const
|
|
1343
|
-
if (i
|
|
1344
|
-
|
|
1345
|
-
} else if (j) {
|
|
1346
|
-
res = j;
|
|
1341
|
+
const i = arr.findIndex(node => node === this.#node);
|
|
1342
|
+
if (i >= 0) {
|
|
1343
|
+
arr.splice(i, 1);
|
|
1347
1344
|
}
|
|
1348
1345
|
}
|
|
1346
|
+
const [res] = arr;
|
|
1349
1347
|
return res || null;
|
|
1350
1348
|
}
|
|
1351
1349
|
|