UNPKG

1 kBJavaScriptView Raw
1"use strict";
2module.exports = DocumentType;
3
4var Node = require('./Node');
5var Leaf = require('./Leaf');
6var utils = require('./utils');
7var ChildNode = require('./ChildNode');
8
9function DocumentType(name, publicId, systemId) {
10 Leaf.call(this);
11 // Unlike other nodes, doctype nodes always start off unowned
12 // until inserted
13 this.nodeType = Node.DOCUMENT_TYPE_NODE;
14 this.ownerDocument = null;
15 this.name = name;
16 this.publicId = publicId || "";
17 this.systemId = systemId || "";
18}
19
20DocumentType.prototype = Object.create(Leaf.prototype, {
21 nodeName: { get: function() { return this.name; }},
22 nodeValue: {
23 get: function() { return null; },
24 set: function() {}
25 },
26
27 // Utility methods
28 clone: { value: function clone() {
29 utils.DataCloneError();
30 }},
31
32 isEqual: { value: function isEqual(n) {
33 return this.name === n.name &&
34 this.publicId === n.publicId &&
35 this.systemId === n.systemId;
36 }}
37});
38
39Object.defineProperties(DocumentType.prototype, ChildNode);