Skip to main content

Bug Tracker

Side navigation

#379 closed bug (wontfix)

Opened November 10, 2006 07:58PM UTC

Closed December 20, 2006 03:47AM UTC

Last modified March 14, 2012 10:30PM UTC

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

Reported by: remy@ihatemusic.com Owned by:
Priority: major Milestone: 1.1a
Component: event Version: 1.1a
Keywords: safari onchange patch Cc:
Blocked by: Blocking:
Description

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).

http://leftlogic.com/jquery/safari_radio_change.js

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

Attachments (0)
Change History (7)

Changed November 17, 2006 09:30PM UTC by john comment:1

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.

Changed November 20, 2006 03:00AM UTC by henrah+jquer comment:2

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.

Changed November 25, 2006 11:41PM UTC by brandon comment:3

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.

Changed November 30, 2006 04:16AM UTC by Dave comment:4

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?

Changed December 13, 2006 08:11AM UTC by remy@ihatemu comment:5

@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.

Cheers.

Changed December 20, 2006 03:47AM UTC by brandon comment:6

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.

Changed March 13, 2011 05:54AM UTC by james@digitaledgeit.com.au comment:7

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.

Thanks.