Bug Tracker

Opened 9 years ago

Closed 9 years ago

#7771 closed enhancement (patchwelcome)

Providing fixes for "input" event

Reported by: robin@… 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.

Change History (3)

comment:1 Changed 9 years ago by robin@…

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.

comment:2 Changed 9 years ago by anonymous

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

comment:3 Changed 9 years ago by Rick Waldron

Resolution: patchwelcome
Status: newclosed
Note: See TracTickets for help on using tickets.