3 var XMLAttribute, create;
5 create = require(
'lodash/create');
7 module.exports = XMLAttribute = (
function() {
8 function XMLAttribute(parent, name, value) {
9 this.stringify = parent.stringify;
11 throw new Error(
"Missing attribute name of element " + parent.name);
14 throw new Error(
"Missing attribute value for attribute " + name +
" of element " + parent.name);
16 this.name = this.stringify.attName(name);
17 this.value = this.stringify.attValue(value);
20 XMLAttribute.prototype.clone =
function() {
21 return create(XMLAttribute.prototype,
this);
24 XMLAttribute.prototype.toString =
function(options, level) {
25 return ' ' + this.name +
'="' + this.value +
'"';