Bug Tracker

Opened 16 years ago

Closed 16 years ago

Last modified 11 years ago

#379 closed bug (wontfix)

Fix for Safari's lack of support for 'onchange'

Reported by: [email protected] Owned by:
Priority: major Milestone: 1.1a
Component: event Version: 1.1a
Keywords: safari onchange patch Cc:
Blocked by: Blocking:


Safari 2.x (and 1.x) doesn't support radio button 'onchange' so I've written an extension to jQuery to support the 'change' function for Safari (see quirksmode for details: http://www.quirksmode.org/js/events_compinfo.html).


The webkit version of Safari does support the change event, so I suspect version 3 of Safari will fix this issue properly.

Change History (7)

comment:1 Changed 16 years ago by john

Milestone: 1.1
Type: enhancementbug
Version: 1.1

While I think this patch could be made much simpler, it's definitely something that we need to consider.

comment:2 Changed 16 years ago by henrah+jquer

I think there's an error in this script; line 24 ought to read:

return this.safariRadio() ? this.mouseup(function(){

...instead of

return this.safariRadio ? this.mouseup(function(){

...because this.safariRadio is a function, and will always be truthy.

comment:3 Changed 16 years ago by brandon

I believe the helper methods 'change', 'unchange' and 'onechange' will be removed in 1.1 in favor for a less confusing API.

This should be put on hold until 1.1 for sure.

comment:4 Changed 16 years ago by Dave

Does Safari support keyboard focus change or accessKey? If so then this won't fire if the user tabs into the field or uses the keyboard to set it. Maybe the focus event could be used instead of mouseup?

comment:5 Changed 16 years ago by [email protected]

@Dave - it looks like you're right, I hadn't checked the keyboard event.

My original problem was that I couldn't tell which radio button had been selected. The 'focus' function does fire correctly in Safari when I change the radio. I guess there's still a problem catching the change event - but using the focus event does the job in my case.


comment:6 Changed 16 years ago by brandon

Resolution: wontfix
Status: newclosed

I did a quick test case for this bug. Safari fires the click event when an radio button is selected via the keyboard. It just so happens that the click even is also fired when the radio button is selected via the mouse. Label tags do not work in Safari yet, so no need to worry about those.

Test case: http://brandon.jquery.com/testing/379/

There isn't much of a demand for this, so I believe it should stay wrapped up as a plugin but should be updated to use the .click method to replace the change method.

Closing out as wontfix because putting this in the core would cause maintenance issues with the newer version and the workaround is very simple.

comment:7 Changed 12 years ago by [email protected]

I just spent at least half an hour trying to figure out why Chrome 10 and Safari 5 weren't raising change events (but IE8 was) when using the keyboard to select radio inputs.

It would be helpful to at least note this behaviour on the .change documentation page if you won't emulate it in the core.


Note: See TracTickets for help on using tickets.