00001
00002 (function() {
00003 var XMLAttribute, create;
00004
00005 create = require('lodash/create');
00006
00007 module.exports = XMLAttribute = (function() {
00008 function XMLAttribute(parent, name, value) {
00009 this.stringify = parent.stringify;
00010 if (name == null) {
00011 throw new Error("Missing attribute name of element " + parent.name);
00012 }
00013 if (value == null) {
00014 throw new Error("Missing attribute value for attribute " + name + " of element " + parent.name);
00015 }
00016 this.name = this.stringify.attName(name);
00017 this.value = this.stringify.attValue(value);
00018 }
00019
00020 XMLAttribute.prototype.clone = function() {
00021 return create(XMLAttribute.prototype, this);
00022 };
00023
00024 XMLAttribute.prototype.toString = function(options, level) {
00025 return ' ' + this.name + '="' + this.value + '"';
00026 };
00027
00028 return XMLAttribute;
00029
00030 })();
00031
00032 }).call(this);