From c9199c804dcd8e98b9851dcbcb1a0f0aad89f26e Mon Sep 17 00:00:00 2001 From: Thomas Fuchs Date: Sun, 11 Mar 2007 16:19:02 +0000 Subject: [PATCH] Remove the first-element special treatment from Selector unique --- src/selector.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/selector.js b/src/selector.js index a185613..ab014b5 100644 --- a/src/selector.js +++ b/src/selector.js @@ -248,15 +248,12 @@ Object.extend(Selector, { // filters out duplicates and extends all nodes unique: function(nodes) { if (nodes.length == 0) return nodes; - var results = [nodes[0]], n; - Element.extend(nodes[0])._counted = true; - for (var i = 0, l = nodes.length; i < l; i++) { - n = nodes[i]; - if (!n._counted) { + var results = [], n; + for (var i = 0, l = nodes.length; i < l; i++) + if (!(n = nodes[i])._counted) { n._counted = true; results.push(Element.extend(n)); } - } return Selector.handlers.unmark(results); },