1 | /* |
---|
2 | * $().attr proxy. http://dev.jquery.com/ticket/4283. We need to handle some things special until this gets taken care of. |
---|
3 | */ |
---|
4 | (function($){ |
---|
5 | var attr = $.prototype.attr; |
---|
6 | $.prototype.attr = function(name, value, type){ |
---|
7 | if(typeof name == 'string' && name.toLowerCase() == 'checked'){ |
---|
8 | var val; |
---|
9 | if((typeof value == 'string' && value.length && value == 'checked')) |
---|
10 | val = true; |
---|
11 | else |
---|
12 | val = false; |
---|
13 | |
---|
14 | return this.each(function(){ |
---|
15 | this.checked = val; |
---|
16 | }); |
---|
17 | } |
---|
18 | return attr.call(this, name, value, type); |
---|
19 | }; |
---|
20 | |
---|
21 | var removeAttr = $.prototype.removeAttr; |
---|
22 | $.prototype.removeAttr = function(name){ |
---|
23 | if(name.toLowerCase() == 'checked'){ |
---|
24 | return this.each(function(){ |
---|
25 | this.checked = false; |
---|
26 | }); |
---|
27 | } |
---|
28 | return removeAttr.call(this, name); |
---|
29 | }; |
---|
30 | })(jQuery); |
---|