Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Commit

Permalink
fix(auto-prefixer): resolve perf impacts as reported by LightHouse
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasBurleson committed May 10, 2017
1 parent beb5ed0 commit aa41e12
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/lib/utils/auto-prefixer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ describe('auto-prefixer for ', () => {
let actual = applyCssPrefixes(input);
expect(Array.isArray(actual['display'])).toBeTruthy();
expect(actual['display'][0]).toEqual('-webkit-box');
expect(actual['display'][4]).toEqual('flex');
expect(actual['display'][3]).toEqual('flex');
});

});

/**
Expand Down
12 changes: 3 additions & 9 deletions src/lib/utils/auto-prefixer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@ export function applyCssPrefixes(target) {
if (value === 'flex') {
target['display'] = [
'-webkit-box',
'-moz-box',
'-ms-flexbox',
'-webkit-flex',
'flex'
];
} else if (value === 'inline-flex') {
target['display'] = [
'-webkit-inline-box',
'-moz-inline-box',
'-ms-inline-flexbox',
'-webkit-inline-flex',
'inline-flex'
Expand All @@ -39,18 +37,17 @@ export function applyCssPrefixes(target) {
target['-ms-flex'] = value;
target['-webkit-flex'] = value;
target['-webkit-box-flex'] = value.split(" ")[0];
target['-moz-box-flex'] = value.split(" ")[0];
break;

case 'flex-direction':
value = value || "row";
target['flex-direction'] = value;
target['-ms-flex-direction'] = value;
target['-webkit-flex-direction'] = value;
target['-webkit-box-orient'] = toBoxOrient(value);
target['-moz-box-orient'] = toBoxOrient(value);
target['-webkit-box-direction'] = toBoxDirection(value);
target['-moz-box-direction'] = toBoxDirection(value);
target['flex-direction'] = value;
break;

case 'flex-wrap':
Expand Down Expand Up @@ -78,24 +75,21 @@ export function applyCssPrefixes(target) {
if (isNaN(value)) {
value = "0";
}
target['order'] = value;
target['-webkit-order'] = value;
target['-ms-flex-order'] = value;
target['-moz-box-ordinal-group'] = toBoxOrdinal(value);
target['-webkit-box-ordinal-group'] = toBoxOrdinal(value);
target['-webkit-order'] = value;
target['order'] = value;
break;

case 'justify-content':
target['-ms-flex-pack'] = toBoxValue(value);
target['-webkit-box-pack'] = toBoxValue(value);
target['-moz-box-pack'] = toBoxValue(value);
target['-webkit-justify-content'] = value;
break;

case 'align-items':
target['-ms-flex-align'] = toBoxValue(value);
target['-webkit-box-align'] = toBoxValue(value);
target['-moz-box-align'] = toBoxValue(value);
target['-webkit-align-items'] = toBoxValue(value);
break;

Expand Down

0 comments on commit aa41e12

Please sign in to comment.