Skip to content

Commit

Permalink
Merge pull request #69 from frenzzy/ie9-btoa
Browse files Browse the repository at this point in the history
Do not use "btoa" it this feature does not exist
  • Loading branch information
frenzzy committed Oct 30, 2016
2 parents bb0edbd + d76df5e commit 627e65d
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/insertCss.js
Expand Up @@ -41,12 +41,7 @@ function removeCss(ids) {
* // Remove it from the DOM
* removeCss();
*/
function insertCss(styles, options) {
const { replace, prepend } = Object.assign({
replace: false,
prepend: false,
}, options);

function insertCss(styles, { replace = false, prepend = false } = {}) {
const ids = [];
for (let i = 0; i < styles.length; i++) {
const [moduleId, css, media, sourceMap] = styles[i];
Expand Down Expand Up @@ -79,10 +74,10 @@ function insertCss(styles, options) {
}

let cssText = css;
if (sourceMap) {
if (sourceMap && btoa) { // skip IE9 and below, see http://caniuse.com/atob-btoa
cssText += `\n/*# sourceMappingURL=data:application/json;base64,${
b64EncodeUnicode(JSON.stringify(sourceMap))}*/`;
cssText += `\n/*# sourceURL=${id}*/`;
cssText += `\n/*# sourceURL=${sourceMap.file}?${id}*/`;
}

if ('textContent' in elem) {
Expand Down

0 comments on commit 627e65d

Please sign in to comment.