Jump To …

forms.coffee

Patches to JSDOM for properly handling forms.

The Form

undefined

Forms convert INPUT fields of type file into this object and pass it as parameter to resource request.

The base class is a String, so the value (e.g. when passed in a GET request) is the base filename. Additional properties include the MIME type (mime), the full filename (filename) and the read method that returns the file contents.

undefined

Implement form.submit such that it actually submits a request to the server. This method takes the submitting button so we can send the button name/value.

undefined

No triggering event, just get history to do the submission.

undefined

Implement form.reset to reset all form fields.

undefined

Replace dispatchEvent so we can send the button along the event.

undefined

Default behavior for submit events is to call the form's submit method, but we also pass the submitting button.

undefined

Buttons

undefined

Default behavior for clicking on inputs.

undefined

Current INPUT behavior on click is to capture sumbit and handle it, but ignore all other clicks. We need those other clicks to occur, so we're going to dispatch them all.

undefined

First event we fire is click event

undefined

If that works out, we follow with a change event

undefined

Default behavior for form BUTTON: submit form.

undefined

Default type for button is submit. jQuery live submit handler looks for the type attribute, so we've got to make sure it's there.

undefined

The element in focus.

undefined

Change the current element in focus

undefined