<commit_before>import Pop from '../pop';
import utils from '../../utils/utils';


const Default = {
  trigger: 'click',
  closeOnClickBody: true,
  html: true,
  placement: 'bottom-start',
  template: `<div role="select" class="h-dropdown"><div class="h-dropdown-arrow"></div><div class="h-dropdown-inner"></div></div>`,
  arrowSelector: '.h-dropdown-arrow, .h-dropdown__arrow',
  innerSelector: '.h-dropdown-inner, .h-dropdown__inner',
  // Modifiers: {
  //   preventOverflow: {
  //     enabled: false,
  //     // boundariesElement: 'viewport'
  //   },
  // },
  type: 'dropdown',
  delay: 300,
}

class Dropdown extends Pop {
  constructor(el, param) {
    let container = document.body;
    if (!param.container) {
      container = el || document.body;
      while (container && container.tagName != 'BODY' && !utils.hasClass(container, 'h-dropdown-common-container')) {
        container = container.parentNode;
      }
    }
    param = utils.extend({}, Default, {
      boundariesElement: 'viewport',
      container
    }, param);
    super(el, param);
  }
}

export default Dropdown;
<commit_msg>fix: 去除dropdown使用body作为父级元素<commit_after>import Pop from '../pop';
import utils from '../../utils/utils';


const Default = {
  trigger: 'click',
  closeOnClickBody: true,
  html: true,
  placement: 'bottom-start',
  template: `<div role="select" class="h-dropdown"><div class="h-dropdown-arrow"></div><div class="h-dropdown-inner"></div></div>`,
  arrowSelector: '.h-dropdown-arrow, .h-dropdown__arrow',
  innerSelector: '.h-dropdown-inner, .h-dropdown__inner',
  // Modifiers: {
  //   preventOverflow: {
  //     enabled: false,
  //     // boundariesElement: 'viewport'
  //   },
  // },
  type: 'dropdown',
  delay: 300,
}

class Dropdown extends Pop {
  constructor(el, param) {
    param = utils.extend({}, Default, {
      boundariesElement: 'viewport'
    }, param);
    // let container = document.body;
    // if (!param.container) {
    //   container = el || document.body;
    //   while (container && container.tagName != 'BODY' && !utils.hasClass(container, 'h-dropdown-common-container')) {
    //     container = container.parentNode;
    //   }
    //   if (container != document.body) {
    //     param.container = container;
    //   }
    // }
    super(el, param);
  }
}

export default Dropdown;

{'fraction_non_alphanumeric': 0.17768240343347638, 'fraction_numerical': 0.002575107296137339, 'mean_word_length': 2.8979933110367893, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '5423939', 'n_tokens_mistral': 745, 'n_tokens_neox': 745, 'n_words': 153}