Skip to main content

Bug Tracker

Side navigation

#7771 closed enhancement (patchwelcome)

Opened December 14, 2010 03:22AM UTC

Closed December 14, 2010 06:26AM UTC

Providing fixes for "input" event

Reported by: robin@robinwinslow.co.uk Owned by:
Priority: undecided Milestone: 1.6
Component: unfiled Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:
Description

In HTML5 draft specification there is a new event http://goo.gl/aMQNT called "input" which fires *as soon as* data is input into a form (e.g. before the element loses focus - so before "change" would fire). This is very useful for form handling.

As it is an HTML5 feature it is naturally supported by only some of the most recent browsers (e.g. Chrome 8). It would be brilliant if jQuery could provide a fix so that the "input" event could display the same behaviour in all browsers (like it has done for preventDefault() etc.)

I haven't fully diagnosed how the "input" event works, but I imagine it would be similar to:

$(element).bind(
    'keyup click change',
    function(evt) {
        if($(this).tagName.match(formElements) && formHasChanged()) {
            // Fire event
        } else {
            evt.preventDefault();
        }
    }
)

Obviously this is only rudimentary pseudo-code. The actual solution would be far more complex I'm sure.

Attachments (0)
Change History (3)

Changed December 14, 2010 03:26AM UTC by robin@robinwinslow.co.uk comment:1

Actually there are a whole bunch of new HTML5 events http://goo.gl/myYG, and it would be very awesome if jQuery were to provide backward compatibility fixes for all of them.

Changed December 14, 2010 04:12AM UTC by anonymous comment:2

I found this great plugin that seems to implement a lot of the actual HTML5 forms functionality http://goo.gl/QHtwV. However, it doesn't seem to extend to include relevant events, or pseudoclasses.

I think there's a logical separation here. Extra functionality, like "autofocus", "placeholder", "required" belong in a plugin. However, things like events and pseudoclasses seem to me to belong in Core.

To that end I think it would be great if jQuery could try to implement functionality for legacy browsers for:

New events: http://goo.gl/myYG

New pseudoclasses: http://goo.gl/TrlCv

Changed December 14, 2010 06:26AM UTC by rwaldron comment:3

resolution: → patchwelcome
status: newclosed