Add support for setting attributes with an object#53
Open
CharlotteGore wants to merge 4 commits intocomponent:masterfrom
Open
Add support for setting attributes with an object#53CharlotteGore wants to merge 4 commits intocomponent:masterfrom
CharlotteGore wants to merge 4 commits intocomponent:masterfrom
Conversation
Author
|
Not entirely sure I should be doing all this as one single pull request. Happy to break this apart if needed :) |
Author
|
Added some spaces to the |
Contributor
|
good idea! i'd probably do it with the object check as the very first thing to exit early. also no need for the arguments length or own property checks with for the object i think List.prototype.attr = function(name, val){
// object
if ('object' == typeof name) {
for (var attr in obj) this.attr(attr, name[attr]);
return this;
}
// get
if (1 == arguments.length) {
return this.els[0] && this.els[0].getAttribute(name);
}
// remove
if (null == val) {
return this.removeAttr(name);
}
// set
return this.forEach(function(el){
el.setAttribute(name, val);
});
};also single quotes |
Member
+1 |
Contributor
|
lgtm :) |
|
+1 |
Member
|
please rebase and we'll merge :-) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes: