<commit_before>define(function(require, exports, module) {

  /**
   * 处理子组件（widget 的子类）
   *
   * @module Widget
   */

  'use strict';

  module.exports = function(parentWidget, children) {
    var roleContent,
      i,
      n,
      child,
      uniqueId = parentWidget.uniqueId;

    function createDummy() {
      var div = parentWidget.document.createElement('div');
      roleContent[0].appendChild(div);
      return div;
    }

    function replaceDummy() {
      /*jshint validthis:true */
      var dummy = this['dummy' + uniqueId];
      dummy.parentNode.replaceChild(this.element[0], dummy);
    }

    if (children) {
      roleContent = parentWidget.role(parentWidget.option('contentRole'));
      if (roleContent.length === 0) {
        roleContent = parentWidget.element;
      }

      for (i = 0, n = children.length; i < n; i++) {
        child = children[i];
        // 子组件已加载，直接插入
        if (child.rendered) {
          roleContent.append(child.element);
        } else {
          // 异步加载子 widget，添加占位符，保证顺序
          child['dummy' + uniqueId] = createDummy();

          child.once('render', replaceDummy);
        }
      }
    }
  };

});<commit_msg>添加 parentWidget<commit_after>define(function(require, exports, module) {

  /**
   * 处理子组件（widget 的子类）
   *
   * @module Widget
   */

  'use strict';

  module.exports = function(parentWidget, children) {
    var roleContent,
      i,
      n,
      child,
      uniqueId = parentWidget.uniqueId;

    function createDummy() {
      var div = parentWidget.document.createElement('div');
      roleContent[0].appendChild(div);
      return div;
    }

    function replaceDummy() {
      /*jshint validthis:true */
      var dummy = this['dummy' + uniqueId];
      dummy.parentNode.replaceChild(this.element[0], dummy);
    }

    if (children) {
      roleContent = parentWidget.role(parentWidget.option('contentRole'));
      if (roleContent.length === 0) {
        roleContent = parentWidget.element;
      }

      for (i = 0, n = children.length; i < n; i++) {
        child = children[i];
        // 子组件已加载，直接插入
        if (child.rendered) {
          roleContent.append(child.element);
        } else {
          // 异步加载子 widget，添加占位符，保证顺序
          child['dummy' + uniqueId] = createDummy();

          child.once('render', replaceDummy);
        }
        child.parentWidget = parentWidget;
      }
    }
  };

});
{'fraction_non_alphanumeric': 0.1361932528113286, 'fraction_numerical': 0.003331945022907122, 'mean_word_length': 2.2112299465240643, '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': '2793616', 'n_tokens_mistral': 784, 'n_tokens_neox': 790, 'n_words': 139}