<commit_before>this.data = document.body.innerHTML;
this.uri = document.location.href;

if(document.getElementsByTagName("pre")[0] && document.getElementsByTagName("pre").length == 1){
  // console.log("JSONAce: data is wrapped in <pre>...</pre>, stripping HTML...");
  this.data = document.getElementsByTagName("pre")[0].innerHTML;
}

function IsJsonString(str) {
  try {
      JSON.parse(str);
  } catch (e) {
      return false;
  }<commit_msg>use document elements length to avoid parsing pre with content<commit_after>this.data = document.body.innerHTML;
this.uri = document.location.href;

if(document.getElementsByTagName("pre")[0] && document.body.getElementsByTagName('*').length == 1 && document.getElementsByTagName("pre").length == 1){
  // console.log("JSONAce: data is wrapped in <pre>...</pre>, stripping HTML...");
  this.data = document.getElementsByTagName("pre")[0].innerHTML;
}

function IsJsonString(str) {
  try {
      JSON.parse(str);
  } catch (e) {
      return false;
  }
{'fraction_non_alphanumeric': 0.17234468937875752, 'fraction_numerical': 0.0070140280561122245, 'mean_word_length': 4.459016393442623, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4533990', 'n_tokens_mistral': 326, 'n_tokens_neox': 320, 'n_words': 61}