> // Safari mis-reports the default selected property of a hidden > option > // Accessing the parent's selectedIndex property fixes it > if ( name == "selected" && elem.parentNode ) { > elem.parentNode.selectedIndex; > } > > I previously made two points: > 1) This code will not work of the <option> is in an <optgroup> > (common)
Filed and fixed. http://dev.jquery.com/ticket/5701 > After some discussion with colleagues, ... Heh. > // Safari mis-reports the default selected property of a hidden > option > // Accessing the parent's selectedIndex property fixes it > if ( name == "selected" && elem.parentNode ) { > elem.parentNode.selectedIndex; > } > > with these: > > if (name=="selected") { > return getOptionSelected(elem); > } > > Then you'll have a more robust, feature-tested, efficient, correctly- > documented fix to this "problem". As it is the overhead to the existing fix is very minimal, has no function calls, no DOM manipulation, and is only 6 lines of code (even with the optgroup fix). Doing a bit more research I found a very similar problem when you use dynamically-created optgroups in IE. I found a feature detect that was able to detect the specific logic in Webkit and IE and skip the property accesses if not necessary. Filed and fixed: http://dev.jquery.com/ticket/5702 > Again, though, my suggestion is to just remove it. I don't think > generalized library code should try to normalize behavior that is not > demanded by the specs and that can be easily corrected through proper > HTML. Although, I seem to remember having a very heated discussion wherein you advocated that our position of asking users to specify a doctype to animate element width/height to 0 in IE 6 was too extreme and that we shouldn't be making demands of a user's markup. (Granted that is likely the only place where we make such a demand: We just ask the users to provide a document that validates first.) Thanks for the pointers. In the future, filing individual tickets/patches/test cases will be quite helpful. --John -- You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-...@googlegroups.com. To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.