Skip to content

Commit faa8468

Browse files
committed
fixed has() sibling matching at root elements (#169 @nrps9909)
1 parent 24cdab6 commit faa8468

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎src/nwsapi.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
* nwsapi.js - Fast CSS Selectors API Engine
66
*
77
* Author: Diego Perini <diego.perini at gmail com>
8-
* Version: 2.2.25
8+
* Version: 2.2.26
99
* Created: 20070722
10-
* Release: 20260827
10+
* Release: 20260829
1111
*
1212
* License:
1313
* https://javascript.nwbox.com/nwsapi/MIT-LICENSE
@@ -30,7 +30,7 @@
3030

3131
})(this, function Factory(global, Export) {
3232

33-
var version = 'nwsapi-2.2.25',
33+
var version = 'nwsapi-2.2.26',
3434

3535
doc = global.document,
3636
root = doc.documentElement,
@@ -1297,9 +1297,9 @@
12971297
t = expr.charAt(0);
12981298

12991299
if (t == '+') {
1300-
source = 'if(s.select("*' + expr + '",e.parentElement).includes(e.nextElementSibling)){' + source + '}';
1300+
source = 'if(e.parentElement&&s.select("*' + expr + '",e.parentElement).includes(e.nextElementSibling)){' + source + '}';
13011301
} else if (t == '~') {
1302-
source = 'if(Array.from(e.parentElement.children).includes(e.nextElementSibling)){' + source + '}';
1302+
source = 'if(e.parentElement&&Array.from(e.parentElement.children).includes(e.nextElementSibling)){' + source + '}';
13031303
} else if (t == '>') {
13041304
source = 'if(s.first(":scope ' + expr + '",e)){' + source + '}';
13051305
} else {

0 commit comments

Comments
 (0)