From 84901897c82b3991cf3effec150b3cdffd2033a7 Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Thu, 18 Jan 2007 23:07:02 +0000 Subject: [PATCH] prototype: Form.Element.activate shouldn't raise an exception when the form or field is hidden. --- CHANGELOG | 2 ++ src/form.js | 10 ++++++---- test/unit/form.html | 13 +++++++++++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 83ddcde..bd3235c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Form.Element.activate shouldn't raise an exception when the form or field is hidden. [sam] + * Remove support for "throw $continue" in Enumerable. Use "return" instead. [sam] * Update HEADER to reflect new URL. [sam] diff --git a/src/form.js b/src/form.js index fa2afa3..fc815fb 100644 --- a/src/form.js +++ b/src/form.js @@ -132,10 +132,12 @@ Form.Element.Methods = { activate: function(element) { element = $(element); - element.focus(); - if (element.select && ( element.tagName.toLowerCase() != 'input' || - !['button', 'reset', 'submit'].include(element.type) ) ) - element.select(); + try { + element.focus(); + if (element.select && (element.tagName.toLowerCase() != 'input' || + !['button', 'reset', 'submit'].include(element.type))) + element.select(); + } catch (e) {} return element; }, diff --git a/test/unit/form.html b/test/unit/form.html index 54a7d9e..96a79b4 100644 --- a/test/unit/form.html +++ b/test/unit/form.html @@ -86,6 +86,10 @@ + +