Skip to content

Commit

Permalink
Speed-up most common .all usage (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante authored Jul 24, 2017
1 parent 5bdbfcd commit e42a9fd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ select.all = function (selector, parent) {
var current;
var i;
var ii;
var all = [];
var all;
for (i = 0; i < parent.length; i++) {
current = parent[i].querySelectorAll(selector);
if (!all) {
all = Array.apply(null, current);
continue;
}
for (ii = 0; ii < current.length; ii++) {
if (all.indexOf(current[ii]) < 0) {
all.push(current[ii]);
Expand Down

0 comments on commit e42a9fd

Please sign in to comment.