Skip to content

Commit c2718d4

Browse files
committed
site-video :: use <template> appendChild instead of <script> innerHTML
1 parent afcfcd0 commit c2718d4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/js/ui/site-video/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class SiteVideo {
100100

101101
if( motion_reduced ) this._onStopComplete({ target: this.bg, propertyName: 'opacity' });
102102
}
103-
oembed(script) {
103+
oembed(template) {
104104
// remove video from DOM
105105
if( this._mode === MODE_INLINE ) this.video.remove();
106106

@@ -111,8 +111,11 @@ class SiteVideo {
111111
this.emitter.emit('SiteScroll.stop', true);
112112
this.emitter.emit('Video.pauseAll');
113113

114-
// inject iframe into DOM
115-
this.videoWrap.innerHTML = script.innerHTML;
114+
// empty DOM element
115+
removeAllChilds(this.videoWrap);
116+
117+
// inject iframe into DOM element
118+
this.videoWrap.appendChild( template.content.cloneNode(true) );
116119

117120
// make sure ANIMATE_OUT is removed
118121
this.el.classList.remove(ANIMATE_OUT_CLASSNAME);

0 commit comments

Comments
 (0)