mirror of
https://github.com/videojs/video.js.git
synced 2024-12-27 02:43:45 +02:00
Set this.el_ directly instead of using another variable
The flash tech doesn't need to hold onto a reference to the placeholder element after the embed code has been generated. Set this.el_ to the embed code immediately instead of using another property to track it during init. Tested in IE8.
This commit is contained in:
parent
da19fa3ead
commit
a77e39f342
@ -244,19 +244,12 @@ vjs.Flash = vjs.MediaTechController.extend({
|
||||
|
||||
// If not using iFrame mode, embed as normal object
|
||||
} else {
|
||||
this.obj = vjs.Flash.embed(options['swf'], placeHolder, flashVars, params, attributes);
|
||||
this.el_ = vjs.Flash.embed(options['swf'], placeHolder, flashVars, params, attributes);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
vjs.Flash.prototype.dispose = function(){
|
||||
// the tech is being disposed before onReady has been triggered
|
||||
// removing the object from the DOM prevents that from firing
|
||||
// and overwriting the state of the replacement tech
|
||||
if (this.obj) {
|
||||
this.obj.parentNode.removeChild(this.obj);
|
||||
this.obj = null;
|
||||
}
|
||||
vjs.MediaTechController.prototype.dispose.call(this);
|
||||
};
|
||||
|
||||
@ -408,14 +401,6 @@ vjs.Flash['onReady'] = function(currSwf){
|
||||
// Reference player on tech element
|
||||
el['player'] = player;
|
||||
|
||||
// Update reference to playback technology element
|
||||
tech.el_ = el;
|
||||
|
||||
// Remove the initialization reference to the tech element
|
||||
if (tech.obj) {
|
||||
tech.obj = null;
|
||||
}
|
||||
|
||||
vjs.Flash.checkReady(tech);
|
||||
};
|
||||
|
||||
|
@ -112,27 +112,3 @@ test('dispose removes the object element even before ready fires', function() {
|
||||
strictEqual(tech.el(), null, 'tech el is null');
|
||||
strictEqual(parentEl.children.length, 0, 'parent el is empty');
|
||||
});
|
||||
|
||||
test('dispose removes the object element after ready fires', function() {
|
||||
var noop = function() {},
|
||||
parentEl = document.createElement('div'),
|
||||
player = {
|
||||
id: noop,
|
||||
on: noop,
|
||||
options_: {}
|
||||
},
|
||||
tech = new vjs.Flash(player, {
|
||||
'parentEl': parentEl
|
||||
});
|
||||
|
||||
player.tech = tech;
|
||||
|
||||
document.getElementById('qunit-fixture').appendChild(parentEl);
|
||||
tech.obj['player'] = player;
|
||||
|
||||
vjs.Flash['onReady'](parentEl.children[0].id);
|
||||
strictEqual(tech.obj, null, 'nulled initialization reference');
|
||||
tech.dispose();
|
||||
strictEqual(tech.el(), null, 'tech el is null');
|
||||
strictEqual(parentEl.children.length, 0, 'parent el is empty');
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user