Skip to content

Commit d4b69e5

Browse files
Fix issue where the deprecated Element#childOf was not initially present on elements.
We added it to the Element.Methods object in deprecated.js _after_ the initial call to Element.addMethods, meaning that it didn't get copied over unless the user made a subsequent call to Element.addMethods for whatever reason. Unit tests didn't catch this because they call Element.addMethods before testing starts.
1 parent eb5dc03 commit d4b69e5

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/prototype/deprecated.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ Hash.toQueryString = Object.toQueryString;
44

55
var Toggle = { display: Element.toggle };
66

7-
Element.Methods.childOf = Element.Methods.descendantOf;
7+
Element.addMethods({
8+
childOf: Element.Methods.descendantOf
9+
});
810

911
var Insertion = {
1012
Before: function(element, content) {
@@ -202,7 +204,7 @@ Object.extend(Element.ClassNames.prototype, Enumerable);
202204
initialize: function(expression) {
203205
this.expression = expression.strip();
204206
},
205-
207+
206208
/** deprecated
207209
* Selector#findElements(root) -> [Element...]
208210
* - root (Element | document): A "scope" to search within. All results will
@@ -214,7 +216,7 @@ Object.extend(Element.ClassNames.prototype, Enumerable);
214216
findElements: function(rootElement) {
215217
return Prototype.Selector.select(this.expression, rootElement);
216218
},
217-
219+
218220
/** deprecated
219221
* Selector#match(element) -> Boolean
220222
*
@@ -223,11 +225,11 @@ Object.extend(Element.ClassNames.prototype, Enumerable);
223225
match: function(element) {
224226
return Prototype.Selector.match(element, this.expression);
225227
},
226-
228+
227229
toString: function() {
228230
return this.expression;
229231
},
230-
232+
231233
inspect: function() {
232234
return "#<Selector: " + this.expression + ">";
233235
}
@@ -244,7 +246,7 @@ Object.extend(Element.ClassNames.prototype, Enumerable);
244246
matchElements: function(elements, expression) {
245247
var match = Prototype.Selector.match,
246248
results = [];
247-
249+
248250
for (var i = 0, length = elements.length; i < length; i++) {
249251
var element = elements[i];
250252
if (match(element, expression)) {

0 commit comments

Comments
 (0)