Permalink
Browse files

refactored nodes

  • Loading branch information...
tj committed Mar 4, 2011
1 parent 996b7dd commit fb2b653fff9cd9ee223992d3d9d29e2dd61efade
Showing with 29 additions and 29 deletions.
  1. +1 −1 lib/nodes/block.js
  2. +4 −4 lib/nodes/code.js
  3. +2 −2 lib/nodes/comment.js
  4. +1 −1 lib/nodes/doctype.js
  5. +4 −4 lib/nodes/each.js
  6. +3 −3 lib/nodes/filter.js
  7. +13 −13 lib/nodes/tag.js
  8. +1 −1 lib/nodes/text.js
View
@@ -19,7 +19,7 @@ var Node = require('./node');
*/
var Block = module.exports = function Block(node){
- if (node) this.push(node);
+ if (node) this.push(node);
};
/**
View
@@ -22,10 +22,10 @@ var Node = require('./node');
*/
var Code = module.exports = function Code(val, buffer, escape) {
- this.val = val;
- this.buffer = buffer;
- this.escape = escape;
- if (/^ *else/.test(val)) this.instrumentLineNumber = false;
+ this.val = val;
+ this.buffer = buffer;
+ this.escape = escape;
+ if (/^ *else/.test(val)) this.instrumentLineNumber = false;
};
/**
View
@@ -21,8 +21,8 @@ var Node = require('./node');
*/
var Comment = module.exports = function Comment(val, buffer) {
- this.val = val;
- this.buffer = buffer;
+ this.val = val;
+ this.buffer = buffer;
};
/**
View
@@ -19,7 +19,7 @@ var Node = require('./node');
*/
var Doctype = module.exports = function Doctype(val) {
- this.val = val;
+ this.val = val;
};
/**
View
@@ -22,10 +22,10 @@ var Node = require('./node');
*/
var Each = module.exports = function Each(obj, val, key, block) {
- this.obj = obj;
- this.val = val;
- this.key = key;
- this.block = block;
+ this.obj = obj;
+ this.val = val;
+ this.key = key;
+ this.block = block;
};
/**
View
@@ -21,9 +21,9 @@ var Node = require('./node');
*/
var Filter = module.exports = function Filter(name, block, attrs) {
- this.name = name;
- this.block = block;
- this.attrs = attrs;
+ this.name = name;
+ this.block = block;
+ this.attrs = attrs;
};
/**
View
@@ -21,9 +21,9 @@ var Node = require('./node'),
*/
var Tag = module.exports = function Tag(name, block) {
- this.name = name;
- this.attrs = [];
- this.block = block || new Block;
+ this.name = name;
+ this.attrs = [];
+ this.block = block || new Block;
};
/**
@@ -38,8 +38,8 @@ var Tag = module.exports = function Tag(name, block) {
*/
Tag.prototype.setAttribute = function(name, val){
- this.attrs.push({ name: name, val: val });
- return this;
+ this.attrs.push({ name: name, val: val });
+ return this;
};
/**
@@ -50,11 +50,11 @@ Tag.prototype.setAttribute = function(name, val){
*/
Tag.prototype.removeAttribute = function(name){
- for (var i = 0, len = this.attrs.length; i < len; ++i) {
- if (this.attrs[i] && this.attrs[i].name == name) {
- delete this.attrs[i];
- }
+ for (var i = 0, len = this.attrs.length; i < len; ++i) {
+ if (this.attrs[i] && this.attrs[i].name == name) {
+ delete this.attrs[i];
}
+ }
};
/**
@@ -66,11 +66,11 @@ Tag.prototype.removeAttribute = function(name){
*/
Tag.prototype.getAttribute = function(name){
- for (var i = 0, len = this.attrs.length; i < len; ++i) {
- if (this.attrs[i] && this.attrs[i].name == name) {
- return this.attrs[i].val;
- }
+ for (var i = 0, len = this.attrs.length; i < len; ++i) {
+ if (this.attrs[i] && this.attrs[i].name == name) {
+ return this.attrs[i].val;
}
+ }
};
/**
View
@@ -19,7 +19,7 @@ var Node = require('./node');
*/
var Text = module.exports = function Text(line) {
- if ('string' == typeof line) this.push(line);
+ if ('string' == typeof line) this.push(line);
};
/**

0 comments on commit fb2b653

Please sign in to comment.