<commit_before>import init from './init';
import createParentElement from '../util/create-parent-element'

var DocumentFragmentPrototype = DocumentFragment.prototype;

function decorateFragmentMethods (frag) {
  frag.appendChild = function (el) {
    return DocumentFragmentPrototype.appendChild.call(this, init(el));
  };

  frag.insertBefore = function (el, beforeEl) {
    return DocumentFragmentPrototype.insertBefore.call(this, init(el), beforeEl);
  };

  frag.replaceChild = function (el, replacedEl) {
    return DocumentFragmentPrototype.replaceChild.call(this, init(el), replacedEl);
  };

  frag.cloneNode = function () {
    var clone = DocumentFragmentPrototype.cloneNode.apply(this, arguments);
    decorateFragmentMethods(clone);
    for (var i = 0; i < clone.childElementCount; i++) {
      init(clone.childNodes[i]);
    }
    return clone;
  };
}

function createInitingFragment() {
  var frag = document.createDocumentFragment();
  decorateFragmentMethods(frag);
  return frag;
}

export default function (html) {
  var frag = createInitingFragment();
  if (typeof html === 'string') {
    var par = createParentElement(html);
    par.innerHTML = html;
    while (par.firstElementChild) {<commit_msg>Inline decorating of document fragment's methods for skate.fragment().<commit_after>import init from './init';
import createParentElement from '../util/create-parent-element'

var DocumentFragmentPrototype = DocumentFragment.prototype;

function decorateFragmentMethods (frag) {
  frag.appendChild = function (el) {
    return DocumentFragmentPrototype.appendChild.call(this, init(el));
  };

  frag.insertBefore = function (el, beforeEl) {
    return DocumentFragmentPrototype.insertBefore.call(this, init(el), beforeEl);
  };

  frag.replaceChild = function (el, replacedEl) {
    return DocumentFragmentPrototype.replaceChild.call(this, init(el), replacedEl);
  };

  frag.cloneNode = function () {
    var clone = DocumentFragmentPrototype.cloneNode.apply(this, arguments);
    decorateFragmentMethods(clone);
    for (var i = 0; i < clone.childElementCount; i++) {
      init(clone.childNodes[i]);
    }
    return clone;
  };
}

export default function (html) {
  var frag = document.createDocumentFragment();
  decorateFragmentMethods(frag);
  if (typeof html === 'string') {
    var par = createParentElement(html);
    par.innerHTML = html;
    while (par.firstElementChild) {
{'fraction_non_alphanumeric': 0.11980033277870217, 'fraction_numerical': 0.0008319467554076539, 'mean_word_length': 4.580046403712297, 'pattern_counts': {'":': 0, '<': 5, '<?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': '70931', 'n_tokens_mistral': 673, 'n_tokens_neox': 673, 'n_words': 158}