Element#down on an input element should not raise error.

This commit is contained in:
Tobie Langel 2008-09-03 14:16:32 -07:00
parent b628c6de5c
commit b4ea2abda1
3 changed files with 6 additions and 2 deletions

View File

@ -1,4 +1,4 @@
* Avoid potential memory leaks in Firefox. (wpc, Tobie Langel) [#12 state:resolved]
* Element#down on an input element should not raise error. (humeniuc, kangax)
* More unit tests for Object.isHash. (Tobie Langel)

View File

@ -233,7 +233,7 @@ Element.Methods = {
element = $(element);
if (arguments.length == 1) return element.firstDescendant();
return Object.isNumber(expression) ? element.descendants()[expression] :
element.select(expression)[index || 0];
Element.select(element, expression)[index || 0];
},
previous: function(element, expression, index) {

View File

@ -561,6 +561,10 @@ new Test.Unit.Runner({
var dummy = $(document.createElement('DIV'));
dummy.innerHTML = '<div></div>'.times(3);
this.assert(typeof dummy.down().setStyle == 'function');
var input = $$('input')[0];
this.assertNothingRaised(function(){ input.down('span') });
this.assertUndefined(input.down('span'));
},
testElementPrevious: function() {