Skip to content

Commit

Permalink
Tag#addAttribute() -> Tag#setAttribute()
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Sep 24, 2010
1 parent 1a3c79d commit 5997242
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/nodes/tag.js
Expand Up @@ -27,7 +27,7 @@ var Tag = module.exports = function Tag(name, block) {
};

/**
* Add attribute `name` with `val`, keep in mind these become
* Set attribute `name` to `val`, keep in mind these become
* part of a raw js object literal, so to quote a value you must
* '"quote me"', otherwise or example 'user.name' is literal JavaScript.
*
Expand All @@ -37,7 +37,7 @@ var Tag = module.exports = function Tag(name, block) {
* @api public
*/

Tag.prototype.addAttribute = function(name, val){
Tag.prototype.setAttribute = function(name, val){
this.attrs.push({ name: name, val: val });
return this;
};
Expand Down
4 changes: 2 additions & 2 deletions lib/parser.js
Expand Up @@ -287,15 +287,15 @@ Parser.prototype = {
case 'id':
case 'class':
var tok = this.advance;
tag.addAttribute(tok.type, "'" + tok.val + "'");
tag.setAttribute(tok.type, "'" + tok.val + "'");
continue;
case 'attrs':
var obj = this.advance.attrs,
names = Object.keys(obj);
for (var i = 0, len = names.length; i < len; ++i) {
var name = names[i],
val = obj[name];
tag.addAttribute(name, val);
tag.setAttribute(name, val);
}
continue;
default:
Expand Down

0 comments on commit 5997242

Please sign in to comment.