Skip to content

Commit b9d0785

Browse files
committed
Simplified and combined code for "+" and "~" selectors
1 parent 17011c5 commit b9d0785

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

jcss.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -537,23 +537,15 @@
537537
var result = [];
538538
if (!relation || relation == '>') {
539539
result = getNodes(context);
540-
} else if (relation == '+') {
540+
} else if (relation == '+' || relation == '~') {
541541
for (var o = context.nextSibling; o; o = o.nextSibling) {
542542
if (o.nodeType == 1) {
543543
if (o.nodeName == name && filter(o)) {
544544
result.push(o);
545545
}
546-
break;
546+
if (relation == '+') break;
547547
}
548548
}
549-
} else if (relation == '~') {
550-
for (var o = context.nextSibling; o; o = o.nextSibling) {
551-
if (o.nodeType == 1) {
552-
if (o.nodeName == name && filter(o)) {
553-
result.push(o);
554-
}
555-
}
556-
}
557549
}
558550
return result;
559551
}
@@ -608,7 +600,7 @@
608600
}
609601
duplicates = false;
610602
}
611-
return nodes;
603+
return nodes;
612604
},
613605

614606
/**

0 commit comments

Comments
 (0)