1
0
mirror of https://github.com/videojs/video.js.git synced 2025-07-07 01:07:13 +02:00

feat: copy properties from <video-js> to the media el (#5039)

This commit is contained in:
Brandon Casey
2018-05-09 15:55:29 -04:00
committed by GitHub
parent 6147e5f7aa
commit c6617b24f7
2 changed files with 12 additions and 3 deletions

View File

@ -570,6 +570,13 @@ class Player extends Component {
el.appendChild(tag); el.appendChild(tag);
playerElIngest = this.playerElIngest_ = el; playerElIngest = this.playerElIngest_ = el;
// move properties over from our custom `video-js` element
// to our new `video` element. This will move things like
// `src` or `controls` that were set via js before the player
// was initialized.
Object.keys(el).forEach((k) => {
tag[k] = el[k];
});
} }
// set tabindex to -1 so we could focus on the player element // set tabindex to -1 so we could focus on the player element

View File

@ -63,7 +63,7 @@ const setupEnv = function(env, testName) {
sinon.stub(log, 'error'); sinon.stub(log, 'error');
env.fixture = document.getElementById('qunit-fixture'); env.fixture = document.getElementById('qunit-fixture');
if (testName === 'change video el' || testName === 'change audio el') { if ((/^change/i).test(testName)) {
Html5.prototype.movingMediaElementInDOM = false; Html5.prototype.movingMediaElementInDOM = false;
} }
@ -73,7 +73,9 @@ const setupEnv = function(env, testName) {
}); });
videojs.hook('setup', env.hook); videojs.hook('setup', env.hook);
if ((/audio/i).test(testName)) { if ((/video-js/i).test(testName)) {
env.mediaEl = document.createElement('video-js');
} else if ((/audio/i).test(testName)) {
env.mediaEl = document.createElement('audio'); env.mediaEl = document.createElement('audio');
} else { } else {
env.mediaEl = document.createElement('video'); env.mediaEl = document.createElement('video');
@ -104,7 +106,7 @@ const setupAfterEach = function(totalSourcesets) {
}; };
}; };
const testTypes = ['video el', 'change video el', 'audio el', 'change audio el']; const testTypes = ['video el', 'change video el', 'audio el', 'change audio el', 'video-js', 'change video-js el'];
QUnit[qunitFn]('sourceset', function(hooks) { QUnit[qunitFn]('sourceset', function(hooks) {
QUnit.module('source before player', (subhooks) => testTypes.forEach((testName) => { QUnit.module('source before player', (subhooks) => testTypes.forEach((testName) => {