if(properties._text.indexOf('$') < 0) {
node.textContent = properties._text;
} else {
node.textContent = buildNodeText(properties._text, properties.counter);
}
}
each(properties.children, function () {
this.parent._name = name;
});
each(properties._attributes, function () {
this.value = buildNodeText(this.value, properties.counter);
node.setAttribute(this.name, this.value);
});
return node;
}
function traverseTree(base, context){
var node = buildNode(base);
context.appendChild(node);
each(base.children, function() {
traverseTree(this, node);
});
}
function getterFor(data) {
return function(key, index) {
var value = data[key];
if (typeof value === 'object') {
if (value.length > index) {
return value[index];
} else {
return value[index-value.length]
}
}
if (typeof value === 'function') {
return value.call(this, index);
}
return value;
};
}