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