prototype.js, Version: '1.6.0.2', Line 3462
focusFirstElement: function(form) {
form = $(form);
form.findFirstElement().activate();
return form;
},
this code is unsafe. findFirstElement() function returns empty value,
if form has no elements. look at this:
var elements = $(form).getElements().findAll(function(element) {
return 'hidden' != element.type && !element.disabled;
});
so, our solution is to rewrite focusFirstElement like this:
focusFirstElement: function(form) {
form = $(form);
var element = Form.findFirstElement(form);
if(!Object.isUndefined(element))
element.activate();
return form;
},
What do you think?
Regards,
Alexander Chernin, Naumen comp.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---