Skip to content

Commit

Permalink
Handle extraneous whitespace in CSS values
Browse files Browse the repository at this point in the history
  • Loading branch information
moorereason authored and iRyusa committed Nov 15, 2022
1 parent e0e5919 commit c592f0b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/mjml-core/src/helpers/shorthandParser.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { get } from 'lodash'

export default function (cssValue, direction) {
const splittedCssValue = cssValue.split(' ')
const splittedCssValue = cssValue.trim().replace(/\s+/g,' ').split(' ', 4)
let directions = {}

switch (splittedCssValue.length) {
Expand Down
4 changes: 4 additions & 0 deletions packages/mjml-core/tests/shorthandParser-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const testValues = [
input: '1px 2px 3px 4px',
output: { top: 1, right: 2, bottom: 3, left: 4 },
},
{
input: ' 1px 2px 3px 4px ',
output: { top: 1, right: 2, bottom: 3, left: 4 },
},
]

testValues.forEach(testUnit => {
Expand Down

0 comments on commit c592f0b

Please sign in to comment.