[jQuery] Single Value Attributes

[jQuery] Single Value Attributes

I'm all for that. I've always thought it awkward of XHTML to have the
value of those attributes be the same as their name. Naturally, you may
want to support the existing syntax as well for backwards compatibility.
m.
-----Original Message-----
From: discuss-bounces@jquery.com [mailto:discuss-bounces@jquery.com] On
Behalf Of John Resig
Sent: Monday, October 02, 2006 6:41 PM
To: jQuery Discussion.
Subject: [jQuery] Single Value Attributes
Hey everyone -
I stumbled across a point of optimization today, all of the following
attributes (and probably more - let me know) can only have a single
value.
checked="checked"
multiple="multiple"
disabled="disabled"
readonly="readonly"
disabled="disabled"
selected="selected"
I'd like to add in methods like:
.checked( true | false )
Which does this in the background (but for each attribute):
$.fn.checked = function(b) {
if ( b )
this.attr( "checked", "checked" );
else
this.removeAttr( "checked" );
};
What do you think?
--John
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/