XMLDeclaration.js
 1  // Generated by CoffeeScript 1.12.7
 2  (function() {
 3    var XMLDeclaration, XMLNode, isObject,
 4      extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
 5      hasProp = {}.hasOwnProperty;
 6  
 7    isObject = require('./Utility').isObject;
 8  
 9    XMLNode = require('./XMLNode');
10  
11    module.exports = XMLDeclaration = (function(superClass) {
12      extend(XMLDeclaration, superClass);
13  
14      function XMLDeclaration(parent, version, encoding, standalone) {
15        var ref;
16        XMLDeclaration.__super__.constructor.call(this, parent);
17        if (isObject(version)) {
18          ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone;
19        }
20        if (!version) {
21          version = '1.0';
22        }
23        this.version = this.stringify.xmlVersion(version);
24        if (encoding != null) {
25          this.encoding = this.stringify.xmlEncoding(encoding);
26        }
27        if (standalone != null) {
28          this.standalone = this.stringify.xmlStandalone(standalone);
29        }
30      }
31  
32      XMLDeclaration.prototype.toString = function(options) {
33        return this.options.writer.set(options).declaration(this);
34      };
35  
36      return XMLDeclaration;
37  
38    })(XMLNode);
39  
40  }).call(this);