Disabled the passthrough .attr(method_name) functionality. You can now use it if you do: .attr({method_name: value}, true) OR as an easy initialization method: jQuery('<div/>', {html: '...', id: 'test'}).

This commit is contained in:
jeresig 2009-12-18 12:41:53 -05:00
parent 148fb7ba8e
commit d40083c866
4 changed files with 35 additions and 13 deletions

View file

@ -232,13 +232,13 @@ jQuery.extend({
offset: true
},
attr: function( elem, name, value ) {
attr: function( elem, name, value, pass ) {
// don't set attributes on text and comment nodes
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
return undefined;
}
if ( name in jQuery.attrFn && value !== undefined ) {
if ( pass && name in jQuery.attrFn ) {
return jQuery(elem)[name](value);
}