Skip to main content

Bug Tracker

Side navigation

#5394 closed bug (duplicate)

Opened October 19, 2009 01:02PM UTC

Closed April 15, 2011 04:00AM UTC

Last modified April 15, 2011 04:00AM UTC

Discrepancy of $(...).val(missing_option) bevahiour between IE, FF and Safari

Reported by: olksy Owned by: olksy
Priority: low Milestone:
Component: attributes Version: 1.5.2
Keywords: Cc:
Blocked by: Blocking:
Description

This ticket is about SELECT control behavior.

''missing_option'' is option that is not in SELECT's option list.

In FF, IE $( ''select'' ).val( ''missing_option'' ) will not change the selection.

In Safari that will cause selecting non-existent blank option. Then, if I as user select any existing option back, blank option goes away.

I have no idea, which behavior is preferred. But it would be nice to have consistency.

Safari is 4.0.3

Attachments (0)
Change History (6)

Changed October 20, 2009 11:54PM UTC by dmethvin comment:1

These edge cases can take a lot of code to nail down but don't seem that common. If there isn't a clear "right way" to do it, perhaps the best thing to do would be to explicitly specify the behavior you want for that case. Otherwise even if jQuery tried to normalize all the browser behaviors it might not do it the way you require, and you'd be back to writing explicit code to handle the case.

Changed June 13, 2010 06:05PM UTC by dmethvin comment:2

component: unfiledattributes

Changed October 31, 2010 09:34PM UTC by snover comment:3

owner: → olksy
status: newpending

Could you please confirm this is still an issue in the current version of jQuery?

Changed November 21, 2010 01:50AM UTC by dmethvin comment:4

status: pendingopen

http://jsfiddle.net/dmethvin/5XJHv/

Firefox, IE, and Opera return the first element's value when an invalid value is assigned; Safari and Chrome return null for the value.

Changed April 15, 2011 04:00AM UTC by timmywil comment:5

priority: minorlow
resolution: → duplicate
status: openclosed
type: enhancementbug
version: 1.3.21.5.2

Changed April 15, 2011 04:00AM UTC by timmywil comment:6

Duplicate of #8813.