diff --git a/src/runtime/injectStylesIntoStyleTag.js b/src/runtime/injectStylesIntoStyleTag.js index 0c8c0e59..068827f3 100644 --- a/src/runtime/injectStylesIntoStyleTag.js +++ b/src/runtime/injectStylesIntoStyleTag.js @@ -47,6 +47,10 @@ const getTarget = (function getTarget() { })(); function addModulesToDom(id, list, options) { + if (Object.prototype.toString.call(list) !== '[object Array]') { + return; + } + id = options.base ? id + options.base : id; if (!stylesInDom[id]) { diff --git a/test/runtime/__snapshots__/injectStylesIntoStyleTag.test.js.snap b/test/runtime/__snapshots__/injectStylesIntoStyleTag.test.js.snap index b42479cb..16927a92 100644 --- a/test/runtime/__snapshots__/injectStylesIntoStyleTag.test.js.snap +++ b/test/runtime/__snapshots__/injectStylesIntoStyleTag.test.js.snap @@ -1,5 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`addStyle issue 447 1`] = `"Title

Hello world

"`; + exports[`addStyle should throw error with incorrect "insert" option 1`] = `"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."`; exports[`addStyle should throw error with invalid "insert" option 1`] = `"'#test><><><' is not a valid selector"`; diff --git a/test/runtime/injectStylesIntoStyleTag.test.js b/test/runtime/injectStylesIntoStyleTag.test.js index d5ea4808..eb75b1ce 100644 --- a/test/runtime/injectStylesIntoStyleTag.test.js +++ b/test/runtime/injectStylesIntoStyleTag.test.js @@ -706,4 +706,10 @@ describe('addStyle', () => { expect(document.documentElement.innerHTML).toMatchSnapshot(); }); + + it('issue 447', () => { + injectStylesIntoStyleTag(getId(), {}); + + expect(document.documentElement.innerHTML).toMatchSnapshot(); + }); });