Debian Codegraph @

mixmark-io-domino/lib/Comment.js

raw symbols SCIP
1 "use strict";
2 module.exports = Comment;
3
4 var Node = require('./Node');
5 var CharacterData = require('./CharacterData');
6
7 function Comment(doc, data) {
8 CharacterData.call(this);
9 this.nodeType = Node.COMMENT_NODE;
10 this.ownerDocument = doc;
11 this._data = data;
12 }
13
14 var nodeValue = {
15 get: function() { return this._data; },
16 set: function(v) {
17 if (v === null || v === undefined) { v = ''; } else { v = String(v); }
18 this._data = v;
19 if (this.rooted)
20 this.ownerDocument.mutateValue(this);
21 }
22 };
23
24 Comment.prototype = Object.create(CharacterData.prototype, {
25 nodeName: { value: '#comment' },
26 nodeValue: nodeValue,
27 textContent: nodeValue,
28 innerText: nodeValue,
29 data: {
30 get: nodeValue.get,
31 set: function(v) {
32 nodeValue.set.call(this, v===null ? '' : String(v));
33 },
34 },
35
36 // Utility methods
37 clone: { value: function clone() {
38 return new Comment(this.ownerDocument, this._data);
39 }},
40 });