Given the following: $.fn.foo = function() { alert('foo'); return this };
$( [] ).attr('id', bar).foo(); .foo() is never executed because bar was never initialized and is 'undefined'. The attr() method then thinks that it's getting instead of setting and returns undefined thus breaking the chain. jQuery.fn.attr currently tests to see if a value needs to be set by the following case: attr: function( elem, name, value ) { ... set = value !== undefined; In this case value really was passed in but fails to be a valid value for setting. Expected: If an attribute is attempted to be set with an undefined value, either attempt to set the value to 'undefined' or at least return the jQuery object to continue chaining. Core team, want me to open a bug? Cheers, - Jonathan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@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 -~----------~----~----~----~------~----~------~--~---