Skip to content

Commit

Permalink
Fix deprecated Selector.matchElements.
Browse files Browse the repository at this point in the history
  • Loading branch information
tobie committed Feb 22, 2010
1 parent 2ec103d commit 550ec6e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* Fix deprecated Selector.matchElements. (Tobie Langel)

* Make Object.keys ES5 compliant. (Tobie Langel)

* Make Prototype's JSON implementation EcmaScript 5 compliant. [#453 state:resolved] (Tobie Langel)
Expand Down
13 changes: 12 additions & 1 deletion src/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,18 @@ Object.extend(Element.ClassNames.prototype, Enumerable);
*
* The only nodes returned will be those that match the given CSS selector.
**/
matchElements: Prototype.Selector.filter,
matchElements: function(elements, expression) {
var match = Prototype.Selector.match,
results = [];

for (var i = 0, length = elements.length; i < length; i++) {
var element = elements[i];
if (match(element, expression)) {
results.push(Element.extend(element));
}
}
return results;
},

/** deprecated
* Selector.findElement(elements, expression[, index = 0]) -> Element
Expand Down

0 comments on commit 550ec6e

Please sign in to comment.