<commit_before>defineLazyProperty(impl, "Text", function() {
    function Text(doc, data) {
        this.ownerDocument = doc;
        this._data = data;
    }
    
    var nodeValue = attribute(function() { return this._data; },
                              function(v) { 
                                  this._data = v;
                                  if (this.root)
                                      this.root.mutateValue(this);
                              });
    
    Text.prototype = Object.create(impl.CharacterData.prototype, {
        nodeType: constant(TEXT_NODE),
        nodeName: constant("#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,
        data: nodeValue,

        splitText: constant(function splitText(offset) {
            if (offset > this._data.length) IndexSizeError();

            let newdata = this._data.substring(offset),
                newnode = this.ownerDocument.createTextNode(newdata);
            this._data = this.data.substring(0, offset);

            let parent = this.parentNode;
            if (parent !== null)
                parent.insertBefore(newnode, this.nextSibling);

            return newnode;
        }),

        // XXX
        // wholeText and replaceWholeText() are not implemented yet because
        // the DOMCore specification is considering removing or altering them.
        wholeText: attribute(nyi),
        replaceWholeText: constant(nyi),
   
        // Utility methods

        clone: constant(function clone() {
            return new impl.Text(this.ownerDocument, this._data);
        }),

        isEqual: constant(function isEqual(n) {
            return this._data === n._data;
        }),
     
    });

    return Text;
});<commit_msg>move isEqual() from Text.js to CharacterData.js<commit_after>defineLazyProperty(impl, "Text", function() {
    function Text(doc, data) {
        this.ownerDocument = doc;
        this._data = data;
    }
    
    var nodeValue = attribute(function() { return this._data; },
                              function(v) { 
                                  this._data = v;
                                  if (this.root)
                                      this.root.mutateValue(this);
                              });
    
    Text.prototype = Object.create(impl.CharacterData.prototype, {
        nodeType: constant(TEXT_NODE),
        nodeName: constant("#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,
        data: nodeValue,

        splitText: constant(function splitText(offset) {
            if (offset > this._data.length) IndexSizeError();

            let newdata = this._data.substring(offset),
                newnode = this.ownerDocument.createTextNode(newdata);
            this._data = this.data.substring(0, offset);

            let parent = this.parentNode;
            if (parent !== null)
                parent.insertBefore(newnode, this.nextSibling);

            return newnode;
        }),

        // XXX
        // wholeText and replaceWholeText() are not implemented yet because
        // the DOMCore specification is considering removing or altering them.
        wholeText: attribute(nyi),
        replaceWholeText: constant(nyi),
   
        // Utility methods
        clone: constant(function clone() {
            return new impl.Text(this.ownerDocument, this._data);
        }),
     
    });

    return Text;
});
{'fraction_non_alphanumeric': 0.09827357237715803, 'fraction_numerical': 0.0005312084993359894, 'mean_word_length': 1.6804270462633453, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5169635', 'n_tokens_mistral': 957, 'n_tokens_neox': 922, 'n_words': 235}