Skip to content

Commit

Permalink
Fix overflow fallback (fixes #415)
Browse files Browse the repository at this point in the history
  • Loading branch information
lahmatiy committed Oct 27, 2020
1 parent ba7952c commit 2e4952e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 18 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

- Bumped [CSSTree](https://github.com/csstree/csstree) to `^1.0.0`
- Fixed wrongly merging of TRBL values when one of them contains `var()` (#420)
- Fixed wrongly merging of pseudo class and element with the same name, e.g. `:-ms-input-placeholder` and `::-ms-input-placeholder` (#383)
- Fixed wrongly merging of pseudo class and element with the same name, e.g. `:-ms-input-placeholder` and `::-ms-input-placeholder` (#383, #416)
- Fixed wrongly merging of `overflow` fallback (#415)

## 4.0.3 (March 24, 2020)

Expand Down
34 changes: 17 additions & 17 deletions lib/restructure/6-restructBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,21 @@ var DONT_MIX_VALUE = {
'text-align': /^(start|end|match-parent|justify-all)$/i
};

var CURSOR_SAFE_VALUE = [
'auto', 'crosshair', 'default', 'move', 'text', 'wait', 'help',
'n-resize', 'e-resize', 's-resize', 'w-resize',
'ne-resize', 'nw-resize', 'se-resize', 'sw-resize',
'pointer', 'progress', 'not-allowed', 'no-drop', 'vertical-text', 'all-scroll',
'col-resize', 'row-resize'
];

var POSITION_SAFE_VALUE = [
'static', 'relative', 'absolute', 'fixed'
];
var SAFE_VALUES = {
cursor: [
'auto', 'crosshair', 'default', 'move', 'text', 'wait', 'help',
'n-resize', 'e-resize', 's-resize', 'w-resize',
'ne-resize', 'nw-resize', 'se-resize', 'sw-resize',
'pointer', 'progress', 'not-allowed', 'no-drop', 'vertical-text', 'all-scroll',
'col-resize', 'row-resize'
],
overflow: [
'hidden', 'visible', 'scroll', 'auto'
],
position: [
'static', 'relative', 'absolute', 'fixed'
]
}

var NEEDLESS_TABLE = {
'border-width': ['border'],
Expand Down Expand Up @@ -105,12 +109,8 @@ function getPropertyFingerprint(propertyName, declaration, fingerprints) {
iehack = RegExp.lastMatch;
}

if (realName === 'cursor') {
if (CURSOR_SAFE_VALUE.indexOf(name) === -1) {
special[name] = true;
}
} else if (realName === 'position') {
if (POSITION_SAFE_VALUE.indexOf(name) === -1) {
if (SAFE_VALUES.hasOwnProperty(realName)) {
if (SAFE_VALUES[realName].indexOf(name) === -1) {
special[name] = true;
}
} else if (DONT_MIX_VALUE.hasOwnProperty(realName)) {
Expand Down
5 changes: 5 additions & 0 deletions test/fixture/compress/overflow.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* https://github.com/css/csso/issues/415 */
.selector {
overflow: auto;
overflow: overlay;
}
1 change: 1 addition & 0 deletions test/fixture/compress/overflow.min.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.selector{overflow:auto;overflow:overlay}

0 comments on commit 2e4952e

Please sign in to comment.