Skip to content

Commit

Permalink
Merge pull request #290 from SukkaW/merge-prefix-condition
Browse files Browse the repository at this point in the history
size optimization
  • Loading branch information
thysultan committed Apr 23, 2022
2 parents 09388f0 + 31e0dd2 commit 55c363f
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions src/Prefixer.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,22 @@ export function prefix (value, length, children) {
// appearance, user-select, transform, hyphens, text-size-adjust
case 5349: case 4246: case 4810: case 6968: case 2756:
return WEBKIT + value + MOZ + value + MS + value + value
// flex, flex-direction
case 6828: case 4268:
// writing-mode
case 5936:
switch (charat(value, length + 11)) {
// vertical-l(r)
case 114:
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value
// vertical-r(l)
case 108:
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value
// horizontal(-)tb
case 45:
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value
// default: fallthrough to below
}
// flex, flex-direction, scroll-snap-type, writing-mode
case 6828: case 4268: case 2903:
return WEBKIT + value + MS + value + value
// order
case 6165:
Expand Down Expand Up @@ -123,22 +137,6 @@ export function prefix (value, length, children) {
return replace(value, ':', ':' + MS) + value
}
break
// writing-mode
case 5936:
switch (charat(value, length + 11)) {
// vertical-l(r)
case 114:
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value
// vertical-r(l)
case 108:
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value
// horizontal(-)tb
case 45:
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value
}
// scroll-snap-type
case 2903:
return WEBKIT + value + MS + value + value
// scroll-margin, scroll-margin-(top|right|bottom|left)
case 5719: case 2647: case 2135: case 3927: case 2391:
return replace(value, 'scroll-', 'scroll-snap-') + value
Expand Down

0 comments on commit 55c363f

Please sign in to comment.