<commit_before>import Ember from 'ember';
import ResizeMixin from 'ember-twiddle/lib/resize-mixin';

const { $, on } = Ember;

export default Ember.Component.extend(ResizeMixin, {
  iframeId: 'dummy-content-iframe',
  classNames: ['content'],

  didReceiveAttrs: function() {
    if(!this.element) {
      return;
    }

    if(this.element.firstElementChild) {
      this.element.removeChild(this.element.firstElementChild);
    }

    let ifrm = document.createElement('iframe');
    ifrm.id = this.iframeId;
    let supportsSrcDoc = ('srcdoc' in ifrm);

    if (!Ember.testing && supportsSrcDoc) {
      ifrm.sandbox = 'allow-scripts allow-forms';
      ifrm.srcdoc = this.get('html');
    }

    this.element.appendChild(ifrm);

    if(!supportsSrcDoc && !Ember.testing) {
      ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument;
      ifrm.document.open();
      ifrm.document.write('<p>Your browser doesn\'t support the <code>srcdoc</code> attribute for iframes. Ember Twiddle needs this to run safely.</p><p>Please use the latest version of Chrome, Safari or Firefox.</p><p>More information: <a href="https://github.com/ember-cli/ember-twiddle#browser-support">https://github.com/ember-cli/ember-twiddle#browser-support</a>');
      ifrm.document.close();
    }

    if (Ember.testing) {
      ifrm = ifrm.contentWindow;
      ifrm.document.open();
      ifrm.document.write(this.get('html'));
      ifrm.document.close();<commit_msg>Allow modals (alert, confirm) in ember-twiddle<commit_after>import Ember from 'ember';
import ResizeMixin from 'ember-twiddle/lib/resize-mixin';

const { $, on } = Ember;

export default Ember.Component.extend(ResizeMixin, {
  iframeId: 'dummy-content-iframe',
  classNames: ['content'],

  didReceiveAttrs: function() {
    if(!this.element) {
      return;
    }

    if(this.element.firstElementChild) {
      this.element.removeChild(this.element.firstElementChild);
    }

    let ifrm = document.createElement('iframe');
    ifrm.id = this.iframeId;
    let supportsSrcDoc = ('srcdoc' in ifrm);

    if (!Ember.testing && supportsSrcDoc) {
      ifrm.sandbox = 'allow-scripts allow-forms allow-modals';
      ifrm.srcdoc = this.get('html');
    }

    this.element.appendChild(ifrm);

    if(!supportsSrcDoc && !Ember.testing) {
      ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument;
      ifrm.document.open();
      ifrm.document.write('<p>Your browser doesn\'t support the <code>srcdoc</code> attribute for iframes. Ember Twiddle needs this to run safely.</p><p>Please use the latest version of Chrome, Safari or Firefox.</p><p>More information: <a href="https://github.com/ember-cli/ember-twiddle#browser-support">https://github.com/ember-cli/ember-twiddle#browser-support</a>');
      ifrm.document.close();
    }

    if (Ember.testing) {
      ifrm = ifrm.contentWindow;
      ifrm.document.open();
      ifrm.document.write(this.get('html'));
      ifrm.document.close();
{'fraction_non_alphanumeric': 0.1478737113402062, 'fraction_numerical': 0.0, 'mean_word_length': 3.683257918552036, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 4, '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': '6696684', 'n_tokens_mistral': 1014, 'n_tokens_neox': 989, 'n_words': 181}