Debian Codegraph @

mixmark-io-domino/lib/ProcessingInstruction.js

raw symbols SCIP
1 "use strict";
2 module.exports = ProcessingInstruction;
3
4 var Node = require('./Node');
5 var CharacterData = require('./CharacterData');
6
7 function ProcessingInstruction(doc, target, data) {
8 CharacterData.call(this);
9 this.nodeType = Node.PROCESSING_INSTRUCTION_NODE;
10 this.ownerDocument = doc;
11 this.target = target;
12 this._data = data;
13 }
14
15 var nodeValue = {
16 get: function() { return this._data; },
17 set: function(v) {
18 if (v === null || v === undefined) { v = ''; } else { v = String(v); }
19 this._data = v;
20 if (this.rooted) this.ownerDocument.mutateValue(this);
21 }
22 };
23
24 ProcessingInstruction.prototype = Object.create(CharacterData.prototype, {
25 nodeName: { get: function() { return this.target; }},
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 ProcessingInstruction(this.ownerDocument, this.target, this._data);
39 }},
40 isEqual: { value: function isEqual(n) {
41 return this.target === n.target && this._data === n._data;
42 }}
43
44 });