Expand BOM prepending to text/*

Now you can save HTML and rely on the auto-BOM prepender
This commit is contained in:
Eli Grey
2015-05-07 13:37:41 -04:00
parent 147cf92020
commit f9a09b26f8
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
/* FileSaver.js
* A saveAs() FileSaver implementation.
* 2015-05-07
* 2015-05-07.1
*
* By Eli Grey, http://eligrey.com
* License: X11/MIT
@@ -125,8 +125,8 @@ var saveAs = saveAs
if (!name) {
name = "download";
}
// prepend BOM for UTF-8 XML and text/plain types
if (/^\s*(?:text\/(?:plain|xml)|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {
// prepend BOM for UTF-8 XML and text/* types (including HTML)
if (/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {
blob = new Blob(["\ufeff", blob], {type: blob.type});
}
if (can_use_save_link) {