diff --git a/vendor/nwmatcher/selector_engine.js b/vendor/nwmatcher/selector_engine.js index 4db802c..fea4a02 100644 --- a/vendor/nwmatcher/selector_engine.js +++ b/vendor/nwmatcher/selector_engine.js @@ -8,19 +8,19 @@ delete Prototype._original_nw; Prototype.Selector = (function(NW) { function select(selector, scope) { - var results = []; + var results = [], resultsIndex = 0; NW.select(selector, scope || document, null, function(element) { - results.push(Element.extend(element)); + results[resultsIndex++] = Element.extend(element); }); return results; } function filter(elements, selector) { - var results = [], element; + var results = [], resultsIndex = 0, element; for (var i = 0, length = elements.length; i < length; i++) { element = elements[i]; if (NW.match(element, selector)) { - results.push(Element.extend(element)) + results[resultsIndex++] = Element.extend(element); } } return results;