[WO-981] Set style.display instead of style

This commit is contained in:
Felix Hammerl 2015-05-19 16:39:59 +02:00
parent 467d001483
commit 7f0235c9b2
1 changed files with 5 additions and 5 deletions

View File

@ -25,10 +25,10 @@ Download.prototype.createDownload = function(options) {
supportsBlob = !!new Blob(); supportsBlob = !!new Blob();
} catch (e) {} } catch (e) {}
if (typeof a.download !== "undefined" && supportsBlob) { if (typeof a.download !== 'undefined' && supportsBlob) {
// ff 30+, chrome 27+ (android: 37+) // ff 30+, chrome 27+ (android: 37+)
document.body.appendChild(a); document.body.appendChild(a);
a.style = "display: none"; a.style.display = 'none';
a.href = window.URL.createObjectURL(new Blob([content], { a.href = window.URL.createObjectURL(new Blob([content], {
type: contentType type: contentType
})); }));
@ -52,15 +52,15 @@ Download.prototype.createDownload = function(options) {
var url = window.URL.createObjectURL(new Blob([content], { var url = window.URL.createObjectURL(new Blob([content], {
type: contentType type: contentType
})); }));
var newTab = window.open(url, "_blank"); var newTab = window.open(url, '_blank');
if (!newTab) { if (!newTab) {
window.location.href = url; window.location.href = url;
} }
} else { } else {
// anything else, where anything at all is better than nothing // anything else, where anything at all is better than nothing
if (typeof content !== "string" && content.buffer) { if (typeof content !== 'string' && content.buffer) {
content = util.arrBuf2BinStr(content.buffer); content = util.arrBuf2BinStr(content.buffer);
} }
window.open('data:' + contentType + ';base64,' + btoa(content), "_blank"); window.open('data:' + contentType + ';base64,' + btoa(content), '_blank');
} }
}; };