Skip to content

Commit

Permalink
Adding support for x.attr(obj)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalloc committed Jul 21, 2011
1 parent 4bbfb78 commit 8ec0624
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions bonzo.js
Expand Up @@ -415,6 +415,12 @@

attr: function (k, v) {
var el = this[0];
if (typeof k != 'string' && !(k instanceof String)) {
for (var n in k) {
k.hasOwnProperty(n) && this.attr(n, k[n]);
}
return this;
}
return typeof v == 'undefined' ?
specialAttributes.test(k) ?
stateAttributes.test(k) && typeof el[k] == 'string' ?
Expand Down
2 changes: 1 addition & 1 deletion bonzo.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/bonzo.js
Expand Up @@ -409,6 +409,12 @@

attr: function (k, v) {
var el = this[0];
if (typeof k != 'string' && !(k instanceof String)) {
for (var n in k) {
k.hasOwnProperty(n) && this.attr(n, k[n]);
}
return this;
}
return typeof v == 'undefined' ?
specialAttributes.test(k) ?
stateAttributes.test(k) && typeof el[k] == 'string' ?
Expand Down

0 comments on commit 8ec0624

Please sign in to comment.