1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-08 07:00:10 +02:00
video.js/test/unit/utils/custom-element.test.js
2023-07-12 19:43:17 +02:00

30 lines
756 B
JavaScript

/* eslint-env browser */
import videojs from '../../../src/js/video.js';
export class TestCustomElement extends HTMLElement {
constructor() {
super();
const shadowRoot = this.attachShadow({ mode: 'closed' });
const containerElem = document.createElement('div');
containerElem.setAttribute('data-vjs-player', '');
shadowRoot.appendChild(containerElem);
const videoElem = document.createElement('video');
videoElem.setAttribute('width', 640);
videoElem.setAttribute('height', 260);
containerElem.appendChild(videoElem);
this.innerPlayer = videojs(videoElem);
}
}
// Not supported on Chrome < 54
if ('customElements' in window) {
window.customElements.define('test-custom-element', TestCustomElement);
}