in lib/websandbox.ts [140:167]
createIframe() {
const containerSelector = this.options.frameContainer;
const container = typeof containerSelector === 'string'
? document.querySelector(containerSelector)
: containerSelector;
if (!container) {
throw new Error('Websandbox: Cannot find container for sandbox ' + container);
}
const frame = document.createElement('iframe');
frame.sandbox = `allow-scripts ${this.options.sandboxAdditionalAttributes}`;
frame.allow = `${this.options.allowAdditionalAttributes}`;
frame.className = this.options.frameClassName ?? '';
if (this.options.allowFullScreen) {
frame.allowFullscreen = true;
}
if (this.options.frameSrc) {
frame.src = this.options.frameSrc;
container.appendChild(frame);
return frame;
}
frame.setAttribute('srcdoc', this._prepareFrameContent(this.options));
container.appendChild(frame);
return frame;
}