<commit_before>var todoList = document.getElementById("todo-list");
var form = document.getElementById("todo-form");
var todoTitle = document.getElementById("new-todo");

form.onsubmit = function(event) {
    var title = todoTitle.value;
    createTodo(title, function() {
        reloadTodoList();
    });
    todoTitle.value = "";
    event.preventDefault();
};

function createTodo(title, callback) {
    var createRequest = new XMLHttpRequest();
    createRequest.open("PUT", "/api/todo");
    createRequest.setRequestHeader("Content-type", "application/json");
    createRequest.send(JSON.stringify({
        title: title
    }));
    createRequest.onload = function() {
        if (this.status === 200) {
            callback();
        } else {
            throw new Error("Failed to create TODO item. Server returned " + this.status + " - " + this.responseText);
        }
    };
}

function getTodoList(callback) {
    var createRequest = new XMLHttpRequest();
    createRequest.open("GET", "/api/todo");
    createRequest.onload = function() {
        if (this.status === 200) {
            callback(JSON.parse(this.responseText));
        } else {
            throw new Error("Failed to get TODO list. Server returned " + this.status + " - " + this.responseText);
        }
    };
    createRequest.send();
}

function reloadTodoList() {
    getTodoList(function(todos) {
        while (todoList.firstChild) {
            todoList.removeChild(todoList.firstChild);
        }
        todos.forEach(function(todo) {
            var listItem = document.createElement("li");
            listItem.innerText = todo.title;
            todoList.appendChild(listItem);
        });
    });
}

reloadTodoList();<commit_msg>Fix display of tooltips in Firefox<commit_after>var todoList = document.getElementById("todo-list");
var form = document.getElementById("todo-form");
var todoTitle = document.getElementById("new-todo");

form.onsubmit = function(event) {
    var title = todoTitle.value;
    createTodo(title, function() {
        reloadTodoList();
    });
    todoTitle.value = "";
    event.preventDefault();
};

function createTodo(title, callback) {
    var createRequest = new XMLHttpRequest();
    createRequest.open("PUT", "/api/todo");
    createRequest.setRequestHeader("Content-type", "application/json");
    createRequest.send(JSON.stringify({
        title: title
    }));
    createRequest.onload = function() {
        if (this.status === 200) {
            callback();
        } else {
            throw new Error("Failed to create TODO item. Server returned " + this.status + " - " + this.responseText);
        }
    };
}

function getTodoList(callback) {
    var createRequest = new XMLHttpRequest();
    createRequest.open("GET", "/api/todo");
    createRequest.onload = function() {
        if (this.status === 200) {
            callback(JSON.parse(this.responseText));
        } else {
            throw new Error("Failed to get TODO list. Server returned " + this.status + " - " + this.responseText);
        }
    };
    createRequest.send();
}

function reloadTodoList() {
    getTodoList(function(todos) {
        while (todoList.firstChild) {
            todoList.removeChild(todoList.firstChild);
        }
        todos.forEach(function(todo) {
            var listItem = document.createElement("li");
            listItem.textContent = todo.title;
            todoList.appendChild(listItem);
        });
    });
}

reloadTodoList();
{'fraction_non_alphanumeric': 0.13836840588065724, 'fraction_numerical': 0.003459210147016431, 'mean_word_length': 2.699360341151386, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6292951', 'n_tokens_mistral': 997, 'n_tokens_neox': 993, 'n_words': 188}