Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/plugins/flexbox ie/t.split is undefined #215

Merged
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
18 changes: 17 additions & 1 deletion modules/plugins/flexboxIE.js
Original file line number Diff line number Diff line change
@@ -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,
@@ -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