<commit_before>/* global XMLSerializer:false */
export var svgHTMLIntegrationPoints = {foreignObject: 1, desc: 1, title: 1};
export var svgNamespace = 'http://www.w3.org/2000/svg';

var doc = typeof document === 'undefined' ? false : document;

// Safari does not like using innerHTML on SVG HTML integration
// points (desc/title/foreignObject).
var needsIntegrationPointFix = doc && (function(document) {
  if (document.createElementNS === undefined) {
    return;
  }
  // In FF title will not accept innerHTML.
  var testEl = document.createElementNS(svgNamespace, 'title');
  testEl.innerHTML = "<div></div>";
  return testEl.childNodes.length === 0 || testEl.childNodes[0].nodeType !== 1;
})(doc);

// Internet Explorer prior to 9 does not allow setting innerHTML if the first element
// is a "zero-scope" element. This problem can be worked around by making
// the first node an invisible text node. We, like Modernizr, use &shy;
var needsShy = doc && (function(document) {
  var testEl = document.createElement('div');
  testEl.innerHTML = "<div></div>";
  testEl.firstChild.innerHTML = "<script><\/script>";
  return testEl.firstChild.innerHTML === '';
})(doc);

// IE 8 (and likely earlier) likes to move whitespace preceeding
// a script tag to appear after it. This means that we can
// accidentally remove whitespace when updating a morph.
var movesWhitespace = doc && (function(document) {
  var testEl = document.createElement('div');
  testEl.innerHTML = "Test: <script type='text/x-placeholder'><\/script>Value";
  return testEl.childNodes[0].nodeValue === 'Test:' &&
          testEl.childNodes[2].nodeValue === ' Value';
})(doc);

// IE8 create a selected attribute where they should only
// create a property
var createsSelectedAttribute = doc && (function(document) {
  var testEl = document.createElement('div');
  testEl.innerHTML = "<select><option></option></select>";
  return testEl.childNodes[0].childNodes[0].getAttribute('selected') === 'selected';
})(doc);

var detectAutoSelectedOption;
if (createsSelectedAttribute) {
  detectAutoSelectedOption = (function(){
    var detectAutoSelectedOptionRegex = /<option[^>]*selected/;
    return function detectAutoSelectedOption(select, option, html) { //jshint ignore:line
      return select.selectedIndex === 0 &&
             !detectAutoSelectedOptionRegex.test(html);
    };
  })();
} else {
  detectAutoSelectedOption = function detectAutoSelectedOption(select, option, html) { //jshint ignore:line
    var selectedAttribute = option.getAttribute('selected');
    return select.selectedIndex === 0 && (
             selectedAttribute === null ||
             ( selectedAttribute !== '' && selectedAttribute.toLowerCase() !== 'selected' )
            );
  };
}

var tagNamesRequiringInnerHTMLFix = doc && (function(document) {
  var tagNamesRequiringInnerHTMLFix;
  // IE 9 and earlier don't allow us to set innerHTML on col, colgroup, frameset,
  // html, style, table, tbody, tfoot, thead, title, tr. Detect this and add
  // them to an initial list of corrected tags.<commit_msg>Remove unneeded feature detect<commit_after>/* global XMLSerializer:false */
export var svgHTMLIntegrationPoints = {foreignObject: 1, desc: 1, title: 1};
export var svgNamespace = 'http://www.w3.org/2000/svg';

var doc = typeof document === 'undefined' ? false : document;

// Safari does not like using innerHTML on SVG HTML integration
// points (desc/title/foreignObject).
var needsIntegrationPointFix = doc && (function(document) {
  if (document.createElementNS === undefined) {
    return;
  }
  // In FF title will not accept innerHTML.
  var testEl = document.createElementNS(svgNamespace, 'title');
  testEl.innerHTML = "<div></div>";
  return testEl.childNodes.length === 0 || testEl.childNodes[0].nodeType !== 1;
})(doc);

// Internet Explorer prior to 9 does not allow setting innerHTML if the first element
// is a "zero-scope" element. This problem can be worked around by making
// the first node an invisible text node. We, like Modernizr, use &shy;
var needsShy = doc && (function(document) {
  var testEl = document.createElement('div');
  testEl.innerHTML = "<div></div>";
  testEl.firstChild.innerHTML = "<script><\/script>";
  return testEl.firstChild.innerHTML === '';
})(doc);

// IE 8 (and likely earlier) likes to move whitespace preceeding
// a script tag to appear after it. This means that we can
// accidentally remove whitespace when updating a morph.
var movesWhitespace = doc && (function(document) {
  var testEl = document.createElement('div');
  testEl.innerHTML = "Test: <script type='text/x-placeholder'><\/script>Value";
  return testEl.childNodes[0].nodeValue === 'Test:' &&
          testEl.childNodes[2].nodeValue === ' Value';
})(doc);

var tagNamesRequiringInnerHTMLFix = doc && (function(document) {
  var tagNamesRequiringInnerHTMLFix;
  // IE 9 and earlier don't allow us to set innerHTML on col, colgroup, frameset,
  // html, style, table, tbody, tfoot, thead, title, tr. Detect this and add
  // them to an initial list of corrected tags.
{'fraction_non_alphanumeric': 0.1339409550227858, 'fraction_numerical': 0.007331087774915791, 'mean_word_length': 4.247401247401247, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5924764', 'n_tokens_mistral': 1450, 'n_tokens_neox': 1410, 'n_words': 466}