Skip to content

Commit

Permalink
doc: Merge/update old docs for Form.findFirstElement and focusFirstel…
Browse files Browse the repository at this point in the history
…ement into source [prototypejs#102 state:fixed_in_branch]
  • Loading branch information
dandean authored and samleb committed Feb 15, 2010
1 parent 6634be5 commit 37d5c5e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/dom/form.js
Expand Up @@ -218,6 +218,15 @@ Form.Methods = {
* Form.findFirstElement(@form) -> Element
*
* Finds the first non-hidden, non-disabled control within the form.
*
* The returned object is either an INPUT, SELECT or TEXTAREA element. This
* method is used by the [[Form.focusFirstElement]] method.
*
* ##### Note
*
* The result of this method is the element that comes first in the
* *document* order, not the
* [tabindex order](http://www.w3.org/TR/html4/interact/forms.html#h-17.11.1).
**/
findFirstElement: function(form) {
var elements = $(form).getElements().findAll(function(element) {
Expand All @@ -236,6 +245,11 @@ Form.Methods = {
* Form.focusFirstElement(@form) -> Element
*
* Gives keyboard focus to the first element of the form. Returns the form.
*
* Uses [[Form.findFirstElement]] to get the first element and calls
* [[Form.Element.activate]] on it. This is useful for enhancing usability on
* your site by bringing focus on page load to forms such as search forms or
* contact forms where a user is ready to start typing right away.
**/
focusFirstElement: function(form) {
form = $(form);
Expand Down

0 comments on commit 37d5c5e

Please sign in to comment.