Skip to content

Commit 2e4952e

Browse files
committed
Fix overflow fallback (fixes #415)
1 parent ba7952c commit 2e4952e

File tree

4 files changed

+25
-18
lines changed

4 files changed

+25
-18
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

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

78
## 4.0.3 (March 24, 2020)
89

lib/restructure/6-restructBlock.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,21 @@ var DONT_MIX_VALUE = {
1414
'text-align': /^(start|end|match-parent|justify-all)$/i
1515
};
1616

17-
var CURSOR_SAFE_VALUE = [
18-
'auto', 'crosshair', 'default', 'move', 'text', 'wait', 'help',
19-
'n-resize', 'e-resize', 's-resize', 'w-resize',
20-
'ne-resize', 'nw-resize', 'se-resize', 'sw-resize',
21-
'pointer', 'progress', 'not-allowed', 'no-drop', 'vertical-text', 'all-scroll',
22-
'col-resize', 'row-resize'
23-
];
24-
25-
var POSITION_SAFE_VALUE = [
26-
'static', 'relative', 'absolute', 'fixed'
27-
];
17+
var SAFE_VALUES = {
18+
cursor: [
19+
'auto', 'crosshair', 'default', 'move', 'text', 'wait', 'help',
20+
'n-resize', 'e-resize', 's-resize', 'w-resize',
21+
'ne-resize', 'nw-resize', 'se-resize', 'sw-resize',
22+
'pointer', 'progress', 'not-allowed', 'no-drop', 'vertical-text', 'all-scroll',
23+
'col-resize', 'row-resize'
24+
],
25+
overflow: [
26+
'hidden', 'visible', 'scroll', 'auto'
27+
],
28+
position: [
29+
'static', 'relative', 'absolute', 'fixed'
30+
]
31+
}
2832

2933
var NEEDLESS_TABLE = {
3034
'border-width': ['border'],
@@ -105,12 +109,8 @@ function getPropertyFingerprint(propertyName, declaration, fingerprints) {
105109
iehack = RegExp.lastMatch;
106110
}
107111

108-
if (realName === 'cursor') {
109-
if (CURSOR_SAFE_VALUE.indexOf(name) === -1) {
110-
special[name] = true;
111-
}
112-
} else if (realName === 'position') {
113-
if (POSITION_SAFE_VALUE.indexOf(name) === -1) {
112+
if (SAFE_VALUES.hasOwnProperty(realName)) {
113+
if (SAFE_VALUES[realName].indexOf(name) === -1) {
114114
special[name] = true;
115115
}
116116
} else if (DONT_MIX_VALUE.hasOwnProperty(realName)) {

test/fixture/compress/overflow.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/* https://github.com/css/csso/issues/415 */
2+
.selector {
3+
overflow: auto;
4+
overflow: overlay;
5+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.selector{overflow:auto;overflow:overlay}

0 commit comments

Comments
 (0)