From b4ea2abda15071084d66debc63092cf4855e18bb Mon Sep 17 00:00:00 2001 From: Tobie Langel Date: Wed, 3 Sep 2008 14:16:32 -0700 Subject: [PATCH] Element#down on an input element should not raise error. --- CHANGELOG | 2 +- src/dom.js | 2 +- test/unit/dom_test.js | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 403ffd3..22877e3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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) diff --git a/src/dom.js b/src/dom.js index 45e8533..d5df211 100644 --- a/src/dom.js +++ b/src/dom.js @@ -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) { diff --git a/test/unit/dom_test.js b/test/unit/dom_test.js index 7726a44..1d51c36 100644 --- a/test/unit/dom_test.js +++ b/test/unit/dom_test.js @@ -561,6 +561,10 @@ new Test.Unit.Runner({ var dummy = $(document.createElement('DIV')); dummy.innerHTML = '
'.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() {