[FIX] website editor clear()

Apparently in some unclear situations, using delete on the dataset blows
up (issue appears in both Safari and phantomjs) failing the test.

Only try the deletion if the item is actually present in the dataset,
and wrap it in a try/except to handle it blowing up
This commit is contained in:
Xavier Morel
2015-06-17 11:12:58 +02:00
parent 128a3be192
commit 77eca089d1
@@ -2512,7 +2512,14 @@ var VideoDialog = Widget.extend({
this.media = $iframe[0];
},
clear: function () {
delete this.media.dataset.src;
if (this.media.dataset.src) {
try {
delete this.media.dataset.src;
} catch(e) {
this.media.dataset.src = undefined;
}
}
this.media.className = this.media.className.replace(/(^|\s)media_iframe_video(\s|$)/g, ' ');
},
});