Skip to content
Permalink
Browse files

Bug fix for commit 2c4b208 - technique wasn't working as expected in …

…WebKit browsers. Thanks to @jitter for the bug fix.
  • Loading branch information
jeresig committed Sep 27, 2010
1 parent 42aa714 commit 157a383dae5335ef1056d3818d7dd70ac81c25a7
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/attributes.js
@@ -164,7 +164,7 @@ jQuery.fn.extend({
var option = options[ i ];

// Don't return options that are disabled or in a disabled optgroup
if ( option.selected && !option.disabled &&
if ( option.selected && option.getAttribute("disabled") === null &&

This comment has been minimized.

Copy link
@jitter

jitter Sep 27, 2010

Contributor

This change fixes the problem for the Webkit browsers but breaks badly in all IE versions as IE doesn't adhere to the specification of getAttribute and returns a boolean value for attributes where the value evaluates to a boolean value (as disabled, checked) instead of a string.

Check this site for more info. http://reference.sitepoint.com/javascript/Element/getAttribute This is why originally I wanted to add to my previous note the warning that using getAttribute is risky as it is so broken across browsers

This comment has been minimized.

Copy link
@jeresig

jeresig Sep 27, 2010

Author Member

Actually just committed a fix for this (was looking into it more after my last commit): 97d468f Just noticed your comment here but I came to the same conclusion.

(!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
// Get the specific value for the option
value = jQuery(option).val();

0 comments on commit 157a383

Please sign in to comment.
You can’t perform that action at this time.