Files
cloud-code/claude-code-source/node_modules/@mixmark-io/domino/lib/Text.js
janlaywss 6187147b74 reconstruct and build @anthropic-ai/claude-code source from source map
- Extract 4756 source files from cli.js.map (57MB)
- Set up Bun build system with bun:bundle feature flag shim
- Configure 90+ compile-time feature flags matching production defaults
- Inject MACRO constants (VERSION, BUILD_TIME, etc.)
- Create stubs for private packages (color-diff-napi, modifiers-napi, etc.)
- Install all public dependencies via pnpm
- Patch commander v14 to allow multi-char short flags (-d2e)
- Build output: dist/cli.js (22MB), verified working
2026-03-31 19:19:50 +08:00

76 lines
2.1 KiB
JavaScript

"use strict";
module.exports = Text;
var utils = require('./utils');
var Node = require('./Node');
var CharacterData = require('./CharacterData');
function Text(doc, data) {
CharacterData.call(this);
this.nodeType = Node.TEXT_NODE;
this.ownerDocument = doc;
this._data = data;
this._index = undefined;
}
var nodeValue = {
get: function() { return this._data; },
set: function(v) {
if (v === null || v === undefined) { v = ''; } else { v = String(v); }
if (v === this._data) return;
this._data = v;
if (this.rooted)
this.ownerDocument.mutateValue(this);
if (this.parentNode &&
this.parentNode._textchangehook)
this.parentNode._textchangehook(this);
}
};
Text.prototype = Object.create(CharacterData.prototype, {
nodeName: { value: "#text" },
// These three attributes are all the same.
// The data attribute has a [TreatNullAs=EmptyString] but we'll
// implement that at the interface level
nodeValue: nodeValue,
textContent: nodeValue,
innerText: nodeValue,
data: {
get: nodeValue.get,
set: function(v) {
nodeValue.set.call(this, v===null ? '' : String(v));
},
},
splitText: { value: function splitText(offset) {
if (offset > this._data.length || offset < 0) utils.IndexSizeError();
var newdata = this._data.substring(offset),
newnode = this.ownerDocument.createTextNode(newdata);
this.data = this.data.substring(0, offset);
var parent = this.parentNode;
if (parent !== null)
parent.insertBefore(newnode, this.nextSibling);
return newnode;
}},
wholeText: { get: function wholeText() {
var result = this.textContent;
for (var next = this.nextSibling; next; next = next.nextSibling) {
if (next.nodeType !== Node.TEXT_NODE) { break; }
result += next.textContent;
}
return result;
}},
// Obsolete, removed from spec.
replaceWholeText: { value: utils.nyi },
// Utility methods
clone: { value: function clone() {
return new Text(this.ownerDocument, this._data);
}},
});