<commit_before>/// <reference path="../virtual-dom.d.ts" />

import h = require('virtual-dom/h');
import patch = require('virtual-dom/patch');
import diff = require('virtual-dom/diff');
import VNode = require('virtual-dom/vnode/vnode');
import VText = require('virtual-dom/vnode/vtext');
import createElement = require('virtual-dom/create-element');
import virtualize = require('vdom-virtualize');

export function updateElement(element, vtree) {
  console.assert(!!element);
  if (element.firstChild) {
    const prev = element.firstChild.vtree || virtualize(element.firstChild);
    const patches = diff(prev, vtree);
    patch(element.firstChild, patches);
  } else {
    const node = createElement(vtree);
    element.appendChild(node);
  }
  element.firstChild.vtree = vtree;
}

export function updateElementVtree(element) {
  console.assert(!!element);
  if (element.firstChild) {
    element.firstChild.vtree = virtualize(element.firstChild);
  }
}

import app from '../app';
app.h = (el, props, ...children) => h(el, props, children);
app.createElement = app.h;<commit_msg>Support custom element in jsx/tsx<commit_after>/// <reference path="../virtual-dom.d.ts" />

import h = require('virtual-dom/h');
import patch = require('virtual-dom/patch');
import diff = require('virtual-dom/diff');
import VNode = require('virtual-dom/vnode/vnode');
import VText = require('virtual-dom/vnode/vtext');
import createElement = require('virtual-dom/create-element');
import virtualize = require('vdom-virtualize');

export function updateElement(element, vtree) {
  console.assert(!!element);
  if (element.firstChild) {
    const prev = element.firstChild.vtree || virtualize(element.firstChild);
    const patches = diff(prev, vtree);
    patch(element.firstChild, patches);
  } else {
    const node = createElement(vtree);
    element.appendChild(node);
  }
  element.firstChild.vtree = vtree;
}

export function updateElementVtree(element) {
  console.assert(!!element);
  if (element.firstChild) {
    element.firstChild.vtree = virtualize(element.firstChild);
  }
}

import app from '../app';
app.h = (el, props, ...children) => (typeof el === 'string') ?
    h(el, props, children) : el(props, children);

app.createElement = app.h;
{'fraction_non_alphanumeric': 0.1605545617173524, 'fraction_numerical': 0.0, 'mean_word_length': 4.663291139240506, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '5151761', 'n_tokens_mistral': 691, 'n_tokens_neox': 689, 'n_words': 146}