From dc9d274d89f01cc21b69e4519e9b3f6a1fd59bf8 Mon Sep 17 00:00:00 2001 From: Andrew Dupont Date: Sun, 22 Feb 2009 15:11:40 -0600 Subject: [PATCH] Make sure Form.reset always returns a reference to the receiver element. [#309 state:resolved] (Phil, kangax) --- CHANGELOG | 2 ++ src/dom/form.js | 3 ++- test/unit/form_test.js | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 902b545..2b07457 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Make sure Form.reset always returns a reference to the receiver element. [#309 state:resolved] (Phil, kangax) + * Escape ":" and "." characters when doing contextual CSS selection in browsers that support querySelectorAll. [#559 state:resolved] (fxtentacle, Andrew Dupont) * Ensure the `target` property on events is never undefined in IE. [#383 state:resolved] (Mathias Karstädt, Diego Perini, Andrew Dupont) diff --git a/src/dom/form.js b/src/dom/form.js index 68c4400..62e455e 100644 --- a/src/dom/form.js +++ b/src/dom/form.js @@ -1,6 +1,7 @@ var Form = { reset: function(form) { - $(form).reset(); + form = $(form); + form.reset(); return form; }, diff --git a/test/unit/form_test.js b/test/unit/form_test.js index 1d03a9d..38a4666 100644 --- a/test/unit/form_test.js +++ b/test/unit/form_test.js @@ -26,6 +26,10 @@ new Test.Unit.Runner({ this.assertEqual("4", $F("input_enabled")); }, + testFormReset: function() { + this.assertRespondsTo('reset', Form.reset('form')); + }, + testFormElementEventObserver: function(){ var callbackCounter = 0; var observer = new Form.Element.EventObserver('input_enabled', function(){