<commit_before>window.addEventListener('DOMContentLoaded', function () {
	//When the page structure is loaded...
    function getValue(input) {
        return input.getElementsByTagName('input')[0].value;
    };
    
    function setBmi(weight, height) {
        bmi.innerText = Math.round((weight / (height/100 * height/100)) * 100) / 100;
        
        if (19 < bmi.innerText && bmi.innerText < 25) {
            bmi.setAttribute('class', 'ok');
        } else if (17 < bmi.innerText && bmi.innerText < 30) {
            bmi.setAttribute('class', 'medium');
        } else {
            bmi.setAttribute('class', 'bad');
        }
    };
    
    var weight_input = document.getElementsByClassName('weight')[0],
        weight_val = weight_input.getElementsByTagName('span')[0],
        height_input = document.getElementsByClassName('height')[0],
        height_val = height_input.getElementsByTagName('span')[0],
        bmi = document.getElementsByTagName('h1')[2].getElementsByTagName('span')[0];
    
    weight_input.addEventListener('change', function() {
        var weight = getValue(weight_input),
            height = getValue(height_input);

        weight_val.innerText = weight;
        setBmi(weight, height);
    });
    
    height_input.addEventListener('change', function() {
        var weight = getValue(weight_input),
            height = getValue(height_input);
        
        height_val.innerText = height;
        setBmi(weight, height);        
    });
});
<commit_msg>change setAttribute to classList and getElement to querySelector<commit_after>window.addEventListener('DOMContentLoaded', function () {
	//When the page structure is loaded...
    function getValue(input) {
        return input.querySelector('input').value;
    };
    
    function setBmi(weight, height) {
        bmi.innerText = Math.round((weight / (height/100 * height/100)) * 100) / 100;
        
        if (19 < bmi.innerText && bmi.innerText < 25) {
            bmi.classList.remove('medium');
            bmi.classList.remove('bad');
            bmi.classList.add('ok');
        } else if (17 < bmi.innerText && bmi.innerText < 30) {
            bmi.classList.remove('ok');
            bmi.classList.remove('bad');
            bmi.classList.add('medium');
        } else {
            bmi.classList.remove('ok');
            bmi.classList.remove('medium');
            bmi.classList.add('bad');
        }
    };
    
    var weight_input = document.querySelector('.weight'),
        weight_val = weight_input.querySelector('span'),
        height_input = document.querySelector('.height'),
        height_val = height_input.querySelector('span'),
        bmi = document.querySelector('h1 span'),
        weight = getValue(weight_input),
        height = getValue(height_input);

        setBmi(weight, height);
    
    weight_input.addEventListener('change', function() {
        var weight = getValue(weight_input),
            height = getValue(height_input);

        weight_val.innerText = weight;
        setBmi(weight, height);
    });
    
    height_input.addEventListener('change', function() {
        var weight = getValue(weight_input),
            height = getValue(height_input);
        
        height_val.innerText = height;
        setBmi(weight, height);        
    });
});

{'fraction_non_alphanumeric': 0.13516782582400969, 'fraction_numerical': 0.014817054732385848, 'mean_word_length': 2.4422476586888657, 'pattern_counts': {'":': 0, '<': 11, '<?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': '2086039', 'n_tokens_mistral': 964, 'n_tokens_neox': 946, 'n_words': 161}