<commit_before>import ValueMap from "../src/value-map"
import tagTypeHasClosingTag from "./tracing/tagTypeHasClosingTag"

window.getRootOriginAtChar = getRootOriginAtChar

export default function getRootOriginAtChar(el, characterIndex, charIndexIsInInnerHTML){
    var tagHtml = el.outerHTML.replace(el.innerHTML,"")
    var openingTag = tagHtml.split("></")[0] + ">"
    var closingTag = "</" +tagHtml.split("></")[1]
    var innerHTML = el.innerHTML

    if (charIndexIsInInnerHTML) {
        characterIndex += openingTag.length;
    }

    var vm = new ValueMap();
    vm.appendString(openingTag, "openingTag", 0)
    vm.appendString(innerHTML, "innerHTML", 0)
    vm.appendString(closingTag, "closingTag", 0)

    var item = vm.getItemAt(characterIndex)

    if (item.originObject === "openingTag") {
        var vm = new ValueMap();

        var openingTagStart = "<" + el.tagName<commit_msg>Fix tracing element whose innerHTML value also occurs with their outerHTML value.<commit_after>import ValueMap from "../src/value-map"
import tagTypeHasClosingTag from "./tracing/tagTypeHasClosingTag"

window.getRootOriginAtChar = getRootOriginAtChar

export default function getRootOriginAtChar(el, characterIndex, charIndexIsInInnerHTML){
    var tagHtmlParts = el.outerHTML.match(/^(\<.*\>).*(\<.*\>)$/)
    var openingTag = tagHtmlParts[1]
    var closingTag = tagHtmlParts[2]
    var innerHTML = el.innerHTML

    if (charIndexIsInInnerHTML) {
        characterIndex += openingTag.length;
    }

    var vm = new ValueMap();
    vm.appendString(openingTag, "openingTag", 0)
    vm.appendString(innerHTML, "innerHTML", 0)
    vm.appendString(closingTag, "closingTag", 0)

    var item = vm.getItemAt(characterIndex)

    if (item.originObject === "openingTag") {
        var vm = new ValueMap();

        var openingTagStart = "<" + el.tagName
{'fraction_non_alphanumeric': 0.12689804772234273, 'fraction_numerical': 0.005422993492407809, 'mean_word_length': 3.9463806970509383, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3596635', 'n_tokens_mistral': 581, 'n_tokens_neox': 554, 'n_words': 126}