<commit_before>window.eventHandlers.click['get-children'] = function (event)
{
  var container = event.target.parentNode;
  var level = parseInt(container.style.marginLeft) || 0;
  var level_next = container.nextSibling && parseInt(container.nextSibling.style.marginLeft) || 0;
  var ref_id = parseInt(container.getAttribute('ref-id'));
  container = container.parentNode;
  var model = window.dominspections[container.getAttribute('data-model-id')];
  var target = document.getElementById('target-element');
  var is_editable = container.hasAttribute('edit-handler');
  var cb = null;
  var target_id = 0;

  if (container.contains(target))
    target_id = parseInt(target.getAttribute('ref-id'));
  if (level_next > level)
  {
    model.collapse(ref_id);
    window.eventHandlers.click['get-children'].callback(container, model, target_id, is_editable);
  }
  else
  {
    cb = window.eventHandlers.click['get-children'].callback.bind(null, container, model, target_id, is_editable);
    model.expand(cb, ref_id, event.ctrlKey ? 'subtree' : 'children');
  }
};

window.eventHandlers.click['get-children'].callback = function(container, model, target_id, is_editable)
{
  var tmpl = window.templates.inspected_dom_node(model, target_id, is_editable, false);
  container.clearAndRender(tmpl);<commit_msg>Fixed code for DOM tree view and switch to re_render to update the view.<commit_after>window.eventHandlers.click['get-children'] = function (event)
{
  var container = event.target.parentNode;
  var level = parseInt(container.style.marginLeft) || 0;
  var level_next = container.nextSibling && parseInt(container.nextSibling.style.marginLeft) || 0;
  var ref_id = parseInt(container.getAttribute('ref-id'));
  while (container && !container.hasAttribute('data-model-id'))
    container = container.parentNode;
  if (container.hasAttribute('data-model-id'))
  {
    var model = window.dominspections[container.getAttribute('data-model-id')];
    var target = document.getElementById('target-element');
    var is_editable = container.hasAttribute('edit-handler');
    var cb = null;
    var target_id = 0;

    if (container.contains(target))
      target_id = parseInt(target.getAttribute('ref-id'));
    if (level_next > level)
    {
      model.collapse(ref_id);
      window.eventHandlers.click['get-children'].callback(container, model, target_id, is_editable);
    }
    else
    {
      cb = window.eventHandlers.click['get-children'].callback.bind(null, container, model, target_id, is_editable);
      model.expand(cb, ref_id, event.ctrlKey ? 'subtree' : 'children');
    }
  }
};

window.eventHandlers.click['get-children'].callback = function(container, model, target_id, is_editable)
{
  var tmpl = window.templates.inspected_dom_node(model, target_id, is_editable, true);
  container.re_render(tmpl);
{'fraction_non_alphanumeric': 0.13849431818181818, 'fraction_numerical': 0.002130681818181818, 'mean_word_length': 4.90566037735849, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3821520', 'n_tokens_mistral': 871, 'n_tokens_neox': 882, 'n_words': 159}