Skip to content
Permalink
Browse files

Missed the case of bind in the new attr multi-setter.

  • Loading branch information
jeresig committed Dec 10, 2009
1 parent 474d814 commit ecdcda870c70c262ec3198e067dd06e847f682dd
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/attributes.js
@@ -211,7 +211,8 @@ jQuery.extend({
data: true,
width: true,
height: true,
offset: true
offset: true,
bind: true
},

attr: function( elem, name, value ) {

3 comments on commit ecdcda8

@padolsey

This comment has been minimized.

Copy link
Contributor

@padolsey padolsey replied Dec 10, 2009

How exactly would one use attr({bind:...}) here? "Bind" needs to be passed, at minimum, two arguments -- this only works for one. Might be worth allowing multiple arguments to be passed via an array:

$(elem).attr({
bind: ['click', function(){}]
});

Although, tbh, I doubt that "bind" would be very useful in this context.

@jeresig

This comment has been minimized.

Copy link
Member Author

@jeresig jeresig replied Dec 10, 2009

Actually, .bind() now accepts an object. So you can do:

$("<div/>").attr({
  "class": "test",
  html: "<b>foo</b>",
  css: { color: "red", background: "black" },
  bind: { click: ..., mouseover: ... }
});

Naturally the case of a regular bind won't work here, it's strictly for the object case.

@padolsey

This comment has been minimized.

Copy link
Contributor

@padolsey padolsey replied Dec 10, 2009

Ah, cool, I didn't see that change...

Please sign in to comment.
You can’t perform that action at this time.