Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/insertCss.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function removeCss(ids) {
* // Remove it from the DOM
* removeCss();
*/
function insertCss(styles, { replace = false, prepend = false, prefix = 's' } = {}) {
function insertCss(styles, { replace = false, prepend = false, prefix = 's', type } = {}) {
const ids = []
for (let i = 0; i < styles.length; i++) {
const [moduleId, css, media, sourceMap] = styles[i]
Expand All @@ -66,7 +66,8 @@ function insertCss(styles, { replace = false, prepend = false, prefix = 's' } =
create = true

elem = document.createElement('style')
elem.setAttribute('type', 'text/css')
if (type === undefined || typeof type === 'string')
elem.setAttribute('type', type || 'text/css')
Comment on lines +69 to +70
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (type === undefined || typeof type === 'string')
elem.setAttribute('type', type || 'text/css')
if (!type || typeof type === 'string') {
elem.setAttribute('type', type || 'text/css')
}

elem.id = id

if (media) {
Expand Down