Skip to content

Commit

Permalink
Merge pull request robinweser#215 from ahmaddehnavi/fix/plugins/flexb…
Browse files Browse the repository at this point in the history
…oxIE/t.split_is_undefined

Fix/plugins/flexbox ie/t.split is undefined
  • Loading branch information
robinweser authored Sep 28, 2021
2 parents f3c337c + 336cd56 commit de97679
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion modules/plugins/flexboxIE.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const flexShorthandMappings = {
unset: 'unset',
}
const isUnitlessNumber = /^\d+(\.\d+)?$/

const logTag = 'inline-style-prefixer.flexboxIE plugin'
export default function flexboxIE(
property: string,
value: any,
Expand All @@ -47,6 +47,22 @@ export default function flexboxIE(
return
}

if (typeof value === 'number' && value < 0) {
// ignore negative values;
console.warn(
`${logTag}: "flex: ${value}", negative values is not valid and will be ignored.`
)
return
}

if (!value.split) {
console.warn(
`${logTag}: "flex: ${value}", value format is not detected, it will be remain as is`
)
style.msFlex = value
return
}

// The next thing we can look for is if there are multiple values.
const flexValues = value.split(/\s/)
// If we only have a single value that wasn't a positive unitless
Expand Down

0 comments on commit de97679

Please sign in to comment.