Skip to content

Commit

Permalink
regroup common props in fallback code
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvainpolletvillard committed Apr 1, 2017
1 parent bd53dd6 commit f3425aa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/fallback.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ function getFallback({
zones: new Map
};

const zonesCommonRule = grid.rule.clone({
selector: grid.rule.selector + ' > *',
nodes: []
});
zonesCommonRule.append({ prop: "position", value: "absolute" });
zonesCommonRule.append({ prop: "box-sizing", value: "border-box" });
fallback.zones.set('*', { rule: zonesCommonRule })

for(let zone of zones){
fallback.zones.set(zone, getZoneFallback({
zone, grid, colIndexes, rowIndexes, colsDim, rowsDim
Expand Down Expand Up @@ -71,8 +79,6 @@ function getZoneFallback({
const {verticalOffset, alignByBottom} = getVerticalOffset({ props, zone, grid, rowsDim, rowIndexes, height });
const {horizontalOffset, alignByRight} = getHorizontalOffset({ props, zone, grid, colsDim, colIndexes, width });

fallbackProps.set("position", "absolute");
fallbackProps.set("box-sizing", "border-box");
fallbackProps.set("transform", getTransform({ props }));
fallbackProps.set(isStretchingVertically ? "height" : "max-height", height);
fallbackProps.set(isStretchingHorizontally ? "width" : "max-width", width);
Expand Down
2 changes: 1 addition & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ module.exports = function (options) {
grid.rule.parent.insertAfter(lastRule, supportsRule);
}

decl.remove();
decl.remove(); // remove grid-kiss rule in output

})
}
Expand Down

0 comments on commit f3425aa

Please sign in to comment.