<commit_before>/**
 * Add support for details element for browsers which require it
 *
 * @author <NAME> <<EMAIL>>
 * @version 1.0
 */

export default (function Details() {
  // Adapted to ES6 from the following code by @mathiasbynens
  // https://mathiasbynens.be/notes/html5-details-jquery#comment-35
  const isDetailsSupported = (function isDetailsSupported(doc) {
    const el = doc.createElement('details');
    let fake;
    let diff;

    if (!('open' in el)) {
      return false;
    }
    const root = doc.body || (() => {
      const de = doc.documentElement;
      fake = true;
      return de.insertBefore(doc.createElement('body'), de.firstElementChild || de.firstChild);
    });
    el.innerHTML = '<summary>a</summary>b';
    el.style.display = 'block';
    root.appendChild(el);
    diff = el.offsetHeight;
    el.open = true;
    diff = diff !== el.offsetHeight;
    root.removeChild(el);
    if (fake) {
      root.parentNode.removeChild(root);
    }
    return diff;
  }(document));

  const toggleOpen = function toggleOpen() {
    const parent = this.parentNode;

    if (parent.tagName.toLowerCase() === 'details') {
      if (parent.hasAttribute('open')) {
        parent.removeAttribute('open');
      } else {
        parent.setAttribute('open', '');
      }
    }
  };

  if (isDetailsSupported) {
    return;
  }

  // Grab references to the detail DOM elements
  const summaries = document.querySelectorAll('summary');

  // Iterate over all summary elements, set accessibility focused attributes and<commit_msg>Simplify feature detection by dropping support for Chrome <= 10<commit_after>/**
 * Add support for details element for browsers which require it
 *
 * @author <NAME> <<EMAIL>>
 */

export default (function Details() {
  // Check for details element support
  const isDetailsSupported = ('open' in document.createElement('details'));

  const toggleOpen = function toggleOpen() {
    const parent = this.parentNode;

    if (parent.tagName.toLowerCase() === 'details') {
      if (parent.hasAttribute('open')) {
        parent.removeAttribute('open');
      } else {
        parent.setAttribute('open', '');
      }
    }
  };

  if (isDetailsSupported) {
    return;
  }

  // Grab references to the detail DOM elements
  const summaries = document.querySelectorAll('summary');

  // Iterate over all summary elements, set accessibility focused attributes and
{'fraction_non_alphanumeric': 0.13077884214910454, 'fraction_numerical': 0.003331945022907122, 'mean_word_length': 3.134251290877797, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 1, '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': '886749', 'n_tokens_mistral': 684, 'n_tokens_neox': 671, 'n_words': 189}