Bug Tracker

Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#5394 closed bug (duplicate)

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

Change History (6)

comment:1 Changed 10 years ago by dmethvin

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.

comment:2 Changed 9 years ago by dmethvin

Component: unfiledattributes

comment:3 Changed 9 years ago by snover

Owner: set to olksy
Status: newpending

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

comment:4 Changed 9 years ago by dmethvin

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.

comment:5 Changed 9 years ago by timmywil

Priority: minorlow
Resolution: duplicate
Status: openclosed
Type: enhancementbug
Version: 1.3.21.5.2

comment:6 Changed 9 years ago by timmywil

Duplicate of #8813.

Note: See TracTickets for help on using tickets.