The release info for 1.4a1 says attr() has been heavily optimized, but unfortunately it is still very broken. Since this commonly-used method is a constant source of criticism for jQuery, and because its behavior doesn't make much sense, isn't it time it gets replaced with better logic?
Some observations: 1) It still confuses properties and attributes, which is its biggest problem. Behavior is unpredictable. This is bad. 2) It looks like new code was added to call the jQuery method if the requested attribute is in jQuery.fn. But what about attributes like "height" or "wrap"? It won't retrieve the attribute value, but instead, runs the height() or wrap() methods! 3) The list in jQuery.props is still incomplete 4) The "special" cases list is still incomplete 5) It forces values to be strings, so I can't set attributes like attr ('onclick',function(){...}) which in theory should work just fine. In FF, for example, el.setAttribute('onclick',function(){...}) works as expected. There was a critique posted here, which started off the discussion (again): http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/d2c0407a7fc2e33a/ Referenced is a good, robust review of attribute handling with test cases that should probably be in the jQuery test suite: http://www.cinsoft.net/attributes.html I think attr() needs some long-over-due re-thinking. It's definitely very broken as-is, doesn't do what the documentation says it does, and is a constant (justified) source of criticism of the jQuery library. Any hopes of fixing it up soon? Matt Kruse -- 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.